code-style: improve some code-style for multiline comments - sfeed - RSS and Atom parser
 (HTM) git clone git://git.codemadness.org/sfeed
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 3f9e25899c6c860d622c18af1b7058135c4a802d
 (DIR) parent b2b2426f7742a8a640f1bd8bb9709452baebdca7
 (HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
       Date:   Wed, 20 Nov 2024 19:58:46 +0100
       
       code-style: improve some code-style for multiline comments
       
       Just noticed it when reviewing some code. It is not important though and no
       promises this will be kept consistent in the future.
       
       Diffstat:
         M sfeed.c                             |      30 +++++++++++++++---------------
         M sfeed_atom.c                        |       4 ++--
         M sfeed_curses.c                      |      24 ++++++++++++------------
         M sfeed_xmlenc.c                      |       2 +-
         M util.c                              |      12 ++++++------
         M util.h                              |       2 +-
         M xml.h                               |       2 +-
       
       7 files changed, 38 insertions(+), 38 deletions(-)
       ---
 (DIR) diff --git a/sfeed.c b/sfeed.c
       @@ -433,8 +433,8 @@ string_print_timestamp(String *s)
        }
        
        /* Convert time fields. Returns a signed (at least) 64-bit UNIX timestamp.
       -   Parameters should be passed as they are in a struct tm:
       -   that is: year = year - 1900, month = month - 1. */
       + * Parameters should be passed as they are in a struct tm:
       + * that is: year = year - 1900, month = month - 1. */
        static long long
        datetounix(long long year, int mon, int day, int hour, int min, int sec)
        {
       @@ -459,8 +459,8 @@ datetounix(long long year, int mon, int day, int hour, int min, int sec)
                        t = 31536000 * (year - 70) + (86400 * leaps); /* 365 * 86400 = 31536000 */
                } else {
                        /* general leap year calculation:
       -                   leap years occur mostly every 4 years but every 100 years
       -                   a leap year is skipped unless the year is divisible by 400 */
       +                 * leap years occur mostly every 4 years but every 100 years
       +                 * a leap year is skipped unless the year is divisible by 400 */
                        cycles = (year - 100) / 400;
                        rem = (year - 100) % 400;
                        if (rem < 0) {
       @@ -489,7 +489,7 @@ datetounix(long long year, int mon, int day, int hour, int min, int sec)
                        leaps += (97 * cycles) + (24 * centuries) - is_leap;
        
                        /* adjust 8 leap days from 1970 up to and including 2000:
       -                   ((30 * 365) + 8) * 86400 = 946771200 */
       +                 * ((30 * 365) + 8) * 86400 = 946771200 */
                        t = ((year - 100) * 31536000LL) + (leaps * 86400LL) + 946771200LL;
                }
                t += secs_through_month[mon];
       @@ -555,7 +555,7 @@ gettzoffset(const char *s)
        }
        
        /* Parse time string `s` into the UNIX timestamp `tp`.
       -   Returns 0 on success or -1 on failure. */
       + * Returns 0 on success or -1 on failure. */
        static int
        parsetime(const char *s, long long *tp)
        {
       @@ -725,7 +725,7 @@ xmlattr(XMLParser *p, const char *t, size_t tl, const char *n, size_t nl,
                        return;
        
                /* content-type may be for Atom: text, xhtml, html or a mime-type.
       -           for MRSS (media:description): plain, html. */
       +         * for MRSS (media:description): plain, html. */
                if (ISCONTENTTAG(ctx)) {
                        if (isattr(n, nl, STRP("type")))
                                string_append(&attrtype, v, vl);
       @@ -921,7 +921,7 @@ xmltagstartparsed(XMLParser *p, const char *t, size_t tl, int isshort)
                                ctx.tag.id = RSSTagGuidPermalinkFalse;
                } else if (ctx.tag.id == AtomTagLink) {
                        /* empty or "alternate": other types could be
       -                   "enclosure", "related", "self" or "via" */
       +                 * "enclosure", "related", "self" or "via" */
                        if (!attrrel.len || isattr(attrrel.data, attrrel.len, STRP("alternate")))
                                ctx.tag.id = AtomTagLinkAlternate;
                        else if (isattr(attrrel.data, attrrel.len, STRP("enclosure")))
       @@ -933,7 +933,7 @@ xmltagstartparsed(XMLParser *p, const char *t, size_t tl, int isshort)
                tagid = ctx.tag.id;
        
                /* map tag type to field: unknown or lesser priority is ignored,
       -           when tags of the same type are repeated only the first is used. */
       +         * when tags of the same type are repeated only the first is used. */
                if (fieldmap[tagid] == -1 ||
                    (!ISFEEDFIELDMULTI(fieldmap[tagid]) &&
                     tagid <= ctx.fields[fieldmap[tagid]].tagid)) {
       @@ -967,7 +967,7 @@ xmltagstartparsed(XMLParser *p, const char *t, size_t tl, int isshort)
                ctx.fields[fieldmap[tagid]].tagid = tagid;
        
                /* clear field if it is overwritten (with a priority order) for the new
       -           value, if the field can have multiple values then do not clear it. */
       +         * value, if the field can have multiple values then do not clear it. */
                if (!ISFEEDFIELDMULTI(fieldmap[ctx.tag.id]))
                        string_clear(ctx.field);
        }
       @@ -991,9 +991,9 @@ xmltagend(XMLParser *p, const char *t, size_t tl, int isshort)
                                return;
                        }
                } else if (ctx.tag.id && istag(ctx.tag.name, ctx.tag.len, t, tl)) {
       -                /* matched tag end: close it */
       -                /* copy also to the link field if the attribute isPermaLink="true"
       -                   and it is not set by a tag with higher priority. */
       +                /* matched tag end: close it.
       +                 * copy also to the link field if the attribute isPermaLink="true"
       +                 * and it is not set by a tag with higher priority. */
                        if (ctx.tag.id == RSSTagGuidPermalinkTrue && ctx.field &&
                            ctx.tag.id > ctx.fields[FeedFieldLink].tagid) {
                                string_clear(&ctx.fields[FeedFieldLink].str);
       @@ -1022,8 +1022,8 @@ xmltagend(XMLParser *p, const char *t, size_t tl, int isshort)
                }
        
                /* temporary string: for fields that cannot be processed
       -           directly and need more context, for example by its tag
       -           attributes, like the Atom link rel="alternate|enclosure". */
       +         * directly and need more context, for example by its tag
       +         * attributes, like the Atom link rel="alternate|enclosure". */
                if (tmpstr.len && ctx.field) {
                        if (ISFEEDFIELDMULTI(fieldmap[ctx.tag.id])) {
                                if (ctx.field->len)
 (DIR) diff --git a/sfeed_atom.c b/sfeed_atom.c
       @@ -93,8 +93,8 @@ printfeed(FILE *fp, const char *feedname)
                                        fputs("\t<content type=\"html\">", stdout);
                                } else {
                                        /* NOTE: an RSS/Atom viewer may or may not format
       -                                   whitespace such as newlines.
       -                                   Workaround: type="html" and <![CDATA[<pre></pre>]]> */
       +                                 * whitespace such as newlines.
       +                                 * Workaround: type="html" and <![CDATA[<pre></pre>]]> */
                                        fputs("\t<content>", stdout);
                                }
                                printcontent(fields[FieldContent]);
 (DIR) diff --git a/sfeed_curses.c b/sfeed_curses.c
       @@ -307,7 +307,7 @@ colw(const char *s)
        }
        
        /* Format `len` columns of characters. If string is shorter pad the rest
       -   with characters `pad`. */
       + * with characters `pad`. */
        static int
        utf8pad(char *buf, size_t bufsiz, const char *s, size_t len, int pad)
        {
       @@ -590,10 +590,10 @@ processexit(pid_t pid, int interactive)
        }
        
        /* Pipe item line or item field to a program.
       -   If `field` is -1 then pipe the TSV line, else a specified field.
       -   if `interactive` is 1 then cleanup and restore the tty and wait on the
       -   process.
       -   if 0 then don't do that and also write stdout and stderr to /dev/null. */
       + * If `field` is -1 then pipe the TSV line, else a specified field.
       + * if `interactive` is 1 then cleanup and restore the tty and wait on the
       + * process.
       + * if 0 then don't do that and also write stdout and stderr to /dev/null. */
        static void
        pipeitem(const char *cmd, struct item *item, int field, int interactive)
        {
       @@ -1099,7 +1099,7 @@ statusbar_draw(struct statusbar *s)
                cursormove(s->x, s->y);
                THEME_STATUSBAR();
                /* terminals without xenl (eat newline glitch) mess up scrolling when
       -           using the last cell on the last line on the screen. */
       +         * using the last cell on the last line on the screen. */
                printutf8pad(stdout, s->text, s->width - (!eat_newline_glitch), ' ');
                fflush(stdout);
                attrmode(ATTR_RESET);
       @@ -1875,7 +1875,7 @@ markread(struct pane *p, off_t from, off_t to, int isread)
                        _exit(status);
                default:
                        /* waitpid() and block on process status change,
       -                   fail if the exit status code was unavailable or non-zero */
       +                 * fail if the exit status code was unavailable or non-zero */
                        if (waitpid(pid, &status, 0) <= 0 || status)
                                break;
        
       @@ -2072,9 +2072,9 @@ main(int argc, char *argv[])
                                        button &= ~keymask; /* unset key mask */
        
                                        /* button numbers (0 - 2) encoded in lowest 2 bits
       -                                   release does not indicate which button (so set to 0).
       -                                   Handle extended buttons like scrollwheels
       -                                   and side-buttons by each range. */
       +                                 * release does not indicate which button (so set to 0).
       +                                 * Handle extended buttons like scrollwheels
       +                                 * and side-buttons by each range. */
                                        release = 0;
                                        if (button == 3) {
                                                button = -1;
       @@ -2364,8 +2364,8 @@ event:
                        if (state_sigchld) {
                                state_sigchld = 0;
                                /* wait on child processes so they don't become a zombie,
       -                           do not block the parent process if there is no status,
       -                           ignore errors */
       +                         * do not block the parent process if there is no status,
       +                         * ignore errors */
                                while (waitpid((pid_t)-1, NULL, WNOHANG) > 0)
                                        ;
                        }
 (DIR) diff --git a/sfeed_xmlenc.c b/sfeed_xmlenc.c
       @@ -12,7 +12,7 @@ static void
        xmltagstart(XMLParser *p, const char *t, size_t tl)
        {
                /* optimization: try to find a processing instruction only at the
       -           start of the data at the first few starting tags. */
       +         * start of the data at the first few starting tags. */
                if (tags++ > 3)
                        exit(0);
        }
 (DIR) diff --git a/util.c b/util.c
       @@ -8,7 +8,7 @@
        #include "util.h"
        
        /* print to stderr, print error message of errno and exit().
       -   Unlike BSD err() it does not prefix __progname */
       + * Unlike BSD err() it does not prefix __progname */
        __dead void
        err(int exitstatus, const char *fmt, ...)
        {
       @@ -29,7 +29,7 @@ err(int exitstatus, const char *fmt, ...)
        }
        
        /* print to stderr and exit().
       -   Unlike BSD errx() it does not prefix __progname */
       + * Unlike BSD errx() it does not prefix __progname */
        __dead void
        errx(int exitstatus, const char *fmt, ...)
        {
       @@ -89,7 +89,7 @@ uri_hasscheme(const char *s)
        }
        
        /* Parse URI string `s` into an uri structure `u`.
       -   Returns 0 on success or -1 on failure */
       + * Returns 0 on success or -1 on failure */
        int
        uri_parse(const char *s, struct uri *u)
        {
       @@ -204,8 +204,8 @@ parsepath:
        }
        
        /* Transform and try to make the URI `u` absolute using base URI `b` into `a`.
       -   Follows some of the logic from "RFC 3986 - 5.2.2. Transform References".
       -   Returns 0 on success, -1 on error or truncation. */
       + * Follows some of the logic from "RFC 3986 - 5.2.2. Transform References".
       + * Returns 0 on success, -1 on error or truncation. */
        int
        uri_makeabs(struct uri *a, struct uri *u, struct uri *b)
        {
       @@ -311,7 +311,7 @@ strtotime(const char *s, time_t *t)
                        return -1;
        
                /* NOTE: the type long long supports the 64-bit range. If time_t is
       -           64-bit it is "2038-ready", otherwise it is truncated/wrapped. */
       +         * 64-bit it is "2038-ready", otherwise it is truncated/wrapped. */
                if (t)
                        *t = (time_t)l;
        
 (DIR) diff --git a/util.h b/util.h
       @@ -58,7 +58,7 @@ enum {
        };
        
        /* hint for compilers and static analyzers that a function does not return.
       -   some compilers use: __attribute__((noreturn)), _Noreturn, noreturn */
       + * some compilers use: __attribute__((noreturn)), _Noreturn, noreturn */
        #ifndef __dead
        #define __dead
        #endif
 (DIR) diff --git a/xml.h b/xml.h
       @@ -23,7 +23,7 @@ typedef struct xmlparser {
        
        #ifndef GETNEXT
                /* GETNEXT overridden to reduce function call overhead and further
       -           context optimizations. */
       +         * context optimizations. */
                #define GETNEXT getchar_unlocked
        #endif