[pacman-dev] Long functions and other minor fixes
This is my massacre of _alpm_load_pkg in package.c (just joking about the massacre). I moved the extremely large for loop into its own function (and made it a while loop). Feel free to change the name of _alpm_pkg_checker (first thing that came to mind). The patches for package.c and package.h are below. ~ Jamie / yankees26
On Fri, Dec 29, 2006 at 03:59:10PM -0500, James Rosten <seinfeld90@gmail.com> wrote:
-pmpkg_t *_alpm_pkg_load(char *pkgfile) +/* function for _alpm_pkg_load */ +int _alpm_pkg_checker(archive *archive, archive_entry *entry, pmpkg_t *info, char *pkgfile)
why don't you just call it pkg_checker and make it static? udv / greetings, VMiklos -- Developer of Frugalware Linux, to make things frugal - http://frugalware.org
I didn't think about that. That is probably the smarter choice. I'm sort of new the libalpm programming, so I haven't gotten the style down yet. ~ Jamie / yankees26 * VMiklos <vmiklos@frugalware.org> [061229 22:12]:
On Fri, Dec 29, 2006 at 03:59:10PM -0500, James Rosten <seinfeld90@gmail.com> wrote:
-pmpkg_t *_alpm_pkg_load(char *pkgfile) +/* function for _alpm_pkg_load */ +int _alpm_pkg_checker(archive *archive, archive_entry *entry, pmpkg_t *info, char *pkgfile)
why don't you just call it pkg_checker and make it static?
udv / greetings, VMiklos
I didn't think about that. That is probably the smarter choice. I'm sort of new the libalpm programming, so I haven't gotten the style down yet. ~ Jamie / yankees26
On 12/29/06, James Rosten <seinfeld90@gmail.com> wrote:
~ Jamie / yankees26 * VMiklos <vmiklos@frugalware.org> [061229 22:12]:
why don't you just call it pkg_checker and make it static?
I didn't think about that. That is probably the smarter choice. I'm sort of new the libalpm programming, so I haven't gotten the style down yet.
Yeah. I'm not 100% sure of the rationale in the design doc, but according to that writeup, "private" functions should be named _alpm_* and "public" functions should be named alpm_*. _However_, if a function is entirely internal, as this one is, it should, at the very least, be marked static (FTR this prevents gcc from adding an entry to the symbol table of the object, which speeds loading ever so slightly and gives us a cleaner interface in the long run). Additionally, I see no reason to prefer either _alpm_* for purely internal functions, unless, of course, you expect a name collision in the future.
* Aaron Griffin <aaronmgriffin@gmail.com> [070102 11:31]:
Yeah. I'm not 100% sure of the rationale in the design doc, but according to that writeup, "private" functions should be named _alpm_* and "public" functions should be named alpm_*. _However_, if a function is entirely internal, as this one is, it should, at the very least, be marked static (FTR this prevents gcc from adding an entry to the symbol table of the object, which speeds loading ever so slightly and gives us a cleaner interface in the long run). Additionally, I see no reason to prefer either _alpm_* for purely internal functions, unless, of course, you expect a name collision in the future.
I'll keep this in mind next time I open up alpm stuff. ~ Jamie / yankees26
participants (3)
-
Aaron Griffin
-
James Rosten
-
VMiklos