diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2009-06-18 20:46:19 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2009-06-18 20:46:19 +0000 |
commit | 65dc168510767708e266ed70c10c9e2a646424fa (patch) | |
tree | 893ef034f49f88a19a1a3a753e0d514227aaa6ce /mdoc_validate.c | |
parent | 5a58b9c46f195b91a6e97db9ae3778de5e5bae2f (diff) | |
download | mandoc-65dc168510767708e266ed70c10c9e2a646424fa.tar.gz mandoc-65dc168510767708e266ed70c10c9e2a646424fa.tar.zst mandoc-65dc168510767708e266ed70c10c9e2a646424fa.zip |
Added nchild decrement in libman (not used, but better in than forgotten).
Added nchild to libmdoc, deprecated count() functions in validator.
Diffstat (limited to 'mdoc_validate.c')
-rw-r--r-- | mdoc_validate.c | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/mdoc_validate.c b/mdoc_validate.c index 71b9ff27..48751d87 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_validate.c,v 1.15 2009/06/17 14:10:09 kristaps Exp $ */ +/* $Id: mdoc_validate.c,v 1.16 2009/06/18 20:46:19 kristaps Exp $ */ /* * Copyright (c) 2008, 2009 Kristaps Dzonsons <kristaps@kth.se> * @@ -99,7 +99,6 @@ static int err_child_gt(struct mdoc *, const char *, int); static int warn_child_gt(struct mdoc *, const char *, int); static int err_child_eq(struct mdoc *, const char *, int); static int warn_child_eq(struct mdoc *, const char *, int); -static int count_child(struct mdoc *); static int warn_print(struct mdoc *, int, int); static int warn_count(struct mdoc *, const char *, int, const char *, int); @@ -553,19 +552,6 @@ err_count(struct mdoc *m, const char *k, } -static inline int -count_child(struct mdoc *mdoc) -{ - int i; - struct mdoc_node *n; - - for (i = 0, n = mdoc->last->child; n; n = n->next, i++) - /* Do nothing */ ; - - return(i); -} - - /* * Build these up with macros because they're basically the same check * for different inequalities. Yes, this could be done with functions, @@ -576,10 +562,9 @@ count_child(struct mdoc *mdoc) static int \ lvl##_child_##name(struct mdoc *mdoc, const char *p, int sz) \ { \ - int i; \ - if ((i = count_child(mdoc)) ineq sz) \ + if (mdoc->last->nchild ineq sz) \ return(1); \ - return(lvl##_count(mdoc, #ineq, sz, p, i)); \ + return(lvl##_count(mdoc, #ineq, sz, p, mdoc->last->nchild)); \ } #define CHECK_BODY_DEFN(name, lvl, func, num) \ |