On Sat, 25 Feb 2017, Prathamesh Kulkarni wrote:

Hi,
The attached patch deletes calls to strdup, strndup if it's
return-value is unused,
and same for realloc if the first arg is NULL.
Bootstrap+tested on x86_64-unknown-linux-gnu.
OK for GCC 8 ?

Instead of specializing realloc(0,*) wherever we can perform the same optimization as with malloc, wouldn't it be better to optimize:
realloc(0,n) -> malloc(n)
and let the malloc optimizations happen?

(realloc(p,0)->free(p) is more tricky because of the return value, like malloc(0))

--
Marc Glisse

Reply via email to