[pacman-dev] [PATCH 1/5] Two memleak fixes in pacman.

Miklos Vajna vmiklos at frugalware.org
Wed Nov 21 17:09:31 EST 2007

On Mon, Nov 19, 2007 at 10:45:53PM -0500, "K. Piche" <kpiche at rogers.com> wrote:
> > And that is my point. We don't have a clear definition of what needs
> > freeing and what does not. The name "alpm_db_whatprovides" doesn't
> > indicate at all that its result needs to be freed, and yet something
> > like "alpm_fetch_pkgurl" doesn't need freeing (or does it? I don't
> > know and that seems problematic).
> > 
> > So yes, it comes down to documentation and good function naming, which
> > we lack. :)
> You could have a simple convention like GTK/GNOME stuff does: any
> function arguments or returns that are "const" should not be freed by
> the user (or front end in this case).  See "Cleanliness" in
> http://developer.gnome.org/doc/guides/programming-guidelines/code-style.html

or just use __attribute__ ((__warn_unused_result__)) on those functions.
obviously those functions' return value must be free'd.

- VMiklos
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://archlinux.org/pipermail/pacman-dev/attachments/20071121/3cc13358/attachment.pgp>

More information about the pacman-dev mailing list