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

Re: More compiler warnings after recent patches



Bart Schaefer wrote:

> Thanks for the quick reply on the options.c thing ... here's more:
> 
> ../../../zsh-3.1.5/Src/Zle/compctl.c: In function `parse_cmatcher':
> ../../../zsh-3.1.5/Src/Zle/compctl.c:186: warning: `r' might be used uninitialized in this function
> ... [ more of that...]

In all cases the variables couldn't be used uninitialised. It was just 
that the compiler tried to be clever, and...

Bye
 Sven

diff -u os/Zle/compctl.c Src/Zle/compctl.c
--- os/Zle/compctl.c	Thu Mar 11 14:31:01 1999
+++ Src/Zle/compctl.c	Thu Mar 11 17:26:07 1999
@@ -183,7 +183,7 @@
 static Cmatcher
 parse_cmatcher(char *name, char *s)
 {
-    Cmatcher ret = NULL, r, n;
+    Cmatcher ret = NULL, r = NULL, n;
     Cpattern line, word, left, right;
     int fl, ll, wl, lal, ral, err;
 
@@ -276,8 +276,10 @@
 	n->right = right;
 	n->ralen = ral;
 
-	if (ret) r->next = n;
-	else ret = n;
+	if (ret)
+	    r->next = n;
+	else
+	    ret = n;
 
 	r = n;
     }
@@ -290,7 +292,7 @@
 static Cpattern
 parse_pattern(char *name, char **sp, int *lp, char e, int *err)
 {
-    Cpattern ret = NULL, r, n;
+    Cpattern ret = NULL, r = NULL, n;
     unsigned char *s = (unsigned char *) *sp;
     int l = 0;
 
@@ -1707,6 +1709,7 @@
 	}
 	for (p = *argv + 1; *p; p++) {
 	    sp = NULL;
+	    e = NULL;
 	    dm = 0;
 	    switch (*p) {
 	    case 'q':
@@ -2229,7 +2232,7 @@
     if (comp_check()) {
 	char *s, **p;
 	int i, l = arrlen(compwords), t = 0, b = 0, e = l - 1;
-	Comp c;
+	Comp c = NULL;
 
 	i = compcurrent - 1;
 	if (i < 0 || i >= l)

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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