Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Misc. compile warnings



On Mon, 29 Sep 2014 14:01:17 -0700 (PDT)
Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
> Just upgraded Mavericks and am seeing some compile warnings I don't recall
> having encountered before:
> 
> compctl.c:3419:11: warning: expression which evaluates to zero treated as a null
>       pointer constant of type 'char *' [-Wnon-literal-null-conversion]
>                         *npp = '\0';
>                                ^~~~
> 
> zle_refresh.c:432:13: warning: expression which evaluates to zero treated as a
>       null pointer constant of type 'char *' [-Wnon-literal-null-conversion]
>     *arrp = '\0';
>             ^~~~

The point is *npp and *arrp are char *, not char, so should be NULL, not
a character zero.

> zle_refresh.c:261:30: warning: unused variable 'zr_ht' [-Wunused-const-variable]
> static const REFRESH_ELEMENT zr_ht = { ZWC('\t'), 0 };

Yes, it's not used.

pws

diff --git a/Src/Zle/compctl.c b/Src/Zle/compctl.c
index 52b9e9c..0b7a324 100644
--- a/Src/Zle/compctl.c
+++ b/Src/Zle/compctl.c
@@ -3416,7 +3416,7 @@ makecomplistflags(Compctl cc, char *s, int incmd, int compadd)
 			    *npp++ = tp;
 			    pp++;
 			}
-			*npp = '\0';
+			*npp = NULL;
 		    }
 		}
 		if (!dirs) {
diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c
index 80be27f..684ac13 100644
--- a/Src/Zle/zle_refresh.c
+++ b/Src/Zle/zle_refresh.c
@@ -258,7 +258,6 @@ static const REFRESH_ELEMENT zr_cr = { ZWC('\r'), 0 };
 static const REFRESH_ELEMENT zr_dt = { ZWC('.'), 0 };
 static const REFRESH_ELEMENT zr_nl = { ZWC('\n'), 0 };
 static const REFRESH_ELEMENT zr_sp = { ZWC(' '), 0 };
-static const REFRESH_ELEMENT zr_ht = { ZWC('\t'), 0 };
 static const REFRESH_ELEMENT zr_zr = { ZWC('\0'), 0 };
 
 /*
@@ -429,7 +428,7 @@ get_region_highlight(UNUSED(Param pm))
 		digbuf1, digbuf2);
 	(void)output_highlight(rhp->atr, *arrp + strlen(*arrp));
     }
-    *arrp = '\0';
+    *arrp = NULL;
     return retarr;
 }
 



Messages sorted by: Reverse Date, Date, Thread, Author