[pacman-dev] [PATCH] Add remove counterparts to alpm_option_add_* functions

Dan McGee dpmcgee at gmail.com
Sat Dec 22 09:14:36 EST 2007


Quick first thought here is these functions should not be void return
type, but int so they can return whether they were successful or not.
Of course, that provokes a second thought that notices that the list
remove function has a rather odd function signature.

It looks like you could pass in a data pointer (set your vdata ptr to
null first to be safe), and check after the remove call if something
is in this pointer. If there was something, you actually have to free
it (because of memory leak issues, which I just realized would
happen). Finally, return true (1) if there was data returned, and
false (0) if data was not found.

Thoughts from anyone else also welcome.

-Dan




More information about the pacman-dev mailing list