zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] fix 'conditionally uninitialized' variables
@ 2016-08-22  9:27 Jun T.
  0 siblings, 0 replies; only message in thread
From: Jun T. @ 2016-08-22  9:27 UTC (permalink / raw)
  To: zsh-workers

I tried 'clang -Wconditional-uninitialized' and it gave about 25 warnings.
I've looked into only some of them, and I believe most of them can be
(or should be) ignored. The following two, however, may be worth fixing.

In builtin.c, the variable 's' may (or may not) be assigned at line 1480, but
using the value at line 1613 is meaningless. I guess this is just a typo.

utils.c is currently working fine because when NICEFLAG_QUOTE is set the
return value of mb_niceformat() is not used.


diff --git a/Src/builtin.c b/Src/builtin.c
index fb14b2e..da45300 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -1610,7 +1610,7 @@ bin_fc(char *nam, char **argv, Options ops, int func)
 		unqueue_signals();
 		if (fcedit(editor, fil)) {
 		    if (stuff(fil))
-			zwarnnam("fc", "%e: %s", errno, s);
+			zwarnnam("fc", "%e: %s", errno, fil);
 		    else {
 			loop(0,1);
 			retval = lastval;
diff --git a/Src/utils.c b/Src/utils.c
index 0a5954f..bdb614d 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -5080,8 +5080,10 @@ mb_niceformat(const char *s, FILE *stream, char **outstrp, int flags)
 	    cnt = 1;
 	    /* FALL THROUGH */
 	default:
-	    if (c == L'\'' && (flags & NICEFLAG_QUOTE))
+	    if (c == L'\'' && (flags & NICEFLAG_QUOTE)) {
 		fmt = "\\'";
+		newl = 2;
+	    }
 	    else
 		fmt = wcs_nicechar_sel(c, &newl, NULL, flags & NICEFLAG_QUOTE);
 	    break;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-08-22 10:11 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-22  9:27 [PATCH] fix 'conditionally uninitialized' variables Jun T.

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).