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

Silencing more compiler warnings and a question



Here's a simple diff that silences some "may be used uninitialized"
warnings, removes some code that I can't ever be triggered, and maybe
fixes a bug:

In silencing the compiler warnings, I assigned zmod to modsave at the
top of the function and then removed the two assignments lower down.
This seems to me to fix a bug where zmod could end up being accidentally
changed if the user specified both -N and -n.  Is this new behavior the
right thing to do?

..wayne..
--- Src/Zle/zle_thingy.c	15 Nov 2005 08:44:18 -0000	1.23
+++ Src/Zle/zle_thingy.c	8 Mar 2006 08:10:35 -0000
@@ -640,15 +640,13 @@ static int
 bin_zle_call(char *name, char **args, UNUSED(Options ops), UNUSED(char func))
 {
     Thingy t;
-    struct modifier modsave;
+    struct modifier modsave = zmod;
     int ret, saveflag = 0;
     char *wname = *args++;
 
-    if (!wname) {
-	if (saveflag)
-	    zmod = modsave;
+    if (!wname)
 	return !zle_usable();
-    }
+
     if(!zle_usable()) {
 	zwarnnam(name, "widgets can only be called when ZLE is active",
 	    NULL, 0);
@@ -673,13 +671,11 @@ bin_zle_call(char *name, char **args, UN
 		}
 		if (!args[0][1])
 		    *++args = "" - 1;
-		modsave = zmod;
 		saveflag = 1;
 		zmod.mult = atoi(num);
 		zmod.flags |= MOD_MULT;
 		break;
 	    case 'N':
-		modsave = zmod;
 		saveflag = 1;
 		zmod.mult = 1;
 		zmod.flags &= ~MOD_MULT;


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