From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 17798 invoked from network); 17 Oct 2021 20:49:03 -0000 Received: from bsd.lv (HELO mandoc.bsd.lv) (66.111.2.12) by inbox.vuxu.org with ESMTPUTF8; 17 Oct 2021 20:49:03 -0000 Received: from fantadrom.bsd.lv (localhost [127.0.0.1]) by mandoc.bsd.lv (OpenSMTPD) with ESMTP id dfd2d5aa for ; Sun, 17 Oct 2021 15:48:59 -0500 (EST) Received: from localhost (mandoc.bsd.lv [local]) by mandoc.bsd.lv (OpenSMTPD) with ESMTPA id 1a4492cd for ; Sun, 17 Oct 2021 15:48:59 -0500 (EST) Date: Sun, 17 Oct 2021 15:48:59 -0500 (EST) X-Mailinglist: mandoc-source Reply-To: source@mandoc.bsd.lv MIME-Version: 1.0 From: schwarze@mandoc.bsd.lv To: source@mandoc.bsd.lv Subject: mandoc: Simplify the code building lists of spans, no output change X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Message-ID: Log Message: ----------- Simplify the code building lists of spans, no output change intended. A comment in the code claimed that the list of spans would be sorted, but the sorting did not actually work. The layout "LSSS,LLSL" resulted in the list "0-3, 1-2", whereas the layout "LLSL,LSSS" resulted in the list "1-2, 0-3". Since sorting serves no purpose, just leave the list unsorted. Modified Files: -------------- mandoc: out.c Revision Data ------------- Index: out.c =================================================================== RCS file: /home/cvs/mandoc/mandoc/out.c,v retrieving revision 1.83 retrieving revision 1.84 diff -Lout.c -Lout.c -u -p -r1.83 -r1.84 --- out.c +++ out.c @@ -149,7 +149,6 @@ tblcalc(struct rofftbl *tbl, const struc * to data cells in the data section. */ - gp = &first_group; for (dp = sp->first; dp != NULL; dp = dp->next) { icol = dp->layout->col; while (maxcol < icol + dp->hspans) @@ -190,16 +189,16 @@ tblcalc(struct rofftbl *tbl, const struc continue; /* - * Build an ordered, singly linked list + * Build a singly linked list * of all groups of columns joined by spans, * recording the minimum width for each group. */ - while (*gp != NULL && ((*gp)->startcol < icol || - (*gp)->endcol < icol + dp->hspans)) + gp = &first_group; + while (*gp != NULL && ((*gp)->startcol != icol || + (*gp)->endcol != icol + dp->hspans)) gp = &(*gp)->next; - if (*gp == NULL || (*gp)->startcol > icol || - (*gp)->endcol > icol + dp->hspans) { + if (*gp == NULL) { g = mandoc_malloc(sizeof(*g)); g->next = *gp; g->wanted = width; @@ -554,5 +553,7 @@ tblcalc_number(struct rofftbl *tbl, stru col->nwidth = totsz; if (col->nwidth > col->width) col->width = col->nwidth; + fprintf(stderr, "N=%zu D=%zu I=%zu T=%zu %s\n", + col->nwidth, col->decimal, intsz, totsz, dp->string); return totsz; } -- To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv