]> xenbits.xensource.com Git - people/royger/xen.git/commitdiff
include/ctype.h: fix MISRA R10.2 violation
authorStefano Stabellini <sstabellini@kernel.org>
Wed, 15 May 2024 22:52:04 +0000 (15:52 -0700)
committerStefano Stabellini <stefano.stabellini@amd.com>
Fri, 17 May 2024 01:03:27 +0000 (18:03 -0700)
The value returned by __toupper is used in arithmetic operations causing
MISRA C 10.2 violations. Cast to plain char in the toupper macro. Also
do the same in tolower for consistency.

Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/include/xen/ctype.h

index 6dec944a370b23d983c285002c652741dd698b53..773ac27aa44ac65e76e87cdec960450804310249 100644 (file)
@@ -48,7 +48,7 @@ static inline unsigned char __toupper(unsigned char c)
        return c;
 }
 
-#define tolower(c) __tolower(c)
-#define toupper(c) __toupper(c)
+#define tolower(c) ((char)__tolower(c))
+#define toupper(c) ((char)__toupper(c))
 
 #endif