Hi tech@ --

Clang points this out when building mg:

clang -O2 -pipe  -Wall -DFKEYS -DREGEX -DXKEYS   -c /home/brian/mg/buffer.c
/home/brian/mg/buffer.c:461:11: warning: comparison of array 'bp->b_fname' not equal to a null pointer is always true [-Wtautological-pointer-compare]
                if (bp->b_fname != NULL && *(bp->b_fname) != '\0' &&
                    ~~~~^~~~~~~    ~~~~
1 warning generated.

Diff below to kill the warning.

OK?

~Brian

Index: buffer.c
===================================================================
RCS file: /cvs/src/usr.bin/mg/buffer.c,v
retrieving revision 1.93
diff -u -p -r1.93 buffer.c
--- buffer.c    20 Mar 2014 07:47:29 -0000      1.93
+++ buffer.c    12 Jun 2014 03:33:34 -0000
@@ -458,7 +458,7 @@ anycb(int f)
        char             pbuf[NFILEN + 11];

        for (bp = bheadp; bp != NULL; bp = bp->b_bufp) {
-               if (bp->b_fname != NULL && *(bp->b_fname) != '\0' &&
+               if (*(bp->b_fname) != '\0' &&
                    (bp->b_flag & BFCHG) != 0) {
                        ret = snprintf(pbuf, sizeof(pbuf), "Save file %s",
                            bp->b_fname);

Reply via email to