From 789580a2a2366243d622766fdadd094931ca6596 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Thu, 8 Jun 2017 12:54:58 +0000 Subject: make the internal a2roffsu() interface more powerful by returning a pointer to the end of the parsed data, making it easier to parse subsequent bytes --- man_term.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'man_term.c') diff --git a/man_term.c b/man_term.c index dcb7d89c..7f026ce9 100644 --- a/man_term.c +++ b/man_term.c @@ -1,4 +1,4 @@ -/* $Id: man_term.c,v 1.203 2017/06/07 17:38:26 schwarze Exp $ */ +/* $Id: man_term.c,v 1.204 2017/06/08 12:54:58 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2015, 2017 Ingo Schwarze @@ -260,7 +260,7 @@ pre_PD(DECL_ARGS) return 0; } assert(n->type == ROFFT_TEXT); - if (a2roffsu(n->string, &su, SCALE_VS)) + if (a2roffsu(n->string, &su, SCALE_VS) != NULL) mt->pardist = term_vspan(p, &su); return 0; } @@ -374,7 +374,7 @@ pre_in(DECL_ARGS) else cp--; - if ( ! a2roffsu(++cp, &su, SCALE_EN)) + if (a2roffsu(++cp, &su, SCALE_EN) == NULL) return 0; v = (term_hspan(p, &su) + 11) / 24; @@ -425,7 +425,7 @@ pre_HP(DECL_ARGS) /* Calculate offset. */ if ((nn = n->parent->head->child) != NULL && - a2roffsu(nn->string, &su, SCALE_EN)) { + a2roffsu(nn->string, &su, SCALE_EN) != NULL) { len = term_hspan(p, &su) / 24; if (len < 0 && (size_t)(-len) > mt->offset) len = -mt->offset; @@ -510,7 +510,7 @@ pre_IP(DECL_ARGS) /* Calculate the offset from the optional second argument. */ if ((nn = n->parent->head->child) != NULL && (nn = nn->next) != NULL && - a2roffsu(nn->string, &su, SCALE_EN)) { + a2roffsu(nn->string, &su, SCALE_EN) != NULL) { len = term_hspan(p, &su) / 24; if (len < 0 && (size_t)(-len) > mt->offset) len = -mt->offset; @@ -592,7 +592,7 @@ pre_TP(DECL_ARGS) if ((nn = n->parent->head->child) != NULL && nn->string != NULL && ! (NODE_LINE & nn->flags) && - a2roffsu(nn->string, &su, SCALE_EN)) { + a2roffsu(nn->string, &su, SCALE_EN) != NULL) { len = term_hspan(p, &su) / 24; if (len < 0 && (size_t)(-len) > mt->offset) len = -mt->offset; @@ -796,7 +796,7 @@ pre_RS(DECL_ARGS) n->aux = SHRT_MAX + 1; if (n->child == NULL) n->aux = mt->lmargin[mt->lmargincur]; - else if (a2roffsu(n->child->string, &su, SCALE_EN)) + else if (a2roffsu(n->child->string, &su, SCALE_EN) != NULL) n->aux = term_hspan(p, &su) / 24; if (n->aux < 0 && (size_t)(-n->aux) > mt->offset) n->aux = -mt->offset; -- cgit v1.2.3-56-ge451