zsh-workers
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.stephenson@samsung.com>
To: zsh-workers@zsh.org
Subject: Re: Misc. compile warnings
Date: Tue, 30 Sep 2014 09:53:23 +0100	[thread overview]
Message-ID: <20140930095323.21c81922@pwslap01u.europe.root.pri> (raw)
In-Reply-To: <alpine.LRH.2.00.1409291356010.698@toltec.zanshin.com>

On Mon, 29 Sep 2014 14:01:17 -0700 (PDT)
Bart Schaefer <schaefer@brasslantern.com> wrote:
> Just upgraded Mavericks and am seeing some compile warnings I don't recall
> having encountered before:
> 
> compctl.c:3419:11: warning: expression which evaluates to zero treated as a null
>       pointer constant of type 'char *' [-Wnon-literal-null-conversion]
>                         *npp = '\0';
>                                ^~~~
> 
> zle_refresh.c:432:13: warning: expression which evaluates to zero treated as a
>       null pointer constant of type 'char *' [-Wnon-literal-null-conversion]
>     *arrp = '\0';
>             ^~~~

The point is *npp and *arrp are char *, not char, so should be NULL, not
a character zero.

> zle_refresh.c:261:30: warning: unused variable 'zr_ht' [-Wunused-const-variable]
> static const REFRESH_ELEMENT zr_ht = { ZWC('\t'), 0 };

Yes, it's not used.

pws

diff --git a/Src/Zle/compctl.c b/Src/Zle/compctl.c
index 52b9e9c..0b7a324 100644
--- a/Src/Zle/compctl.c
+++ b/Src/Zle/compctl.c
@@ -3416,7 +3416,7 @@ makecomplistflags(Compctl cc, char *s, int incmd, int compadd)
 			    *npp++ = tp;
 			    pp++;
 			}
-			*npp = '\0';
+			*npp = NULL;
 		    }
 		}
 		if (!dirs) {
diff --git a/Src/Zle/zle_refresh.c b/Src/Zle/zle_refresh.c
index 80be27f..684ac13 100644
--- a/Src/Zle/zle_refresh.c
+++ b/Src/Zle/zle_refresh.c
@@ -258,7 +258,6 @@ static const REFRESH_ELEMENT zr_cr = { ZWC('\r'), 0 };
 static const REFRESH_ELEMENT zr_dt = { ZWC('.'), 0 };
 static const REFRESH_ELEMENT zr_nl = { ZWC('\n'), 0 };
 static const REFRESH_ELEMENT zr_sp = { ZWC(' '), 0 };
-static const REFRESH_ELEMENT zr_ht = { ZWC('\t'), 0 };
 static const REFRESH_ELEMENT zr_zr = { ZWC('\0'), 0 };
 
 /*
@@ -429,7 +428,7 @@ get_region_highlight(UNUSED(Param pm))
 		digbuf1, digbuf2);
 	(void)output_highlight(rhp->atr, *arrp + strlen(*arrp));
     }
-    *arrp = '\0';
+    *arrp = NULL;
     return retarr;
 }
 


  reply	other threads:[~2014-09-30  8:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-29 21:01 Bart Schaefer
2014-09-30  8:53 ` Peter Stephenson [this message]
2014-10-29 14:09   ` Jun T.

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=20140930095323.21c81922@pwslap01u.europe.root.pri \
    --to=p.stephenson@samsung.com \
    --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).