mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
[form] str2form returned type enum form_type
This commit is contained in:
parent
e5ce3faf31
commit
f536645e58
@ -41,7 +41,7 @@ static struct form_type_name form_type2name[] = {
|
|||||||
|
|
||||||
#define FORM_TYPE_COUNT (sizeof(form_type2name)/sizeof(struct form_type_name))
|
#define FORM_TYPE_COUNT (sizeof(form_type2name)/sizeof(struct form_type_name))
|
||||||
|
|
||||||
int
|
enum form_type
|
||||||
str2form_type(char *s)
|
str2form_type(char *s)
|
||||||
{
|
{
|
||||||
int n;
|
int n;
|
||||||
@ -50,7 +50,7 @@ str2form_type(char *s)
|
|||||||
if (!strcmp(form_type2name[n].name, s))
|
if (!strcmp(form_type2name[n].name, s))
|
||||||
return form_type2name[n].num;
|
return form_type2name[n].num;
|
||||||
|
|
||||||
return -1;
|
return FC_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
|
@ -71,6 +71,7 @@ enum form_type {
|
|||||||
FC_RESET,
|
FC_RESET,
|
||||||
FC_BUTTON,
|
FC_BUTTON,
|
||||||
FC_HIDDEN,
|
FC_HIDDEN,
|
||||||
|
FC_NONE = -1
|
||||||
};
|
};
|
||||||
|
|
||||||
enum form_mode {
|
enum form_mode {
|
||||||
@ -125,7 +126,7 @@ struct el_form_control {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Numerical form type <-> form type name */
|
/* 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);
|
char *form_type2str(enum form_type num);
|
||||||
|
|
||||||
struct form *init_form(void);
|
struct form *init_form(void);
|
||||||
|
@ -143,7 +143,6 @@ load_formhist_from_file(void)
|
|||||||
char *type, *name, *value;
|
char *type, *name, *value;
|
||||||
char *enc_value;
|
char *enc_value;
|
||||||
enum form_type ftype;
|
enum form_type ftype;
|
||||||
int ret;
|
|
||||||
|
|
||||||
if (tmp[0] == '\n' && !tmp[1]) break;
|
if (tmp[0] == '\n' && !tmp[1]) break;
|
||||||
|
|
||||||
@ -180,9 +179,8 @@ cont:
|
|||||||
if (!p) goto fail;
|
if (!p) goto fail;
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
|
|
||||||
ret = str2form_type(type);
|
ftype = str2form_type(type);
|
||||||
if (ret == -1) goto fail;
|
if (ftype == FC_NONE) goto fail;
|
||||||
ftype = ret;
|
|
||||||
|
|
||||||
if (form->dontsave) continue;
|
if (form->dontsave) continue;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user