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

Jim Meyering jim at meyering.net
Thu May 8 14:44:38 UTC 2008


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 at 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




More information about the libvir-list mailing list