[Fontconfig] [PATCH] fc-list: constify format string

Mike Frysinger vapier at gentoo.org
Mon Nov 7 12:34:12 PST 2011


We don't free this string anywhere, so mark it const to avoid gcc warnings
and possible bugs in the future (if people did try freeing it).

fc-list.c: In function 'main':
fc-list.c:161:16: warning: pointer targets in assignment
	differ in signedness [-Wpointer-sign]

Signed-off-by: Mike Frysinger <vapier at gentoo.org>
---
 fc-list/fc-list.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/fc-list/fc-list.c b/fc-list/fc-list.c
index ad38332..4414ca0 100644
--- a/fc-list/fc-list.c
+++ b/fc-list/fc-list.c
@@ -94,14 +94,14 @@ usage (char *program, int error)
 int
 main (int argc, char **argv)
 {
-    int		verbose = 0;
-    int		quiet = 0;
-    FcChar8     *format = NULL;
-    int		nfont = 0;
-    int		i;
-    FcObjectSet *os = 0;
-    FcFontSet	*fs;
-    FcPattern   *pat;
+    int			verbose = 0;
+    int			quiet = 0;
+    const FcChar8	*format = NULL;
+    int			nfont = 0;
+    int			i;
+    FcObjectSet		*os = 0;
+    FcFontSet		*fs;
+    FcPattern		*pat;
 #if HAVE_GETOPT_LONG || HAVE_GETOPT
     int		c;
 
@@ -158,7 +158,7 @@ main (int argc, char **argv)
     if (!verbose && !format && !os)
 	os = FcObjectSetBuild (FC_FAMILY, FC_STYLE, FC_FILE, (char *) 0);
     if (!format)
-        format = "%{=fclist}\n";
+        format = (const FcChar8 *) "%{=fclist}\n";
     fs = FcFontList (0, pat, os);
     if (os)
 	FcObjectSetDestroy (os);
-- 
1.7.6.1



More information about the Fontconfig mailing list