Re: another emi2 bugfix
Harrie Hazewinkel <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <2224947.1028636466@localhost> |
--On Tuesday, August 6, 2002 1:14 PM +0300 Oded Arbel <[email protected]> wrote: > On Tuesday 06 August 2002 12:38 pm, Harrie Hazewinkel wrote: > >> The patch below would combine a free(ptr) and a ptr=NULL >> into a single gw_free(ptr) statement. The extra vaiable is needed >> in case the variable is returned from a function. >> This should be wise to include too, I guess. > <snip> >> +#define gw_free(ptr) {void *p=ptr;gw_native_free(p);p=NULL;} > > don't you mean : ># define gw_free(ptr) {void *p=ptr;gw_native_free(p);ptr=NULL;} > as p is freed from the stack anyway at the end of the macro block. the > same to the other change. NO, since 'ptr' can be directly returned from a function and that cannot be made NULL. However, I realise now also that this would not do the trick. It makes the new variable NULL, but not the pointer I wanted. Better drop it for now, and add explicits NULL assignments each time when needed. Harrie Internet Management Consulting mailto:[email protected] http ://www.mod-snmp.com/ ------------------------------------------------------------------- Author of MOD-SNMP, enabling SNMP management to the Apache server.