I'm curious, I'm programming in C on PuTTy, does anyone know how I can get rid of this warning?
warning: ignoring return value of ‘realloc’, declared with attribute warn_unused_result [-Wunused-result] realloc(strp->data, nbytes);
^
Relevant code to the line it wants to 'warn' me about:
//If the previously allocated size is > 0 then we can reallocate
//otherwise we have to make a new allocation in memory
if(strp->length > 0)
{
realloc(strp->data, nbytes);
}
else
{
*strp = kstralloc(nbytes);
}
Thanks in advance
The correct way to call realloc is something like this: