[PATCH] Allow paths and patterns to be const

Keith Packard keithp at keithp.com
Fri Dec 13 11:32:25 PST 2013


Signed-off-by: Keith Packard <keithp at keithp.com>
---
 font.h       |  4 ++--
 fontstruct.h | 16 ++++++++++------
 2 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/font.h b/font.h
index b71046b..a834655 100644
--- a/font.h
+++ b/font.h
@@ -140,7 +140,7 @@ extern void		    EmptyFontPatternCache (
 
 extern void		    CacheFontPattern (
     FontPatternCachePtr /* cache */,
-    char * /* pattern */,
+    const char * /* pattern */,
     int /* patlen */,
     FontPtr /* pFont */
 );
@@ -150,7 +150,7 @@ extern FontResolutionPtr GetClientResolutions(
 
 extern FontPtr		    FindCachedFontPattern (
     FontPatternCachePtr /* cache */,
-    char * /* pattern */,
+    const char * /* pattern */,
     int /* patlen */
 );
 
diff --git a/fontstruct.h b/fontstruct.h
index 97e771a..ae35a8e 100644
--- a/fontstruct.h
+++ b/fontstruct.h
@@ -143,23 +143,27 @@ typedef struct _FontNames {
     char      **names;
 }           FontNamesRec;
 
+
 /* External view of font paths */
 typedef struct _FontPathElement {
     int         name_length;
-    char       *name;
+#if FONT_PATH_ELEMENT_NAME_CONST
+    const
+#endif
+    char        *name;
     int         type;
     int         refcount;
     pointer     private;
 }           FontPathElementRec;
 
-typedef Bool (*NameCheckFunc) (char *name);
+typedef Bool (*NameCheckFunc) (const char *name);
 typedef int (*InitFpeFunc) (FontPathElementPtr fpe);
 typedef int (*FreeFpeFunc) (FontPathElementPtr fpe);
 typedef int (*ResetFpeFunc) (FontPathElementPtr fpe);
 typedef int (*OpenFontFunc) ( pointer client,
 			      FontPathElementPtr fpe,
 			      Mask flags,
-			      char* name,
+			      const char* name,
 			      int namelen,
 			      fsBitmapFormat format,
 			      fsBitmapFormatMask fmask,
@@ -170,14 +174,14 @@ typedef int (*OpenFontFunc) ( pointer client,
 typedef void (*CloseFontFunc) (FontPathElementPtr fpe, FontPtr pFont);
 typedef int (*ListFontsFunc) (pointer client,
 			      FontPathElementPtr fpe,
-			      char* pat,
+			      const char* pat,
 			      int len,
 			      int max,
 			      FontNamesPtr names);
 
 typedef int (*StartLfwiFunc) (pointer client,
 			      FontPathElementPtr fpe,
-			      char* pat,
+			      const char* pat,
 			      int len,
 			      int max,
 			      pointer* privatep);
@@ -205,7 +209,7 @@ typedef int (*LoadGlyphsFunc) (pointer client,
 
 typedef int (*StartLaFunc) (pointer client,
 			    FontPathElementPtr fpe,
-			    char* pat,
+			    const char* pat,
 			    int len,
 			    int max,
 			    pointer* privatep);
-- 
1.8.4.4



More information about the xorg-devel mailing list