diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2021-10-17 20:48:28 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2021-10-17 20:48:28 +0000 |
commit | 5ed637f72da223e9b7588d933126d37bc9a00117 (patch) | |
tree | b01cc5cb9355c7c08175ad9d039b8006e757f135 /out.c | |
parent | 8570d06222a4adf4bae9506c89bbc76dea96f962 (diff) | |
download | mandoc-5ed637f72da223e9b7588d933126d37bc9a00117.tar.gz |
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.
Diffstat (limited to 'out.c')
-rw-r--r-- | out.c | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -149,7 +149,6 @@ tblcalc(struct rofftbl *tbl, const struct tbl_span *sp_first, * 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 struct tbl_span *sp_first, 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, struct roffcol *col, 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; } |