Hi Andreas,
with your macro you will change nothing. Just example:
a = gw_malloc(10)
some_func(a)
/* but here a points to some plase in memory but is not NULL */
void some_func(void *a)
{
do something with a;
gw_malloc(a);
/* ok a here is NULL */
}
Am 22.01.2007, 12:42 Uhr, schrieb Andreas Fink <[EMAIL PROTECTED]>:
I would suggest the use of a macro of the following style instead:
#define gw_free(ptr) { if(ptr) gw_native_free(ptr);ptr=NULL; }
On 22.01.2007, at 12:22, Paul Keogh wrote:
IMHO, this feels bad.
If the programmatic logic is correct, then the freed memory cannot
be accessed
after it is free.
-----Original Message-----
From: Alexander Malysh [mailto:[EMAIL PROTECTED]
Sent: Mon 22/01/2007 11:12
To: [email protected]
Subject: Last bogus commit from Stipe
Hi Stipe,
your last commit:
Index: gateway/gwlib/gwmem-native.c
diff -u gateway/gwlib/gwmem-native.c:1.10 gateway/gwlib/gwmem-
native.c:1.11
--- gateway/gwlib/gwmem-native.c:1.10 Sun Jan 7 23:52:56 2007
+++ gateway/gwlib/gwmem-native.c Mon Jan 22 02:22:25 2007
@@ -108,6 +108,7 @@
void gw_native_free(void *ptr)
{
free(ptr);
+ ptr = NULL;
}
is bogus and unneeded because you just set ptr to NULL but not
pointer af
caller. So this commit does nothing to prevent situation you
described and
should be reverted.
--
Thanks,
Alex
Andreas Fink
Fink Consulting GmbH
Global Networks Schweiz AG
BebbiCell AG
---------------------------------------------------------------
Tel: +41-61-6666330 Fax: +41-61-6666331 Mobile: +41-79-2457333
Address: Clarastrasse 3, 4058 Basel, Switzerland
E-Mail: [EMAIL PROTECTED]
www.finkconsulting.com www.global-networks.ch www.bebbicell.ch
---------------------------------------------------------------
ICQ: 8239353 MSN: [EMAIL PROTECTED] AIM: smsrelay Skype: andreasfink
Yahoo: finkconsulting SMS: +41792457333
--
Thanks,
Alex