[pacman-dev] Various code-cleanups

Dan McGee dpmcgee at gmail.com
Thu Jan 18 14:16:23 EST 2007


On 1/18/07, Aaron Griffin <aaronmgriffin at gmail.com> wrote:
> On 1/17/07, Dan McGee <dpmcgee at gmail.com> wrote:
> Merged, with the following changes / comments:
>
> > -       memset(line, 513, 0);
> > +       memset(line, 0, 513);
> This made me laugh. Feel free to stab me for that one.
I knew you added it but refrained from harassing comments. :)

> > -return _("valid regular expression");
> > +return _("invalid regular expression");
> Funniest typo ever.
That was actually a downstream Frugalware patch, can't say I noticed
it until I saw it there.

> > +/* static function declarations */
> I left this out for now.  While it may turn out messy, I'm not a huge
> fan of declarations like this for all internal functions, only when it
> actually requires a forward-decl.  Still, it's purely cosmetic, so I
> can add it back in if you want.
I just did it for consistency; that way you never have to worry about
it being forward/backward. The other proposal would be to say static
functions should _always_ go first in a file. That would remove the
need for declarations. I just feel like consistency is important.

> > -                          -ldownload -larchive -lm -lalpm -lssl -lcrypto
> > +                          -ldownload -lm -lalpm
> Odd.  This may be a build error on my part, but libdownload should
> require libssl/libcrypto for https support.
Self-explanatory:
$ ldd /usr/lib/libdownload.so
        linux-gate.so.1 =>  (0xffffe000)
        libc.so.6 => /lib/libc.so.6 (0xb7de9000)
        /lib/ld-linux.so.2 (0x80000000)

> > +               unsigned int i;
> >                 unsigned int cols = getcols();
> > -               for(int i=len; i < cols; ++i) {
> > +               for(i=len; i < cols; ++i) {
>
> Just FTR: pacman3 should be C99 compliant, so declaring the index
> variable outside the for loop shouldn't be required, though again,
> it's purely cosmetics at this point 8).
Splint didn't like it, it died at it so it was easy enough to fix. I
figured it could be fixed in the codebase too since I'm sure gcc ends
up doing exactly the same thing with it anyway.

-Dan




More information about the pacman-dev mailing list