libc: Fix build on recent gcc

This fixes this warning (which escalates as an error):

roms/openbios/libc/string.c: In function ‘strdup’:
roms/openbios/libc/string.c:353:4: error: nonnull argument ‘str’ compared to NULL [-Werror=nonnull-compare]
  if( !str )
    ^
cc1: all warnings being treated as errors
rules.mak:122: recipe for target 'target/libc		printf("stdout is %s\n", stdout->name);

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
This commit is contained in:
Benjamin Herrenschmidt
2016-08-02 15:35:27 +10:00
committed by Mark Cave-Ayland
parent d0473cefc5
commit 14be7d187a

View File

@ -349,10 +349,7 @@ int memcmp(const void * cs,const void * ct,size_t count)
char *
strdup( const char *str )
{
char *p;
if( !str )
return NULL;
p = malloc( strlen(str) + 1 );
char *p = malloc( strlen(str) + 1 );
strcpy( p, str );
return p;
}