From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from krisdoz.my.domain (schwarze@localhost [127.0.0.1]) by krisdoz.my.domain (8.14.3/8.14.3) with ESMTP id o78EpWSN014756 for ; Sun, 8 Aug 2010 10:51:32 -0400 (EDT) Received: (from schwarze@localhost) by krisdoz.my.domain (8.14.3/8.14.3/Submit) id o78EpWBf021355; Sun, 8 Aug 2010 10:51:32 -0400 (EDT) Date: Sun, 8 Aug 2010 10:51:32 -0400 (EDT) Message-Id: <201008081451.o78EpWBf021355@krisdoz.my.domain> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: schwarze@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: simplify the code copying the macro name, and sync the X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- 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 Modified Files: -------------- mdocml: man.c mdoc.c Revision Data ------------- Index: man.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/man.c,v retrieving revision 1.85 retrieving revision 1.86 diff -Lman.c -Lman.c -u -p -r1.85 -r1.86 --- man.c +++ man.c @@ -480,14 +480,14 @@ man_pmacro(struct man *m, int ln, char * ppos = i; - /* Copy the first word into a nil-terminated buffer. */ - - for (j = 0; j < 4; j++, i++) - if ('\0' == (mac[j] = buf[i])) - break; - else if (' ' == buf[i]) - break; + /* + * Copy the first word into a nil-terminated buffer. + * Stop copying when a tab, space, or eoln is encountered. + */ + j = 0; + while (j < 4 && '\0' != buf[i] && ' ' != buf[i] && '\t' != buf[i]) + mac[j++] = buf[i++]; mac[j] = '\0'; if (j == 4 || j < 1) { Index: mdoc.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mdoc.c,v retrieving revision 1.161 retrieving revision 1.162 diff -Lmdoc.c -Lmdoc.c -u -p -r1.161 -r1.162 --- mdoc.c +++ mdoc.c @@ -776,16 +776,13 @@ mdoc_pmacro(struct mdoc *m, int ln, char 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) { -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv