[hackers] [sbase] Simplify condition in wc(1) || sin

From: <git_AT_suckless.org>
Date: Mon, 20 Apr 2015 12:26:41 +0200 (CEST)

commit d412dad4709299674f5d0b137ccbb95a031815f2
Author: sin <sin_AT_2f30.org>
Date: Mon Apr 20 11:26:05 2015 +0100

    Simplify condition in wc(1)

diff --git a/wc.c b/wc.c
index e57cb4c..4995116 100644
--- a/wc.c
+++ b/wc.c
_AT_@ -32,8 +32,7 @@ wc(FILE *fp, const char *str)
         size_t nc = 0, nl = 0, nw = 0;
 
         while ((rlen = efgetrune(&c, fp, str))) {
- nc += (cmode == 'c' || !cmode) ? rlen :
- (c != Runeerror) ? 1 : 0;
+ nc += (cmode == 'c' || !cmode) ? rlen : (c != Runeerror);
                 if (c == '\n')
                         nl++;
                 if (!isspacerune(c))
Received on Mon Apr 20 2015 - 12:26:41 CEST

This archive was generated by hypermail 2.3.0 : Mon Apr 20 2015 - 12:36:18 CEST