[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [PATCH 1/7] Split some useful functions from help.c to (new) util.c


Once again, everything prefixed with IIRC and it may no longer
be the case.

On Fri, May 06, 2011 at 02:49:30AM -0500, Jonathan Nieder wrote:
> debug is now part of libdpkg so I left that one out.
> help.c describes itself as "help.c - various helper routines", which
> doesn't seem so far from util.c.  Do I understand correctly that the
> main purpose is to make ensure_pathname_nonexisting et al usable as
> a separate translation unit that doesn't depend on too much else?

Basically, it's a pain to try and use anythign from help.c because of
the numerous intertwined static/global/extern variables involved.
for example if you wanted to link against it in a unit test i think
there were a couple dozen local static variables and possibly other
functions you'd have to define, even if you weren't going to use them,
because they are otherwise defined in the dpkg binary's main code and
you'd get linker errors without them.

I think this was largely because the code in help.c is fairly "legacy"
and was written long before someone came up with the idea of libdpkg,
unit testing, etc.

So I think the "util.c" name was suggested by Guillem as a "help.c-like"
filename, where something could be put until it was decided to either move
it into libdpkg or move more help.c code over to it.



Reply to: