1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-10-01 03:36:26 -04:00

html_input(): drop local variable @type, use @fc->type directly.

This commit is contained in:
Laurent MONIN 2005-12-04 12:43:53 +01:00 committed by Laurent MONIN
parent 7a443d0f73
commit a57c193ad9

View File

@ -194,27 +194,26 @@ html_input(struct html_context *html_context, unsigned char *a,
int i;
unsigned char *al;
struct form_control *fc;
enum form_type type = FC_TEXT;
fc = init_form_control(FC_TEXT, a, html_context);
if (!fc) return;
al = get_attr_val(a, "type", html_context->options);
if (al) {
if (!strcasecmp(al, "text")) type = FC_TEXT;
else if (!strcasecmp(al, "hidden")) type = FC_HIDDEN;
else if (!strcasecmp(al, "button")) type = FC_BUTTON;
else if (!strcasecmp(al, "checkbox")) type = FC_CHECKBOX;
else if (!strcasecmp(al, "radio")) type = FC_RADIO;
else if (!strcasecmp(al, "password")) type = FC_PASSWORD;
else if (!strcasecmp(al, "submit")) type = FC_SUBMIT;
else if (!strcasecmp(al, "reset")) type = FC_RESET;
else if (!strcasecmp(al, "file")) type = FC_FILE;
else if (!strcasecmp(al, "image")) type = FC_IMAGE;
if (!strcasecmp(al, "text")) fc->type = FC_TEXT;
else if (!strcasecmp(al, "hidden")) fc->type = FC_HIDDEN;
else if (!strcasecmp(al, "button")) fc->type = FC_BUTTON;
else if (!strcasecmp(al, "checkbox")) fc->type = FC_CHECKBOX;
else if (!strcasecmp(al, "radio")) fc->type = FC_RADIO;
else if (!strcasecmp(al, "password")) fc->type = FC_PASSWORD;
else if (!strcasecmp(al, "submit")) fc->type = FC_SUBMIT;
else if (!strcasecmp(al, "reset")) fc->type = FC_RESET;
else if (!strcasecmp(al, "file")) fc->type = FC_FILE;
else if (!strcasecmp(al, "image")) fc->type = FC_IMAGE;
/* else unknown type, let it default to FC_TEXT. */
mem_free(al);
}
fc = init_form_control(type, a, html_context);
if (!fc) return;
fc->name = get_attr_val(a, "name", html_context->options);
if (fc->type != FC_FILE)
fc->default_value = get_attr_val(a, "value",