webdump

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.z3bra.org/webdump.git
Log | Files | Refs | README | LICENSE

commit 0ac210d169689c8e8a33351adf6a2d06b9f7322d
parent ec68d5635764887d323bc7e3e09c01fda411e865
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Thu, 27 Jun 2019 19:40:15 +0200

improve tag handling, by pazz0

example:

<pre>Das ist
ein Test</pre>

Diffstat:
main.c | 12++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/main.c b/main.c @@ -258,6 +258,10 @@ xmltagstart(XMLParser *x, const char *t, size_t tl) struct node *cur; int i; + if (curnode >= MAX_DEPTH - 2) + errx(1, "max tag depth reached: %d\n", curnode); + curnode++; + cur = &nodes[curnode]; memset(cur, 0, sizeof(*cur)); src[0] = '\0'; /* src, href */ @@ -289,8 +293,6 @@ xmltagend(XMLParser *p, const char *t, size_t tl, int isshort) struct node *cur; int i; - if (curnode) - curnode--; cur = &nodes[curnode]; if (!strcasecmp(t, "tr")) @@ -308,6 +310,8 @@ xmltagend(XMLParser *p, const char *t, size_t tl, int isshort) putchar('='); putchar('\n'); } + + curnode--; } static void @@ -372,10 +376,6 @@ xmltagstartparsed(XMLParser *p, const char *t, size_t tl, int isshort) for (i = 0; i < 36; i++) putchar('-'); } - - if (curnode >= MAX_DEPTH - 2) - errx(1, "max tag depth reached: %d\n", curnode); - curnode++; } static void