[pacman-dev] [PATCH] Separate file parsing from backend

Xavier shiningxc at gmail.com
Wed Sep 23 11:03:22 EDT 2009


On Wed, Sep 23, 2009 at 2:46 PM, Henning Garus
<henning.garus at googlemail.com> wrote:
> Split the huge list of else ifs which was used for parsing  'desc',
> 'depends', 'files' and 'deltas' files, into separate functions and move
> them to a new file parse.c . This makes it possible for other backends
> to share the same parse code. Also change the parsing from the giant
> else if list to a single loop calling different functions as specified
> in an array of parser structs (see  parse_lines() for details).
>
> Move _alpm_delta_parse to parse.c and make it static.
>
> Signed-off-by: Henning Garus <henning.garus at gmail.com>
> ---
>
> I actually managed to make it longer, instead of shorter (well if you
> take out comments and license headers this version is roughly as long
> as the old one), however I think it is more readable. Feel free to call
> it overkill though.
>
> I don't really like the ugets stuff I used to get the next line, but I
> wanted this to work on something other than FILE*, even though this is
> not used (yet), and this was the best thing I could come up with. I
> toyed around with using fopencookie, but that sucks when it comes to
> portability (there is funopen on bsd, beyond that you are simply
> screwed).
>

Well, after a quick look, I would say it looks cool.
This work was still motivated by tar database backend, right ?
(http://bugs.archlinux.org/task/8586)
How far do you think you are from it ? :)

Anyway, I would like to hear what Dan thinks, with all the backend
work he did last year which was never finished :
http://code.toofishes.net/cgit/dan/pacman.git/log/?h=backend

Anyway, your work is on a lower level, and dan's work was on a higher
level, so the two don't seem incompatible at first look.


More information about the pacman-dev mailing list