aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mdoc_term.c
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2015-07-25 14:28:59 +0000
committerIngo Schwarze <schwarze@openbsd.org>2015-07-25 14:28:59 +0000
commitd7a1c33838e142532c49cdda9ea67e18aad92683 (patch)
treecf7e98dba0f9b17d889575bbb52feccb941cf7b4 /mdoc_term.c
parent7310229a6bc4ea0f603478894a168e2aa4dff9e6 (diff)
downloadmandoc-d7a1c33838e142532c49cdda9ea67e18aad92683.tar.gz
mandoc-d7a1c33838e142532c49cdda9ea67e18aad92683.tar.zst
mandoc-d7a1c33838e142532c49cdda9ea67e18aad92683.zip
Simplify and make tag_put() more efficient by integrating tag_get()
into it and by only handling NUL-terminated strings. Minus 25 lines of code, no functional change.
Diffstat (limited to 'mdoc_term.c')
-rw-r--r--mdoc_term.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/mdoc_term.c b/mdoc_term.c
index 3eea9d13..e0e1d380 100644
--- a/mdoc_term.c
+++ b/mdoc_term.c
@@ -1,4 +1,4 @@
-/* $Id: mdoc_term.c,v 1.323 2015/07/25 14:23:08 schwarze Exp $ */
+/* $Id: mdoc_term.c,v 1.324 2015/07/25 14:28:59 schwarze Exp $ */
/*
* Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2012-2015 Ingo Schwarze <schwarze@openbsd.org>
@@ -1481,10 +1481,8 @@ termp_fn_pre(DECL_ARGS)
term_word(p, n->string);
term_fontpop(p);
- if (n->sec == SEC_DESCRIPTION) {
- if ( ! tag_get(n->string, 0, ++fn_prio))
- tag_put(n->string, 0, fn_prio, p->line);
- }
+ if (n->sec == SEC_DESCRIPTION)
+ tag_put(n->string, ++fn_prio, p->line);
if (pretty) {
term_flushln(p);
@@ -2280,9 +2278,8 @@ termp_er_pre(DECL_ARGS)
if (n->sec == SEC_ERRORS &&
(n->parent->tok == MDOC_It ||
(n->parent->tok == MDOC_Bq &&
- n->parent->parent->parent->tok == MDOC_It)) &&
- ! tag_get(n->child->string, 0, 1))
- tag_put(n->child->string, 0, 1, p->line);
+ n->parent->parent->parent->tok == MDOC_It)))
+ tag_put(n->child->string, 1, p->line);
return(1);
}
@@ -2296,8 +2293,7 @@ termp_tag_pre(DECL_ARGS)
(n->parent->tok == MDOC_It ||
(n->parent->tok == MDOC_Xo &&
n->parent->parent->prev == NULL &&
- n->parent->parent->parent->tok == MDOC_It)) &&
- ! tag_get(n->child->string, 0, 1))
- tag_put(n->child->string, 0, 1, p->line);
+ n->parent->parent->parent->tok == MDOC_It)))
+ tag_put(n->child->string, 1, p->line);
return(1);
}