bug-gnulib
[Top][All Lists]
Advanced

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

Re: bugs in dirname module


From: Bruno Haible
Subject: Re: bugs in dirname module
Date: Wed, 9 Nov 2005 11:04:59 +0100
User-agent: KMail/1.5

Eric Blake wrote:
> > Why not use this instead?
> >
> > #define c_isalpha(c) (((unsigned int) (c) | ('a' - 'A')) - 'a' <= 'z' -
> > 'a')
>
> This is a slick definition, but it is different than what c-ctype.h
> provided, and that definition was not guarded.  Bruno, would you accept
> the following patch to c-ctype, so that the order between "c-ctype.h" and
> my patched "dirname.h" won't matter?
>       (c_isalpha) [C_CTYPE_ASCII]: Guard against redefinition.

No, I don't think that would be good: It's not dirname.h's job to define
macros for testing character properties. dirname.h should only export
things related to filenames and pathnames. Any other macro in it should
be made private, i.e. renamed to something like _DIRNAME_ISALPHA or so,
so that it is clear that it is not meant to be used for other purposes.

> An alternative to editing c-ctype is naming the dirname.h version
> IS_DRIVE_LETTER instead of c_isalpha.

Yes, this is much better. Also it reflects more closely what the macro is
used for.

Bruno





reply via email to

[Prev in Thread] Current Thread [Next in Thread]