[PATCH:xscope 14/14] Add const attributes to clear gcc -Wwrite-strings warnings
Alan Coopersmith
alan.coopersmith at oracle.com
Sat Sep 24 08:48:32 PDT 2011
Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
common.c | 6 +++---
print_render.c | 4 ++--
proto.h | 8 ++++----
prtype.c | 2 +-
scope.c | 10 +++++-----
5 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/common.c b/common.c
index 3779b13..a0d240b 100644
--- a/common.c
+++ b/common.c
@@ -58,19 +58,19 @@
/* ********************************************** */
void
-enterprocedure (char *s)
+enterprocedure (const char *s)
{
debug(2,(stderr, "-> %s\n", s));
}
void
-warn (char *s)
+warn (const char *s)
{
fprintf(stderr, "####### %s\n", s);
}
void
-panic (char *s)
+panic (const char *s)
{
fprintf(stderr, "%s\n", s);
exit(1);
diff --git a/print_render.c b/print_render.c
index f4dbee0..b6053e8 100644
--- a/print_render.c
+++ b/print_render.c
@@ -390,7 +390,7 @@ RenderFreeGlyphSet (FD fd, const unsigned char *buf)
}
static void
-PrintGlyphs(const unsigned char *buf, int n, char *name)
+PrintGlyphs(const unsigned char *buf, int n, const char *name)
{
const unsigned char *gids;
const unsigned char *glyphs;
@@ -452,7 +452,7 @@ RenderFreeGlyphs (FD fd, const unsigned char *buf)
}
static void
-PrintGlyphList(const unsigned char *buf, int length, char *name, int size)
+PrintGlyphList(const unsigned char *buf, int length, const char *name, int size)
{
short n;
diff --git a/proto.h b/proto.h
index 7963e86..3c338c7 100644
--- a/proto.h
+++ b/proto.h
@@ -1,9 +1,9 @@
#include "x11.h"
/* common.c */
-extern void enterprocedure (char *s);
-extern void warn (char *s);
-extern void panic (char *s);
+extern void enterprocedure (const char *s);
+extern void warn (const char *s);
+extern void panic (const char *s);
extern void SetSignalHandling (void);
extern void SetUpConnectionSocket (int iport, void (*connectionFunc) (int));
@@ -266,7 +266,7 @@ extern void SetUpPair (FD client, FD server);
extern FD FDPair (FD fd);
extern FD ClientHalf (FD fd);
extern FD ServerHalf (FD fd);
-extern char *ClientName (FD fd);
+extern const char *ClientName (FD fd);
extern int ClientNumber (FD fd);
extern void NewConnection (FD fd);
extern void FlushFD (FD fd);
diff --git a/prtype.c b/prtype.c
index 81c9a61..371d315 100644
--- a/prtype.c
+++ b/prtype.c
@@ -68,7 +68,7 @@
/* print representation of a character for debugging */
-static char *
+static const char *
printrep (unsigned short c)
{
static char pr[8];
diff --git a/scope.c b/scope.c
index f2716d2..2fec497 100644
--- a/scope.c
+++ b/scope.c
@@ -131,11 +131,11 @@ static CMDResult CMDQuit (int argc, char **argv);
static CMDResult CMDHelp (int argc, char **argv);
typedef struct _CMDFunc {
- char *name;
- char *alias;
+ const char *name;
+ const char *alias;
CMDResult (*func)(int argc, char **argv);
- char *usage;
- char *help;
+ const char *usage;
+ const char *help;
} CMDFuncRec;
typedef const CMDFuncRec *CMDFuncPtr;
@@ -1050,7 +1050,7 @@ ServerHalf (
return(FDinfo[fd].pair);
}
-char *
+const char *
ClientName (
FD fd)
{
--
1.7.3.2
More information about the xorg-devel
mailing list