From: Ian Jackson Subject: Re: [PATCH v4 2/2] xl: Add commands for usb hot-plug Date: Wed, 17 Apr 2013 12:48:41 +0100 Message-ID: <20846.35865.707966.138906@mariner.uk.xensource.com> References: <1365706317-5368-1-git-send-email-george.dunlap@eu.citrix.com> <1365706317-5368-2-git-send-email-george.dunlap@eu.citrix.com> <516E7330.2070101@citrix.com> <1366193719.8399.229.camel@zakaz.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: <1366193719.8399.229.camel@zakaz.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Campbell Cc: George Dunlap , "sstanisi@cbnco.com" , "xen-devel@lists.xen.org" , Roger Pau Monne List-Id: xen-devel@lists.xenproject.org Ian Campbell writes ("Re: [Xen-devel] [PATCH v4 2/2] xl: Add commands for u= sb hot-plug"): > On Wed, 2013-04-17 at 11:02 +0100, Roger Pau Monn=E9 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 * 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.