aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Groffen <grobian@gentoo.org>2018-04-05 19:02:56 +0200
committerFabian Groffen <grobian@gentoo.org>2018-04-05 19:02:56 +0200
commit6d6a52d90e5a16f86947fd163aac23d3b7b66f32 (patch)
tree3520498a466106607954abd24649b6c03d1a670a
parentatom_explode: get version letters comparing properly again (diff)
downloadportage-utils-6d6a52d90e5a16f86947fd163aac23d3b7b66f32.tar.gz
portage-utils-6d6a52d90e5a16f86947fd163aac23d3b7b66f32.tar.bz2
portage-utils-6d6a52d90e5a16f86947fd163aac23d3b7b66f32.zip
xstrdup: avoid warning about clobbering t
When using optimisation, the compiler does something to a char pointer it doesn't do to a void pointer, so use a couple of casts to avoid a clobber warning.
-rw-r--r--libq/xstrdup.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libq/xstrdup.c b/libq/xstrdup.c
index 6924d21..e069c9d 100644
--- a/libq/xstrdup.c
+++ b/libq/xstrdup.c
@@ -29,16 +29,16 @@
static char *xstrdup(const char *s)
{
- char *t;
+ void *t;
if (s == NULL)
return NULL;
- t = strdup(s);
+ t = (void *)strdup(s);
if (unlikely(t == NULL))
err("Out of memory");
- return t;
+ return (char *)t;
}
static char *xstrdup_len(const char *s, size_t *len)