Alexander Malysh wrote:
no it just doesn't work as made Stipe and as you suggested. IIt just
was typo in my example.
Just compile this code sniplet and you will see that your and Stipe
changes are pointless:
---- snip -----
static void my_func(void *a)
{
printf("a=%p", a);
gw_free(a);
printf("a=%p", a);
}
int main(int argc, char **argv)
{
void *a = gw_malloc(10);
my_func(a);
if (a == NULL)
printf("Andreas is right :)");
else
printf("Alex is right...");
exit(0);
}
---- snip -----
P.S. I reverted Stipe's change...
yep, +1 on Alex's revert... my appologies.
Of course the passed pointer to the callstack is only a "carbon-copy", so we set
it to NULL in the scope of that current stack, but have again the "orginal
pointer" when we return from subsequent stack call and hence this way there is
no chance to set the "orginal pointer" to NULL.
Even the macro Andreas suggested doesn't help. Since we would need to take care
to pass the orginal pointer all the way to the callstack. Which seems not that
easy, or even not possible at all.
Stipe
-------------------------------------------------------------------
Kölner Landstrasse 419
40589 Düsseldorf, NRW, Germany
tolj.org system architecture Kannel Software Foundation (KSF)
http://www.tolj.org/ http://www.kannel.org/
mailto:st_{at}_tolj.org mailto:stolj_{at}_kannel.org
-------------------------------------------------------------------