timprove tag handling, by pazz0 - webdump - [FORK] git://git.codemadness.org/webdump
 (HTM) git clone git://git.z3bra.org/webdump.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 0ac210d169689c8e8a33351adf6a2d06b9f7322d
 (DIR) parent ec68d5635764887d323bc7e3e09c01fda411e865
 (HTM) 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:
         M main.c                              |      12 ++++++------
       
       1 file changed, 6 insertions(+), 6 deletions(-)
       ---
 (DIR) diff --git a/main.c b/main.c
       t@@ -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 */
       t@@ -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"))
       t@@ -308,6 +310,8 @@ xmltagend(XMLParser *p, const char *t, size_t tl, int isshort)
                                        putchar('=');
                        putchar('\n');
                }
       +
       +        curnode--;
        }
        
        static void
       t@@ -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