1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-27 01:25:34 +00:00

[form] str2form returned type enum form_type

This commit is contained in:
Witold Filipczyk 2022-01-28 13:59:25 +01:00
parent e5ce3faf31
commit f536645e58
3 changed files with 6 additions and 7 deletions

View File

@ -41,7 +41,7 @@ static struct form_type_name form_type2name[] = {
#define FORM_TYPE_COUNT (sizeof(form_type2name)/sizeof(struct form_type_name))
int
enum form_type
str2form_type(char *s)
{
int n;
@ -50,7 +50,7 @@ str2form_type(char *s)
if (!strcmp(form_type2name[n].name, s))
return form_type2name[n].num;
return -1;
return FC_NONE;
}
char *

View File

@ -71,6 +71,7 @@ enum form_type {
FC_RESET,
FC_BUTTON,
FC_HIDDEN,
FC_NONE = -1
};
enum form_mode {
@ -125,7 +126,7 @@ struct el_form_control {
};
/* Numerical form type <-> form type name */
int str2form_type(char *s);
enum form_type str2form_type(char *s);
char *form_type2str(enum form_type num);
struct form *init_form(void);

View File

@ -143,7 +143,6 @@ load_formhist_from_file(void)
char *type, *name, *value;
char *enc_value;
enum form_type ftype;
int ret;
if (tmp[0] == '\n' && !tmp[1]) break;
@ -180,9 +179,8 @@ cont:
if (!p) goto fail;
*p = '\0';
ret = str2form_type(type);
if (ret == -1) goto fail;
ftype = ret;
ftype = str2form_type(type);
if (ftype == FC_NONE) goto fail;
if (form->dontsave) continue;