diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2011-01-01 22:19:15 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2011-01-01 22:19:15 +0000 |
commit | 1e982599c7f339de5711a30d937e9f4ab18a529f (patch) | |
tree | 82a1fce6498226b5bbd1a76a2551424ce451193d /tbl.c | |
parent | 59cd23842b32e78c3cdc0afc0deafb3b7529e470 (diff) | |
download | mandoc-1e982599c7f339de5711a30d937e9f4ab18a529f.tar.gz mandoc-1e982599c7f339de5711a30d937e9f4ab18a529f.tar.zst mandoc-1e982599c7f339de5711a30d937e9f4ab18a529f.zip |
Plug in the "head" concept for tables. A tbl_head specifies the full
layout for each row, including vertical spacers. One grabs the tbl_head
for a row and iterates through each entry, plugging data from the
tbl_span into the header as appropriate.
This is pulled in more or less verbatim from tbl.bsd.lv. In fact, this
is verbatim except that lists macros are made into hard-coded lists (for
compatibility, as long-ago noted by joerg@).
Diffstat (limited to 'tbl.c')
-rw-r--r-- | tbl.c | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -1,4 +1,4 @@ -/* $Id: tbl.c,v 1.14 2011/01/01 16:10:40 kristaps Exp $ */ +/* $Id: tbl.c,v 1.15 2011/01/01 22:19:15 kristaps Exp $ */ /* * Copyright (c) 2009, 2010 Kristaps Dzonsons <kristaps@bsd.lv> * @@ -87,9 +87,9 @@ tbl_free(struct tbl *p) struct tbl_cell *cp; struct tbl_span *sp; struct tbl_dat *dp; + struct tbl_head *hp; - while (p->first_row) { - rp = p->first_row; + while (NULL != (rp = p->first_row)) { p->first_row = rp->next; while (rp->first) { cp = rp->first; @@ -99,8 +99,7 @@ tbl_free(struct tbl *p) free(rp); } - while (p->first_span) { - sp = p->first_span; + while (NULL != (sp = p->first_span)) { p->first_span = sp->next; while (sp->first) { dp = sp->first; @@ -112,6 +111,11 @@ tbl_free(struct tbl *p) free(sp); } + while (NULL != (hp = p->first_head)) { + p->first_head = hp->next; + free(hp); + } + free(p); } |