summaryrefslogtreecommitdiffstats
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
commit1554c4f6dffd3847bc9e6f7802c73e00e413efbc (patch)
tree9b76bbe7418d351a168054c88baaf6c95e9816d4 /roff.c
parent6d990f71285ba7cd96f7f25154866e8e4c07efa0 (diff)
downloadmandoc-1554c4f6dffd3847bc9e6f7802c73e00e413efbc.tar.gz
Clean up roff_getstrn() function.
Diffstat (limited to 'roff.c')
-rw-r--r--roff.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/roff.c b/roff.c
index 0d8a1c5b..259817d2 100644
--- a/roff.c
+++ b/roff.c
@@ -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