Remove pointless NULL test and unreachable return

There is no point testing ptr for NULL - we dereference it anyway, this function can't be called with a
NULL pointer for the first argument.
This commit is contained in:
Kevin Easton
2017-02-17 21:55:11 +11:00
parent a0e8bd5742
commit e5b2a65fe2

View File

@@ -174,7 +174,7 @@ char * n_malloc_strcpy (char **ptr, const char *src, const char *module, const c
{ {
if (!src) if (!src)
return *ptr = n_free(*ptr, module, file, line); return *ptr = n_free(*ptr, module, file, line);
if (ptr && *ptr) if (*ptr)
{ {
if (*ptr == src) if (*ptr == src)
return *ptr; return *ptr;
@@ -183,8 +183,8 @@ char * n_malloc_strcpy (char **ptr, const char *src, const char *module, const c
*ptr = n_free(*ptr, module, file, line); *ptr = n_free(*ptr, module, file, line);
} }
*ptr = n_malloc(strlen(src) + 1, module, file, line); *ptr = n_malloc(strlen(src) + 1, module, file, line);
return strcpy(*ptr, src); return strcpy(*ptr, src);
return *ptr;
} }
/* malloc_strcat: Yeah, right */ /* malloc_strcat: Yeah, right */