aboutsummaryrefslogtreecommitdiffstats
path: root/lib/strutils.c
diff options
context:
space:
mode:
authorRuediger Meier <ruediger.meier@ga-group.nl>2016-02-26 11:10:24 +0100
committerRuediger Meier <ruediger.meier@ga-group.nl>2016-03-07 23:29:27 +0100
commitfea1cbf7484df23a6fe0b62ccd1de271bc1f931a (patch)
tree047a4504053a7b449bce7695346a3f7edf78a068 /lib/strutils.c
parentd9851e63fba82cbda2238f26f20bf59b3d962577 (diff)
downloadutil-linux-fea1cbf7484df23a6fe0b62ccd1de271bc1f931a.tar.gz
misc: never cast void* from malloc(3) and friends
Such cast could hide serious compiler warnings in case we are missing includes (e.g. <stdlib.h> or "xalloc.h"). See http://stackoverflow.com/questions/605845/do-i-cast-the-result-of-malloc Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Diffstat (limited to 'lib/strutils.c')
-rw-r--r--lib/strutils.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/strutils.c b/lib/strutils.c
index 64a6b992ef..2d7cb59eda 100644
--- a/lib/strutils.c
+++ b/lib/strutils.c
@@ -247,7 +247,7 @@ char *strnchr(const char *s, size_t maxlen, int c)
char *strndup(const char *s, size_t n)
{
size_t len = strnlen(s, n);
- char *new = (char *) malloc((len + 1) * sizeof(char));
+ char *new = malloc((len + 1) * sizeof(char));
if (!new)
return NULL;
new[len] = '\0';