[pacman-dev] Huge cleanup of add.c and my attempt at fixing FS#7484

Dan McGee dpmcgee at gmail.com
Sat Jul 14 14:54:50 EDT 2007


Ok, I've been slaving away at this for a while and libalpm/add.c is
finally getting a bit more manageable. Showing a patch is worthless
because it is huge and is much harder to follow due to the refactoring
stuff. Instead I've attached a drop-in add.c that compiles cleanly
with no other changes needed. I'm looking for some feedback on this.

Some highlights:
1. All pactests still pass, so no regressions on that front.
2. *Much* cleaner layout. add_commit has now been split across four
functions (upgrade_remove, extract_single_file, commit_single_pkg, and
 _alpm_add_commit).
3. No more super functions. The heaviest function
(extract_single_file) now weighs in at 350 lines, and a lot of that is
comments.
4. Most of what Andrew started to do in his 7484 patch has been
brought into this. However, I rewrote it a bit for clarity (at least I
thought so). We may need a bit more meat added to this section.

Comments/concerns/questions appreciated. I still want to cleanup the
huge if(needbackup) section a bit, that is still quite long but hard
to refactor.

-Dan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: add.c.gz
Type: application/x-gzip
Size: 8877 bytes
Desc: not available
URL: <http://archlinux.org/pipermail/pacman-dev/attachments/20070714/3acf7f18/attachment.bin>


More information about the pacman-dev mailing list