From: Eric Wong <user@example.com>
To: mwrap-perl@80x24.org
Cc: Eric Wong <e@80x24.org>
Subject: [PATCH 3/4] quiet uninitialized variable warnings
Date: Sat, 2 Nov 2019 10:40:19 +0000 [thread overview]
Message-ID: <20191102104020.30317-4-user@example.com> (raw)
In-Reply-To: <20191102104020.30317-1-user@example.com>
From: Eric Wong <e@80x24.org>
-Wmaybe-uninitialized (tested gcc 8.3.0) needlessly warns about
this, but it's a good simplification nevertheless.
---
Mwrap.xs | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/Mwrap.xs b/Mwrap.xs
index 8ce7b46..4d346ab 100644
--- a/Mwrap.xs
+++ b/Mwrap.xs
@@ -469,16 +469,14 @@ internal_memalign(void **pp, size_t alignment, size_t size, uintptr_t caller)
static void *
memalign_result(int err, void *p)
{
- if (caa_unlikely(err)) {
+ if (caa_unlikely(err))
errno = err;
- return 0;
- }
return p;
}
void *memalign(size_t alignment, size_t size)
{
- void *p;
+ void *p = NULL;
int err = internal_memalign(&p, alignment, size, RETURN_ADDRESS(0));
return memalign_result(err, p);
}
@@ -493,7 +491,7 @@ void cfree(void *) __attribute__((alias("free")));
void *valloc(size_t size)
{
- void *p;
+ void *p = NULL;
int err = internal_memalign(&p, page_size, size, RETURN_ADDRESS(0));
return memalign_result(err, p);
}
@@ -511,7 +509,7 @@ void *valloc(size_t size)
void *pvalloc(size_t size)
{
size_t alignment = page_size;
- void *p;
+ void *p = NULL;
int err;
if (add_overflow_p(size, alignment)) {
next prev parent reply other threads:[~2019-11-02 10:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-02 10:40 [PATCH 0/4] build system fixes Eric Wong
2019-11-02 10:40 ` [PATCH 1/4] Makefile.PL: remove CCFLAGS overrides Eric Wong
2019-11-02 10:40 ` [PATCH 2/4] workaround -DNDEBUG warnings Eric Wong
2019-11-02 10:40 ` Eric Wong [this message]
2019-11-02 10:40 ` [PATCH 4/4] avoid mixing declarations and code Eric Wong
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=20191102104020.30317-4-user@example.com \
--to=user@example.com \
--cc=e@80x24.org \
--cc=mwrap-perl@80x24.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://80x24.org/mwrap-perl.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).