|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v4 2/2] xl: Add commands for usb hot-plug
Ian Campbell writes ("Re: [Xen-devel] [PATCH v4 2/2] xl: Add commands for usb
hot-plug"):
> On Wed, 2013-04-17 at 11:02 +0100, Roger Pau Monné wrote:
> > This are kind of general macros, that could be used elsewhere, might be
> > suitable to put them outside of this function and name them CHAR_IS_DEC
> > and CHAR_IS_HEX.
>
> ctype.h already provides isdigit() and isxdigit(), no need for our own.
> IMHO.
These functions' behaviour depends on the locale. That may or may not
be desirable.
If you do use isdigit, be sure to invoke it via the CTYPE macro in
libxl_internal.h:
/*
* int CTYPE(ISFOO, char c);
* int CTYPE(toupper, char c);
* int CTYPE(tolower, char c);
*
* This is necessary because passing a simple char to a ctype.h
* is forbidden. ctype.h macros take ints derived from _unsigned_ chars.
*
* If you have a char which might be EOF then you should already have
* it in an int representing an unsigned char, and you can use the
* <ctype.h> macros directly. This generally happens only with values
* from fgetc et al.
*
* For any value known to be a character (eg, anything that came from
* a char[]), use CTYPE.
*/
#define CTYPE(isfoo,c) (isfoo((unsigned char)(c)))
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |