From: schwarze@mandoc.bsd.lv
To: source@mandoc.bsd.lv
Subject: mandoc: Simplify the code building lists of spans, no output change
Date: Sun, 17 Oct 2021 15:48:59 -0500 (EST) [thread overview]
Message-ID: <c2ab192a3becddcc@mandoc.bsd.lv> (raw)
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
reply other threads:[~2021-10-17 20:49 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c2ab192a3becddcc@mandoc.bsd.lv \
--to=schwarze@mandoc.bsd.lv \
--cc=source@mandoc.bsd.lv \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).