From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from krisdoz.my.domain (schwarze@localhost [127.0.0.1]) by krisdoz.my.domain (8.14.5/8.14.5) with ESMTP id s6V0fAoT001853 for ; Wed, 30 Jul 2014 20:41:10 -0400 (EDT) Received: (from schwarze@localhost) by krisdoz.my.domain (8.14.5/8.14.3/Submit) id s6V0fAP3024103; Wed, 30 Jul 2014 20:41:10 -0400 (EDT) Date: Wed, 30 Jul 2014 20:41:10 -0400 (EDT) Message-Id: <201407310041.s6V0fAP3024103@krisdoz.my.domain> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: schwarze@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: In .Bl -column, if some of the column width declarations are X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- In .Bl -column, if some of the column width declarations are given right after the -column argument and some at the very end of the argument list, after some other arguments like -compact, concatenate the column lists. This gets rid of one of the last useless FATAL errors and actually shortens the code by a few lines. This fixes an issue introduced more than five years ago, at first causing an assert() since mdoc_action.c rev. 1.14 (June 17, 2009), then later a FATAL error since mdoc_validate rev. 1.130 (Nov. 30, 2010), and marked as "TODO" ever since. Modified Files: -------------- mdocml: mandoc.h mdoc_validate.c read.c Revision Data ------------- Index: mdoc_validate.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc_validate.c,v retrieving revision 1.236 retrieving revision 1.237 diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.236 -r1.237 --- mdoc_validate.c +++ mdoc_validate.c @@ -1451,6 +1451,7 @@ static int post_bl_head(POST_ARGS) { struct mdoc_node *np, *nn, *nnp; + struct mdoc_argv *argv; int i, j; if (LIST_column != mdoc->last->norm->Bl.type) @@ -1458,22 +1459,12 @@ post_bl_head(POST_ARGS) return(hwarn_eq0(mdoc)); /* - * Convert old-style lists, where the column width specifiers + * Append old-style lists, where the column width specifiers * trail as macro parameters, to the new-style ("normal-form") * lists where they're argument values following -column. */ - /* First, disallow both types and allow normal-form. */ - - /* - * TODO: technically, we can accept both and just merge the two - * lists, but I'll leave that for another day. - */ - - if (mdoc->last->norm->Bl.ncols && mdoc->last->nchild) { - mdoc_nmsg(mdoc, mdoc->last, MANDOCERR_COLUMNS); - return(0); - } else if (NULL == mdoc->last->child) + if (mdoc->last->child == NULL) return(1); np = mdoc->last->parent; @@ -1484,7 +1475,6 @@ post_bl_head(POST_ARGS) break; assert(j < (int)np->args->argc); - assert(0 == np->args->argv[j].sz); /* * Accommodate for new-style groff column syntax. Shuffle the @@ -1492,15 +1482,17 @@ post_bl_head(POST_ARGS) * column field. Then, delete the head children. */ - np->args->argv[j].sz = (size_t)mdoc->last->nchild; - np->args->argv[j].value = mandoc_reallocarray(NULL, - (size_t)mdoc->last->nchild, sizeof(char *)); + argv = np->args->argv + j; + i = argv->sz; + argv->sz += mdoc->last->nchild; + argv->value = mandoc_reallocarray(argv->value, + argv->sz, sizeof(char *)); - mdoc->last->norm->Bl.ncols = np->args->argv[j].sz; - mdoc->last->norm->Bl.cols = (void *)np->args->argv[j].value; + mdoc->last->norm->Bl.ncols = argv->sz; + mdoc->last->norm->Bl.cols = (void *)argv->value; - for (i = 0, nn = mdoc->last->child; nn; i++) { - np->args->argv[j].value[i] = nn->string; + for (nn = mdoc->last->child; nn; i++) { + argv->value[i] = nn->string; nn->string = NULL; nnp = nn; nn = nn->next; Index: mandoc.h =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandoc.h,v retrieving revision 1.147 retrieving revision 1.148 diff -Lmandoc.h -Lmandoc.h -u -p -r1.147 -r1.148 --- mandoc.h +++ mandoc.h @@ -161,7 +161,6 @@ enum mandocerr { MANDOCERR_FATAL, /* ===== start of fatal errors ===== */ MANDOCERR_TOOLARGE, /* input too large */ - MANDOCERR_COLUMNS, /* column syntax is inconsistent */ MANDOCERR_BADDISP, /* NOT IMPLEMENTED: .Bd -file */ MANDOCERR_SO_PATH, /* NOT IMPLEMENTED: .so with absolute path or ".." */ MANDOCERR_SO_FAIL, /* .so request failed */ Index: read.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/read.c,v retrieving revision 1.74 retrieving revision 1.75 diff -Lread.c -Lread.c -u -p -r1.74 -r1.75 --- read.c +++ read.c @@ -205,7 +205,6 @@ static const char * const mandocerrs[MAN "generic fatal error", "input too large", - "column syntax is inconsistent", "NOT IMPLEMENTED: .Bd -file", "NOT IMPLEMENTED: .so with absolute path or \"..\"", ".so request failed", -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv