[PATCH:xdpyinfo 2/2] Sprinkle consts in StrCmp to quiet cast warnings

Alan Coopersmith alan.coopersmith at oracle.com
Tue Nov 26 22:36:28 PST 2013


Makes gcc stop saying:
xdpyinfo.c: In function ‘StrCmp’:
xdpyinfo.c:162:20: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]
xdpyinfo.c:162:39: warning: cast discards ‘__attribute__((const))’ qualifier from pointer target type [-Wcast-qual]

Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 xdpyinfo.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xdpyinfo.c b/xdpyinfo.c
index 84d5b2a..2b94394 100644
--- a/xdpyinfo.c
+++ b/xdpyinfo.c
@@ -159,7 +159,7 @@ static int print_event_mask(char *buf, int lastcol, int indent, long mask);
 
 static int StrCmp(const void *a, const  void *b)
 {
-    return strcmp(*(char **)a, *(char **)b);
+    return strcmp(*(const char * const *)a, *(const char * const *)b);
 }
 
 static void
-- 
1.7.9.2



More information about the xorg-devel mailing list