aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/roff.c
diff options
context:
space:
mode:
authorKristaps Dzonsons <kristaps@bsd.lv>2011-07-27 13:42:27 +0000
committerKristaps Dzonsons <kristaps@bsd.lv>2011-07-27 13:42:27 +0000
commit782e6e25eb7a311e35db1e16b59998bfc3033a8d (patch)
treeef840d8f5ed118edf7018603a0d50cc1cf06291f /roff.c
parent28d410a5b5d16d8adbf96aaae4ef71d0ae938144 (diff)
downloadmandoc-782e6e25eb7a311e35db1e16b59998bfc3033a8d.tar.gz
mandoc-782e6e25eb7a311e35db1e16b59998bfc3033a8d.tar.zst
mandoc-782e6e25eb7a311e35db1e16b59998bfc3033a8d.zip
Clean up roff_getstrn() function.
Diffstat (limited to 'roff.c')
-rw-r--r--roff.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/roff.c b/roff.c
index 129a90ef..68b5a423 100644
--- a/roff.c
+++ b/roff.c
@@ -1,4 +1,4 @@
-/* $Id: roff.c,v 1.156 2011/07/27 12:41:02 kristaps Exp $ */
+/* $Id: roff.c,v 1.157 2011/07/27 13:42:27 kristaps Exp $ */
/*
* Copyright (c) 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
* Copyright (c) 2010, 2011 Ingo Schwarze <schwarze@openbsd.org>
@@ -1519,11 +1519,12 @@ roff_getstrn(const struct roff *r, const char *name, size_t len)
{
const struct roffstr *n;
- n = r->first_string;
- while (n && (strncmp(name, n->name, len) || '\0' != n->name[(int)len]))
- n = n->next;
+ for (n = r->first_string; n; n = n->next)
+ if (0 == strncmp(name, n->name, len) &&
+ '\0' == n->name[(int)len])
+ return(n->string);
- return(n ? n->string : NULL);
+ return(NULL);
}
static void