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

Re: [aj@xxxxxxxxx: Bug#297893: zsh-beta: FTBFS (amd64/gcc-4.0): static declaration of 'cmdstr' follows non-static declaration]



Clint Adams wrote:
> zle_tricky's exporting a cmdstr..

I thought I'd replied to this, but it seems not.

The completion code exports some funny things.  There used to be an
exported variable called "c" until I persuaded it not to.

In this case renaming the statics is easier.

Index: Src/Zle/zle_misc.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_misc.c,v
retrieving revision 1.20
diff -u -r1.20 zle_misc.c
--- Src/Zle/zle_misc.c	24 Feb 2005 21:11:44 -0000	1.20
+++ Src/Zle/zle_misc.c	3 Mar 2005 16:55:37 -0000
@@ -742,9 +742,9 @@
  * cmdstr is the buffer used for execute-named-command converted
  * to a metafied multibyte string.
  */
-static char *cmdstr;
-static LinkList cmdll;
-static int cmdambig;
+static char *namedcmdstr;
+static LinkList namedcmdll;
+static int namedcmdambig;
 
 /**/
 static void
@@ -753,11 +753,11 @@
     int l;
     Thingy t = (Thingy) hn;
 
-    if(strpfx(cmdstr, t->nam)) {
-	addlinknode(cmdll, t->nam);
-	l = pfxlen(peekfirst(cmdll), t->nam);
-	if (l < cmdambig)
-	    cmdambig = l;
+    if(strpfx(namedcmdstr, t->nam)) {
+	addlinknode(namedcmdll, t->nam);
+	l = pfxlen(peekfirst(namedcmdll), t->nam);
+	if (l < namedcmdambig)
+	    namedcmdambig = l;
     }
 
 }
@@ -808,7 +808,7 @@
 		int zmultsav = zmult;
 
 		zmult = 1;
-		listlist(cmdll);
+		listlist(namedcmdll);
 		showinglist = 0;
 		zmult = zmultsav;
 	    }
@@ -818,7 +818,7 @@
 		int zmultsav = zmult;
 
 		zmult = 1;
-		listlist(cmdll);
+		listlist(namedcmdll);
 		showinglist = 0;
 		zmult = zmultsav;
 	    }
@@ -860,10 +860,10 @@
 		Thingy r;
 		unambiguous:
 		*ptr = 0;
-		cmdstr = zlelineasstring(cmdbuf, len, 0, NULL, NULL, 0);
-		r = rthingy(cmdstr);
-		free(cmdstr);
-		cmdstr = NULL;
+		namedcmdstr = zlelineasstring(cmdbuf, len, 0, NULL, NULL, 0);
+		r = rthingy(namedcmdstr);
+		free(namedcmdstr);
+		namedcmdstr = NULL;
 		if (!(r->flags & DISABLED)) {
 		    unrefthingy(r);
 		    statusline = NULL;
@@ -886,16 +886,16 @@
 		cmd == Th(z_expandorcomplete) || cmd == Th(z_completeword) ||
 		cmd == Th(z_expandorcompleteprefix) || cmd == Th(z_vicmdmode) ||
 		cmd == Th(z_acceptline) || lastchar == ' ' || lastchar == '\t') {
-		cmdambig = 100;
+		namedcmdambig = 100;
 
-		cmdll = newlinklist();
+		namedcmdll = newlinklist();
 
-		cmdstr = zlelineasstring(cmdbuf, len, 0, NULL, NULL, 0);
+		namedcmdstr = zlelineasstring(cmdbuf, len, 0, NULL, NULL, 0);
 		scanhashtable(thingytab, 1, 0, DISABLED, scancompcmd, 0);
-		free(cmdstr);
-		cmdstr = NULL;
+		free(namedcmdstr);
+		namedcmdstr = NULL;
 
-		if (empty(cmdll)) {
+		if (empty(namedcmdll)) {
 		    feep = 1;
 		    if (listed)
 			clearlist = listshown = 1;
@@ -906,12 +906,12 @@
 		    *ptr = ZWC('_');
 		    statusll = l + len + 1;
 		    zmult = 1;
-		    listlist(cmdll);
+		    listlist(namedcmdll);
 		    listed = curlist = 1;
 		    showinglist = 0;
 		    zmult = zmultsav;
-		} else if (!nextnode(firstnode(cmdll))) {
-		    ZLE_STRING_T ztmp = stringaszleline(peekfirst(cmdll),
+		} else if (!nextnode(firstnode(namedcmdll))) {
+		    ZLE_STRING_T ztmp = stringaszleline(peekfirst(namedcmdll),
 							&len, NULL);
 		    ZS_memcpy(ptr = cmdbuf, ztmp, len);
 		    ptr += len;
@@ -920,25 +920,25 @@
 			goto unambiguous;
 		} else {
 		    int ltmp;
-		    ZLE_STRING_T ztmp = stringaszleline(peekfirst(cmdll),
+		    ZLE_STRING_T ztmp = stringaszleline(peekfirst(namedcmdll),
 							&ltmp, NULL);
 		    ZS_memcpy(cmdbuf, ztmp, ltmp);
 		    free(ztmp);
-		    ptr = cmdbuf + cmdambig;
+		    ptr = cmdbuf + namedcmdambig;
 		    *ptr = ZWC('_');
 		    if (isset(AUTOLIST) &&
-			!(isset(LISTAMBIGUOUS) && cmdambig > len)) {
+			!(isset(LISTAMBIGUOUS) && namedcmdambig > len)) {
 			int zmultsav = zmult;
 			if (isset(LISTBEEP))
 			    feep = 1;
-			statusll = l + cmdambig + 1;
+			statusll = l + namedcmdambig + 1;
 			zmult = 1;
-			listlist(cmdll);
+			listlist(namedcmdll);
 			listed = curlist = 1;
 			showinglist = 0;
 			zmult = zmultsav;
 		    }
-		    len = cmdambig;
+		    len = namedcmdambig;
 		}
 	    } else {
 		if (len == NAMLEN || cmd != Th(z_selfinsert))

-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

**********************************************************************



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