diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2010-08-08 14:51:32 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2010-08-08 14:51:32 +0000 |
commit | 5bbc504b836790e7b924111614880b47f00e53ce (patch) | |
tree | 36c19965481d0a9681b575907f563ef70a89a4b9 /mdoc.c | |
parent | 707c79c1b528a7fd9042ccdadadb8154470066e5 (diff) | |
download | mandoc-5bbc504b836790e7b924111614880b47f00e53ce.tar.gz |
simplify the code copying the macro name, and sync the
accompagnying comment between man_pmacro() and mdoc_pmacro();
ok'd by kristaps@ together with main.c rev. 1.102
Diffstat (limited to 'mdoc.c')
-rw-r--r-- | mdoc.c | 13 |
1 files changed, 5 insertions, 8 deletions
@@ -776,16 +776,13 @@ mdoc_pmacro(struct mdoc *m, int ln, char *buf, int offs) sv = i; /* - * Copy the first word into a nil-terminated buffer. Stop - * copying when a tab, space, or eoln is encountered. + * Copy the first word into a nil-terminated buffer. + * Stop copying when a tab, space, or eoln is encountered. */ - for (j = 0; j < 4; j++, i++) - if ('\0' == (mac[j] = buf[i])) - break; - else if (' ' == buf[i] || '\t' == buf[i]) - break; - + j = 0; + while (j < 4 && '\0' != buf[i] && ' ' != buf[i] && '\t' != buf[i]) + mac[j++] = buf[i++]; mac[j] = '\0'; if (j == 4 || j < 2) { |