URI: 
       literal text handling: some cleanup, remove an indentation - webdump - HTML to plain-text converter for webpages
  HTML git clone git://git.codemadness.org/webdump
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit 82ad9d077a5edd1627bc2ab3a6c8d4916e4e9309
   DIR parent ea4304af9bf0a29e671632dad484376d7a709ac7
  HTML Author: Hiltjo Posthuma <hiltjo@codemadness.org>
       Date:   Sun,  5 Jul 2026 23:58:01 +0200
       
       literal text handling: some cleanup, remove an indentation
       
       Make the code easier to read for the regular case.
       
       Diffstat:
         M webdump.c                           |      58 +++++++++++++++---------------
       
       1 file changed, 29 insertions(+), 29 deletions(-)
       ---
   DIR diff --git a/webdump.c b/webdump.c
       @@ -449,9 +449,9 @@ static int
        getnext_literal(void)
        {
                char *p;
       -        int c, fullmatch;
       +        int c;
        
       -        /* there is data in the pushback buffer */
       +        /* check if there is data in the pushback buffer: process it first. */
                if (pushend != pushbuf) {
                        if (pushoff >= pushend) {
                                /* reached the offset where the tag ended */
       @@ -460,7 +460,8 @@ getnext_literal(void)
                                        getnext_literal_end();
                                        return c; /* end tag */
                                }
       -                        getnext_literal_reset(); /* reset pushback buffer */
       +                        /* otherwise reached the end of pushback buffer, proceed normally */
       +                        getnext_literal_reset();
                        } else {
                                return (int)*(pushoff++);
                        }
       @@ -473,40 +474,39 @@ getnext_literal(void)
                                break;
                }
        
       +        /* typical case: regular character */
       +        if (ignorestate == endtagmatch)
       +                return c;
       +
                /* process a partial or full match on the tag:
       -           partial: handle "<" as a data entity "&lt;", full: handle as end tag */
       -        if (ignorestate != endtagmatch) {
       -                fullmatch = (*ignorestate == '\0');
       -                pushoff = pushbuf;
       -                pushend = pushbuf;
       -                /* buffer not checked, it should alway fit. */
       -                if (fullmatch) {
       -                        for (p = endtagmatch; *p && p < ignorestate; p++)
       -                                *(pushend++) = *p;
       -                        pushtagend = pushend; /* offset where the tag ended */
       -                } else {
       -                        for (p = endtagmatch; *p && p < ignorestate; p++) {
       -                                if (!fullmatch && *p == '<') {
       -                                        memcpy(pushend, "&lt;", 4);
       -                                        pushend += 4;
       -                                } else {
       -                                        *(pushend++) = *p;
       -                                }
       -                        }
       -                        /* append current character to end of pushback buffer */
       -                        if (c == '<') {
       +           full: handle as end tag. partial: handle "<" as a data entity "&lt;".
       +           buffers are not checked, they always fit (size of tag + space for at least "&lt;&lt;"). */
       +        pushoff = pushbuf;
       +        pushend = pushbuf;
       +        if (*ignorestate == '\0') { /* full match */
       +                for (p = endtagmatch; *p && p < ignorestate; p++)
       +                        *(pushend++) = *p;
       +                pushtagend = pushend; /* offset where the tag ended */
       +        } else { /* partial match */
       +                for (p = endtagmatch; *p && p < ignorestate; p++) {
       +                        if (*p == '<') {
                                        memcpy(pushend, "&lt;", 4);
                                        pushend += 4;
                                } else {
       -                                *(pushend++) = c;
       +                                *(pushend++) = *p;
                                }
                        }
       -                ignorestate = endtagmatch; /* reset state for matching to beginning */
       -
       -                return (int)*(pushoff++);
       +                /* append current character to end of pushback buffer */
       +                if (c == '<') {
       +                        memcpy(pushend, "&lt;", 4);
       +                        pushend += 4;
       +                } else {
       +                        *(pushend++) = c;
       +                }
                }
       +        ignorestate = endtagmatch; /* reset state for matching to beginning */
        
       -        return c;
       +        return (int)*(pushoff++); /* first character in pushback buffer, always exists */
        }
        
        static void