0
0
mirror of https://github.com/rkd77/elinks.git synced 2025-06-30 22:19:29 -04:00

Simplify tests.

This commit is contained in:
Laurent MONIN 2005-12-08 16:25:22 +01:00 committed by Laurent MONIN
parent d9f0de82f8
commit 1f7aa841aa

View File

@ -411,56 +411,56 @@ abort:
goto end_parse; goto end_parse;
} }
if (closing_tag && !strlcasecmp(name, namelen, "OPTION", 6)) { if (!strlcasecmp(name, namelen, "OPTION", 6)) {
add_select_item(&lnk_menu, &lbl, &orig_lbl, values, order, nnmi); if (closing_tag) {
goto see; add_select_item(&lnk_menu, &lbl, &orig_lbl, values, order, nnmi);
}
if (!closing_tag && !strlcasecmp(name, namelen, "OPTION", 6)) {
unsigned char *value, *label;
add_select_item(&lnk_menu, &lbl, &orig_lbl, values, order, nnmi);
if (has_attr(t_attr, "disabled", html_context->options))
goto see; goto see;
if (preselect == -1 } else {
&& has_attr(t_attr, "selected", html_context->options)) unsigned char *value, *label;
preselect = order;
value = get_attr_val(t_attr, "value", html_context->options);
if (!mem_align_alloc(&values, order, order + 1, unsigned char *, 0xFF)) add_select_item(&lnk_menu, &lbl, &orig_lbl, values, order, nnmi);
goto abort;
values[order++] = value; if (has_attr(t_attr, "disabled", html_context->options))
label = get_attr_val(t_attr, "label", html_context->options); goto see;
if (label) new_menu_item(&lnk_menu, label, order - 1, 0); if (preselect == -1
if (!value || !label) { && has_attr(t_attr, "selected", html_context->options))
init_string(&lbl); preselect = order;
init_string(&orig_lbl); value = get_attr_val(t_attr, "value", html_context->options);
nnmi = !!label;
if (!mem_align_alloc(&values, order, order + 1, unsigned char *, 0xFF))
goto abort;
values[order++] = value;
label = get_attr_val(t_attr, "label", html_context->options);
if (label) new_menu_item(&lnk_menu, label, order - 1, 0);
if (!value || !label) {
init_string(&lbl);
init_string(&orig_lbl);
nnmi = !!label;
}
goto see;
} }
goto see;
} }
if ((!closing_tag && !strlcasecmp(name, namelen, "OPTGROUP", 8)) if (!strlcasecmp(name, namelen, "OPTGROUP", 8)) {
|| (closing_tag && !strlcasecmp(name, namelen, "/OPTGROUP", 9))) {
add_select_item(&lnk_menu, &lbl, &orig_lbl, values, order, nnmi); add_select_item(&lnk_menu, &lbl, &orig_lbl, values, order, nnmi);
if (group) new_menu_item(&lnk_menu, NULL, -1, 0), group = 0; if (group) new_menu_item(&lnk_menu, NULL, -1, 0), group = 0;
}
if (!closing_tag && !strlcasecmp(name, namelen, "OPTGROUP", 8)) { if (!closing_tag) {
unsigned char *label; unsigned char *label;
label = get_attr_val(t_attr, "label", html_context->options); label = get_attr_val(t_attr, "label", html_context->options);
if (!label) { if (!label) {
label = stracpy(""); label = stracpy("");
if (!label) goto see; if (!label) goto see;
}
new_menu_item(&lnk_menu, label, -1, 0);
group = 1;
} }
new_menu_item(&lnk_menu, label, -1, 0);
group = 1;
} }
goto see; goto see;