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

A few compiler warnings



The following patch silences a few compiler warnings.

The first hunk sets "n" to NULL in bld_parts().  This isn't required
by the code, but gcc isn't smart enough to figure out that "n" can't
be used uninitialized.

The second hunk removes 3 unused variables.

The third hunk silences 3 "might be used uninitialized" warnings, but
someone who knows the code in cd_get() should look at it and see if
there is a better fix (such as making one of the other switch-case
sections the "default:", or returning an error).

I haven't committed any of this yet, though the second hunk is really
a no-brainer.  Comments?

..wayne..

---8<------8<------8<------8<---cut here--->8------>8------>8------>8---
Index: Src/Zle/compmatch.c
--- Src/Zle/compmatch.c	2001/06/27 13:18:39	1.36
+++ Src/Zle/compmatch.c	2001/08/07 19:33:00
@@ -1129,7 +1129,7 @@
 Cline
 bld_parts(char *str, int len, int plen, Cline *lp)
 {
-    Cline ret = NULL, *q = &ret, n;
+    Cline ret = NULL, *q = &ret, n = NULL;
     Cmlist ms;
     Cmatcher mp;
     int t, op = plen;
Index: Src/Zle/compresult.c
--- Src/Zle/compresult.c	2001/07/27 12:56:57	1.40
+++ Src/Zle/compresult.c	2001/08/07 19:33:01
@@ -1520,7 +1520,7 @@
     }
     if (!onlyexpl) {
 	char **pp;
-	int *ws, tlines, tline, tcols, maxlen, nth, width, glines;
+	int *ws, tlines, tcols, width, glines;

 	for (g = amatches; g; g = g->next) {
             add = 2 + !!(g->flags & CGF_FILES);
Index: Src/Zle/computil.c
--- Src/Zle/computil.c	2001/07/30 08:42:56	1.71
+++ Src/Zle/computil.c	2001/08/07 19:33:03
@@ -640,6 +640,11 @@
                 csl = "packed";
             }
             break;
+
+	default:
+	    /* Complain here? Is this impossible? */
+	    opts = mats = dpys = NULL;
+	    break;
         }
         setsparam(params[0], ztrdup(csl));
         setaparam(params[1], opts);
---8<------8<------8<------8<---cut here--->8------>8------>8------>8---



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