[PATCH:xhost 2/2] Declare some char * as const to fix gcc -Wwrite-strings warnings

Alan Coopersmith alan.coopersmith at oracle.com
Sat Sep 24 10:31:27 PDT 2011


Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 xhost.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/xhost.c b/xhost.c
index 6495d9b..cf05d59 100644
--- a/xhost.c
+++ b/xhost.c
@@ -143,7 +143,7 @@ extern int getdomainname(char *name, size_t len);
 #endif
 
 static int change_host(Display *dpy, char *name, Bool add);
-static char *get_hostname(XHostAddress *ha);
+static const char *get_hostname(XHostAddress *ha);
 static int local_xerror(Display *dpy, XErrorEvent *rep);
 
 #ifdef RETSIGTYPE /* autoconf AC_TYPE_SIGNAL */
@@ -200,7 +200,7 @@ main(int argc, char *argv[])
 {
     register char *arg;
     int i, nhosts = 0;
-    char *hostname;
+    const char *hostname;
     int nfailed = 0;
     XHostAddress *list;
     Bool enabled = False;
@@ -355,8 +355,8 @@ change_host(Display *dpy, char *name, Bool add)
     struct nodeent *np;
     static struct dn_naddr dnaddr;
 #endif				/* DNETCONN */
-    static char *add_msg = "being added to access control list";
-    static char *remove_msg = "being removed from access control list";
+    static const char *add_msg = "being added to access control list";
+    static const char *remove_msg = "being removed from access control list";
 
     namelen = strlen(name);
     if ((lname = (char *)malloc(namelen+1)) == NULL) {
@@ -733,7 +733,7 @@ change_host(Display *dpy, char *name, Bool add)
 jmp_buf env;
 #endif
 
-static char *
+static const char *
 get_hostname(XHostAddress *ha)
 {
 #if (defined(TCPCONN) || defined(STREAMSCONN)) &&	\
-- 
1.7.3.2



More information about the xorg-devel mailing list