On Fri, Jun 15, 2007, Jeff Johnson wrote: > On Jun 15, 2007, at 12:09 PM, Ralf S. Engelschall wrote: > >> Ok, thanks for the hint. > > You've likely seen > foo = xmalloc(...) > ... > foo = _free(foo) > habits of mine. Feel free to suggest better. _free seemed > like a good idea at the time, but I've never really found > the right place to add the static inline in rpm's API. > [...]
Yes, I've seen that _free is spreaded in the sources in a rather redundant way. What about the following in system.h and then replace all "foo = _free(foo);" with just "xfree(foo)"? #define xfree(p) \ do { \ if ((p) != NULL) { \ free((void *)(p)); \ (p) = NULL; \ } \ } while (0) This way the free is not even inside a sub-function (helps in debugging) and you don't have to add a _free function to such a lot of source files. But perhaps I'm just overlooking something here... Ralf S. Engelschall [EMAIL PROTECTED] www.engelschall.com ______________________________________________________________________ RPM Package Manager http://rpm5.org Developer Communication List rpm-devel@rpm5.org