[PATCH:libFS] Constify pattern argument to FSListCatalogues

Alan Coopersmith alan.coopersmith at oracle.com
Sat May 31 15:23:44 PDT 2014


The contents of pattern are simply copied to the request sent to
the font server and never touched again, so can be labeled read-only.

Fixes compiler warning building xfsinfo:

xfsinfo.c: In function ‘print_catalogue_info’:
xfsinfo.c:158:5: warning: passing argument 2 of ‘FSListCatalogues’ discards
 ‘const’ qualifier from pointer target type [enabled by default]
     char      **cats = FSListCatalogues(svr, "*", 1000, &n);
     ^
In file included from xfsinfo.c:66:0:
FSlib.h:255:16: note: expected ‘char *’ but argument is of type ‘const char *’
 extern char ** FSListCatalogues ( FSServer *svr, char *pattern,

Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 include/X11/fonts/FSlib.h |    2 +-
 src/FSListCats.c          |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/X11/fonts/FSlib.h b/include/X11/fonts/FSlib.h
index 1cd7f13..ee6f245 100644
--- a/include/X11/fonts/FSlib.h
+++ b/include/X11/fonts/FSlib.h
@@ -252,7 +252,7 @@ extern char ** FSListExtensions ( FSServer *svr, int *next );
 extern int FSQueryExtension ( FSServer *svr, char *name, int *major_opcode,
 			      int *first_event, int *first_error );
 
-extern char ** FSListCatalogues ( FSServer *svr, char *pattern,
+extern char ** FSListCatalogues ( FSServer *svr, const char *pattern,
 				  int maxNames, int *actualCount );
 extern char ** FSGetCatalogues ( FSServer *svr, int *num );
 
diff --git a/src/FSListCats.c b/src/FSListCats.c
index 7987f79..89fb2e4 100644
--- a/src/FSListCats.c
+++ b/src/FSListCats.c
@@ -57,7 +57,7 @@ in this Software without prior written authorization from The Open Group.
 char      **
 FSListCatalogues(
     FSServer	*svr,
-    char	*pattern,
+    const char	*pattern,
     int		 maxNames,
     int		*actualCount)
 {
-- 
1.7.9.2



More information about the xorg-devel mailing list