[pacman-dev] [PATCH] Removing strndup and a small typo fix

Dan McGee dpmcgee at gmail.com
Wed Sep 2 00:05:37 EDT 2009


On Tue, Sep 1, 2009 at 8:49 PM, Allan McRae<allan at archlinux.org> wrote:
> Laszlo Papp wrote:
>>
>> Code cleaning, removing strndup, because it's available with glibc in
>> the same manner, and a small typo fix.
>>
>> Signed-off-by: Laszlo Papp <djszapi2 at gmail.com>
>> ---
>> <snip>
>>  -#ifndef HAVE_STRNDUP
>> -char *strndup(const char *s, size_t n);
>> -#endif
>> -
>>  #endif /* _PM_UTIL_H */
>>
>
> I believe that strndup is a GNU library extension so is not universally
> supported.  Hence the #ifndef here.  Has this changed since the original
> commit (581769b7)?

You are correct; glibc has this but other OSes (e.g. BSD, cygwin,
darwin) may lack the srtnlen and strndup functions so we provide an
alternative. No reason to remove them.

The comment change in the other file also appears to be unrelated to
this commit. By the way, don't take these as discouraging remarks
towards submitting patches, as we do appreciate them- we just have a
review process as well that doesn't accept everything we receive at
face value.

The commit Allan referenced was most likely added to get pacman to
compile on cygwin as an FYI, since I had a Windows machine for my work
use at the time.

-Dan


More information about the pacman-dev mailing list