zsh-workers
 help / color / mirror / code / Atom feed
From: Felipe Contreras <felipe.contreras@gmail.com>
To: zsh-workers@zsh.org
Cc: Felipe Contreras <felipe.contreras@gmail.com>
Subject: [PATCH 1/3] src: fix build warnings
Date: Wed, 30 Dec 2020 23:41:29 -0600	[thread overview]
Message-ID: <20201231054131.682544-2-felipe.contreras@gmail.com> (raw)
In-Reply-To: <20201231054131.682544-1-felipe.contreras@gmail.com>

  pattern.c: In function ‘patcomppiece’:
  pattern.c:1253:14: warning: ‘from’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   1253 |     zrange_t from, to;
        |              ^~~~
  utils.c: In function ‘getkeystring’:
  cc1: warning: function may return address of local variable [-Wreturn-local-addr]
  utils.c:6703:16: note: declared here
   6703 |     char *buf, tmp[1];
        |                ^~~

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 Src/pattern.c | 2 +-
 Src/utils.c   | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/Src/pattern.c b/Src/pattern.c
index c7c2c8bea..c28f2c9fb 100644
--- a/Src/pattern.c
+++ b/Src/pattern.c
@@ -1250,7 +1250,7 @@ patcomppiece(int *flagp, int paren)
     int hash, count;
     union upat up;
     char *nptr, *str0, *ptr, *patprev;
-    zrange_t from, to;
+    zrange_t from = 0, to;
     char *charstart;
 
     flags = 0;
diff --git a/Src/utils.c b/Src/utils.c
index 5151b89a8..37ae4c854 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -6700,7 +6700,8 @@ ucs4toutf8(char *dest, unsigned int wval)
 mod_export char *
 getkeystring(char *s, int *len, int how, int *misc)
 {
-    char *buf, tmp[1];
+    static char tmp[1];
+    char *buf;
     char *t, *tdest = NULL, *u = NULL, *sstart = s, *tbuf = NULL;
     char svchar = '\0';
     int meta = 0, control = 0, ignoring = 0;
-- 
2.30.0



  reply	other threads:[~2020-12-31  5:42 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-31  5:41 [PATCH 0/3] Build fixes Felipe Contreras
2020-12-31  5:41 ` Felipe Contreras [this message]
2021-01-02 11:22   ` [PATCH 1/3] src: fix build warnings Daniel Shahaf
2021-01-02 16:41     ` Mikael Magnusson
2021-01-02 18:30       ` Felipe Contreras
2021-01-04  5:14         ` Daniel Shahaf
2021-03-27 19:28           ` Lawrence Velázquez
2021-04-04  6:38             ` Jun. T
2020-12-31  5:41 ` [PATCH 2/3] autoconf: remove deprecated functions Felipe Contreras
2021-03-27 19:37   ` Lawrence Velázquez
2021-04-03 15:04     ` Lawrence Velázquez
2020-12-31  5:41 ` [PATCH 3/3] autoconf: prepare for 2.70 Felipe Contreras
2021-03-27 19:38   ` Lawrence Velázquez
2021-04-03 15:44     ` Lawrence Velázquez
2021-04-08 22:44       ` Oliver Kiddle
2021-04-09  4:18         ` Jun T
2021-04-09 20:08           ` Oliver Kiddle
2021-04-09 20:28             ` Peter Stephenson
2021-04-09 23:04               ` Bart Schaefer
2021-04-09 23:19                 ` Mikael Magnusson
2021-04-10  0:37                 ` 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=20201231054131.682544-2-felipe.contreras@gmail.com \
    --to=felipe.contreras@gmail.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).