From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/482 Path: news.gmane.org!not-for-mail From: Szabolcs Nagy Newsgroups: gmane.linux.lib.musl.general Subject: Re: minor fixes Date: Mon, 26 Sep 2011 19:07:34 +0200 Message-ID: <20110926170734.GC24939@port70.net> References: <20110925134725.GA24939@port70.net> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="i0/AhcQY5QxfSsSZ" X-Trace: dough.gmane.org 1317056871 22042 80.91.229.12 (26 Sep 2011 17:07:51 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 26 Sep 2011 17:07:51 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-483-gllmg-musl=m.gmane.org@lists.openwall.com Mon Sep 26 19:07:47 2011 Return-path: Envelope-to: gllmg-musl@lo.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by lo.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1R8Eeh-0000Hr-Eq for gllmg-musl@lo.gmane.org; Mon, 26 Sep 2011 19:07:47 +0200 Original-Received: (qmail 3116 invoked by uid 550); 26 Sep 2011 17:07:46 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 3107 invoked from network); 26 Sep 2011 17:07:46 -0000 Content-Disposition: inline In-Reply-To: <20110925134725.GA24939@port70.net> User-Agent: Mutt/1.5.20 (2009-06-14) Xref: news.gmane.org gmane.linux.lib.musl.general:482 Archived-At: --i0/AhcQY5QxfSsSZ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline a pedantic ctype macro fix: move the unsigned cast inside i can think of one case where it matters: if EOF was defined as INT_MIN then (unsigned)(a - 'c') can overflow while ((unsigned)a - 'c') is ok (i know this is pathological and EOF is actually defined as -1) --i0/AhcQY5QxfSsSZ Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="ctype_cast.diff" diff --git a/include/ctype.h b/include/ctype.h index 97b9737..a605d08 100644 --- a/include/ctype.h +++ b/include/ctype.h @@ -16,12 +16,12 @@ int isxdigit(int); int tolower(int); int toupper(int); -#define isalpha(a) ((unsigned)(((a)|32)-'a') < 26) -#define isdigit(a) ((unsigned)((a)-'0') < 10) -#define islower(a) ((unsigned)((a)-'a') < 26) -#define isupper(a) ((unsigned)((a)-'A') < 26) -#define isprint(a) ((unsigned)((a)-0x20) < 0x5f) -#define isgraph(a) ((unsigned)((a)-0x21) < 0x5e) +#define isalpha(a) ((((unsigned)(a)|32)-'a') < 26) +#define isdigit(a) (((unsigned)(a)-'0') < 10) +#define islower(a) (((unsigned)(a)-'a') < 26) +#define isupper(a) (((unsigned)(a)-'A') < 26) +#define isprint(a) (((unsigned)(a)-0x20) < 0x5f) +#define isgraph(a) (((unsigned)(a)-0x21) < 0x5e) --i0/AhcQY5QxfSsSZ--