From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from krisdoz.my.domain (kristaps@localhost [127.0.0.1]) by krisdoz.my.domain (8.14.3/8.14.3) with ESMTP id o6HC1iD4031282 for ; Sat, 17 Jul 2010 08:01:45 -0400 (EDT) Received: (from kristaps@localhost) by krisdoz.my.domain (8.14.3/8.14.3/Submit) id o6HC1iot002957; Sat, 17 Jul 2010 08:01:44 -0400 (EDT) Date: Sat, 17 Jul 2010 08:01:44 -0400 (EDT) Message-Id: <201007171201.o6HC1iot002957@krisdoz.my.domain> X-Mailinglist: mdocml-source Reply-To: source@mdocml.bsd.lv MIME-Version: 1.0 From: kristaps@mdocml.bsd.lv To: source@mdocml.bsd.lv Subject: mdocml: Avoid letter-by-letter encoding by using strcspn() in X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Log Message: ----------- Avoid letter-by-letter encoding by using strcspn() in term_word(). Modified Files: -------------- mdocml: term.c Revision Data ------------- Index: term.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/term.c,v retrieving revision 1.161 retrieving revision 1.162 diff -Lterm.c -Lterm.c -u -p -r1.161 -r1.162 --- term.c +++ term.c @@ -503,14 +503,13 @@ term_word(struct termp *p, const char *w p->flags &= ~TERMP_SENTENCE; - /* FIXME: use strcspn. */ - while (*word) { - if ('\\' != *word) { - encode(p, word, 1); - word++; + if ((ssz = strcspn(word, "\\")) > 0) + encode(p, word, ssz); + + word += ssz; + if ('\\' != *word) continue; - } seq = ++word; sz = a2roffdeco(&deco, &seq, &ssz); @@ -547,7 +546,7 @@ term_word(struct termp *p, const char *w * Note that we don't process the pipe: the parser sees it as * punctuation, but we don't in terms of typography. */ - if (sv[0] && 0 == sv[1]) + if (sv[0] && '\0' == sv[1]) switch (sv[0]) { case('('): /* FALLTHROUGH */ -- To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv