1
0
mirror of https://github.com/rkd77/elinks.git synced 2025-02-02 15:09:23 -05:00

skip_table(): simplify code.

This commit is contained in:
Laurent MONIN 2005-12-07 20:51:09 +01:00 committed by Laurent MONIN
parent f3838bac5b
commit a1284ccd1f

View File

@ -508,7 +508,7 @@ skip_table(unsigned char *html, unsigned char *eof)
while (1) { while (1) {
unsigned char *name; unsigned char *name;
int namelen; int namelen, closing_tag = 0;
while (html < eof while (html < eof
&& (*html != '<' && (*html != '<'
@ -518,14 +518,21 @@ skip_table(unsigned char *html, unsigned char *eof)
if (html >= eof) return eof; if (html >= eof) return eof;
if (*name == '/') {
closing_tag = 1;
name++; namelen--;
}
if (!strlcasecmp(name, namelen, "TABLE", 5)) { if (!strlcasecmp(name, namelen, "TABLE", 5)) {
if (!closing_tag) {
level++; level++;
} else if (!strlcasecmp(name, namelen, "/TABLE", 6)) { } else {
level--; level--;
if (!level) return html; if (!level) return html;
} }
} }
} }
}
struct table * struct table *
parse_table(unsigned char *html, unsigned char *eof, unsigned char **end, parse_table(unsigned char *html, unsigned char *eof, unsigned char **end,