diff options
author | René Scharfe <l.s.r@web.de> | 2016-08-04 23:56:54 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-08-05 15:37:47 -0700 |
commit | c6c9e1885c9025f2e4074105e4fbe9b008e5d1a3 (patch) | |
tree | afe898cd44dc5e2f6379f824871813050dbc8d5b /fmt-merge-msg.h | |
parent | nedmalloc: fix misleading indentation (diff) | |
download | tgif-c6c9e1885c9025f2e4074105e4fbe9b008e5d1a3.tar.xz |
nedmalloc: work around overzealous GCC 6 warning
With GCC 6, the strdup() function is declared with the "nonnull"
attribute, stating that it is not allowed to pass a NULL value as
parameter.
In nedmalloc()'s reimplementation of strdup(), Postel's Law is heeded
and NULL parameters are handled gracefully. GCC 6 complains about that
now because it thinks that NULL cannot be passed to strdup() anyway.
Because the callers in this project of strdup() must be prepared to
call any implementation of strdup() supplied by the platform, so it
is pointless to pretend that it is OK to call it with NULL.
Remove the conditional based on NULL-ness of the input; this
squelches the warning. Check the return value of malloc() instead
to make sure we actually got the memory to write to.
See https://gcc.gnu.org/gcc-6/porting_to.html for details.
Diagnosed-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'fmt-merge-msg.h')
0 files changed, 0 insertions, 0 deletions