zsh-workers
 help / color / mirror / code / Atom feed
From: "Jun T." <takimoto-j@kba.biglobe.ne.jp>
To: "zsh-workers@zsh.org" <zsh-workers@zsh.org>
Subject: [PATCH] fix 'conditionally uninitialized' variables
Date: Mon, 22 Aug 2016 18:27:06 +0900	[thread overview]
Message-ID: <8FC5A03A-E11B-47A0-B0F0-5DCDE7E6DAEE@kba.biglobe.ne.jp> (raw)

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;


                 reply	other threads:[~2016-08-22 10:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8FC5A03A-E11B-47A0-B0F0-5DCDE7E6DAEE@kba.biglobe.ne.jp \
    --to=takimoto-j@kba.biglobe.ne.jp \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).