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

[libvirt] [PATCH] avoid one more ctype vs. sign-extension problem



This change demonstrates that the new syntax-check rule's
regexp can be improved.  It missed the unsafe tolower use,
since there was already a to_uchar use on that line.

>From 5fc8de9825215e28773f2230ac6c1e1b3d724602 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering redhat com>
Date: Thu, 8 May 2008 16:11:55 +0200
Subject: [PATCH] avoid one more ctype vs. sign-extension problem

* src/util.c (TOLOWER): Also convert tolower argument.
---
 src/util.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/util.c b/src/util.c
index 8f3cef9..4cef6d2 100644
--- a/src/util.c
+++ b/src/util.c
@@ -57,7 +57,8 @@

 #define MAX_ERROR_LEN   1024

-#define TOLOWER(Ch) (isupper (to_uchar(Ch)) ? tolower (Ch) : (Ch))
+#define TOLOWER(Ch) (isupper (to_uchar(Ch)) \
+		     ? tolower (to_uchar (Ch)) : (to_uchar (Ch)))

 #define virLog(msg...) fprintf(stderr, msg)

--
1.5.5.1.148.g4c99ee


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