From 9f43b1c3d607d391a0d3bbd9971ae787ae74c0cc Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Sun, 21 Jun 2009 18:15:04 +0000 Subject: sync to 1.7.19: kristaps@ rewrote post_bf to reduce nesting no functional change --- usr.bin/mandoc/mdoc_validate.c | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) (limited to 'usr.bin') diff --git a/usr.bin/mandoc/mdoc_validate.c b/usr.bin/mandoc/mdoc_validate.c index 4cf3c36b977..32771fdffd4 100644 --- a/usr.bin/mandoc/mdoc_validate.c +++ b/usr.bin/mandoc/mdoc_validate.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_validate.c,v 1.9 2009/06/19 07:20:19 schwarze Exp $ */ +/* $Id: mdoc_validate.c,v 1.10 2009/06/21 18:15:03 schwarze Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons * @@ -1069,25 +1069,24 @@ post_bf(POST_ARGS) head = mdoc->last->head; - if (NULL == mdoc->last->args) { - if (NULL == head->child || - MDOC_TEXT != head->child->type) - return(mdoc_err(mdoc, "text argument expected")); + if (mdoc->last->args && head->child) + return(mdoc_err(mdoc, "one argument expected")); + else if (mdoc->last->args) + return(1); - p = head->child->string; - if (0 == strcmp(p, "Em")) - return(1); - else if (0 == strcmp(p, "Li")) - return(1); - else if (0 == strcmp(p, "Sm")) - return(1); - return(mdoc_nerr(mdoc, head->child, "invalid font")); - } + if (NULL == head->child || MDOC_TEXT != head->child->type) + return(mdoc_err(mdoc, "text argument expected")); - if (head->child) - return(mdoc_err(mdoc, "one argument expected")); + p = head->child->string; - return(1); + if (0 == strcmp(p, "Em")) + return(1); + else if (0 == strcmp(p, "Li")) + return(1); + else if (0 == strcmp(p, "Sm")) + return(1); + + return(mdoc_nerr(mdoc, head->child, "invalid font mode")); } -- cgit v1.2.3