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

Re: Compile warnings again



Bart Schaefer wrote to me:

> ...
> 
> ../../zsh-3.1.5/Src/subst.c: In function `paramsubst':
> ../../zsh-3.1.5/Src/subst.c:705: warning: `v' might be used uninitialized in this function
> ../../../zsh-3.1.5/Src/Zle/zle_tricky.c: In function `match_str':
> ../../../zsh-3.1.5/Src/Zle/zle_tricky.c:2085: warning: `savl' might be used uninitialized in this function
> ... [ more of these ]

In all cases, the variables couldn't really be used uninitialised, it
was just that gcc didn't see it.

Bye
 Sven

--- os/subst.c	Mon Mar 22 13:44:38 1999
+++ Src/subst.c	Wed Mar 24 08:51:12 1999
@@ -702,7 +702,7 @@
     int spbreak = isset(SHWORDSPLIT) && !ssub && !qt;
     char *val = NULL, **aval = NULL;
     unsigned int fwidth = 0;
-    Value v;
+    Value v = NULL;
     int flags = 0;
     int flnum = 0;
     int sortit = 0, casind = 0;
diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- os/Zle/zle_tricky.c	Tue Mar 23 13:36:49 1999
+++ Src/Zle/zle_tricky.c	Wed Mar 24 08:53:40 1999
@@ -2082,7 +2082,7 @@
 
 		if (mp->wlen < 0) {
 		    int both, loff, aoff, llen, alen, zoff, moff, ct, ict;
-		    char *tp, savl, savw;
+		    char *tp, savl = '\0', savw;
 		    Cpattern ap;
 
 		    /* This is for `*' patterns, first initialise some
@@ -2907,8 +2907,8 @@
 {
     Cline p = NULL, o, n;
     struct cmdata md, omd;
-    char **sstr;
-    int len, join, line, *slen;
+    char **sstr = NULL;
+    int len, join = 0, line = 0, *slen = NULL;
 
     if (sfx) {
 	o = ot->suffix; n = nt->suffix;
@@ -3410,7 +3410,7 @@
     char *s, *ms, *lipre = NULL, *lisuf = NULL, *lpre = NULL, *lsuf = NULL;
     char **aign = NULL;
     int lpl, lsl, pl, sl, bpl, bsl, llpl = 0, llsl = 0, nm = mnum;
-    int oisalt, isalt, isexact;
+    int oisalt = 0, isalt, isexact;
     Cline lc = NULL;
     Cmatch cm;
     struct cmlist mst;
@@ -6306,7 +6306,7 @@
     int ocs = cs, ncs, pcs, pm, sm, d, b, i, j, li = 0;
     int pl, sl, hasp, hass, ppos, spos, plen, slen;
 
-    ppos = spos = plen = slen = 0;
+    ppos = spos = plen = slen = hasp = hass = 0;
     pm = sm = d = b = pl = sl = -1;
 
     /* Get the information about the brace beginning and end we have

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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