diff options
author | Kristaps Dzonsons <kristaps@bsd.lv> | 2011-07-27 13:42:27 +0000 |
---|---|---|
committer | Kristaps Dzonsons <kristaps@bsd.lv> | 2011-07-27 13:42:27 +0000 |
commit | 1554c4f6dffd3847bc9e6f7802c73e00e413efbc (patch) | |
tree | 9b76bbe7418d351a168054c88baaf6c95e9816d4 /roff.c | |
parent | 6d990f71285ba7cd96f7f25154866e8e4c07efa0 (diff) | |
download | mandoc-1554c4f6dffd3847bc9e6f7802c73e00e413efbc.tar.gz |
Clean up roff_getstrn() function.
Diffstat (limited to 'roff.c')
-rw-r--r-- | roff.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -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 |