[pacman-dev] [PATCH] Remove need to explicitly register the local DB

Dan McGee dpmcgee at gmail.com
Sat Jan 29 10:59:06 EST 2011

On Sat, Jan 29, 2011 at 3:09 AM, Xyne <xyne at archlinux.ca> wrote:
> Allan McRae wrote:
>> The lazy initialisation means that nothing is actually loaded when
>> registering the local database.  The local database is only read in as
>> needed and only the parts that are needed are read in.
>> In fact, all that is done registering the local database is creating a
>> pmdb_t srtuct and assigning the local database operation struct to it.
>>   That is the "little to no fallout" if you do not use the local database.
>> Allan
> Thanks for the clarification.
> Even if it is negligible, it's munging separate logic together. Given that the
> purpose is presumably to save coders a few lines of code, I still think it
> would make more sense to use a wrapper function to do that when getting the
> handle.

The "register" code could just as well be done in the handle setup
where I moved the call anyway. You'd save about 13 CPU cycles. It's
design that is meant to remove stupidity in a library where you have
to make what seems like a no-op call- but make sure you only do it
once. Why let users shoot themselves in the foot? We already handled
the teardown in alpm_release so this just makes the initialize side
map that.



More information about the pacman-dev mailing list