]> git.wh0rd.org - fontconfig.git/blobdiff - fc-lang/fc-lang.c
Place language name in constant array instead of pointer.
[fontconfig.git] / fc-lang / fc-lang.c
index 631411d1bb2d7f3bb0c41fa4b9289ab86c632d63..989a823b41d9a3f8e584c4d9b92e8a271c2eecb8 100644 (file)
@@ -22,9 +22,9 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-#include "fcint.h"
 #include "fccharset.c"
 #include "fcstr.c"
+#include "fcserialize.c"
 
 /*
  * fc-lang
@@ -47,6 +47,18 @@ FcMemFree (int kind, int size)
 {
 }
 
+FcPrivate void
+FcCacheObjectReference (void *object)
+{
+}
+
+FcPrivate void
+FcCacheObjectDereference (void *object)
+{
+}
+
+int FcDebugVal;
+
 FcChar8 *
 FcConfigHome (void)
 {
@@ -113,14 +125,14 @@ scanopen (char *file)
  * Comments begin with '#'
  */
 
-static FcCharSet *
-scan (FILE *f, char *file)
+static const FcCharSet *
+scan (FILE *f, char *file, FcCharSetFreezer *freezer)
 {
-    FcCharSet  *c = 0;
-    FcCharSet  *n;
-    int                start, end, ucs4;
-    char       line[1024];
-    int                lineno = 0;
+    FcCharSet      *c = 0;
+    const FcCharSet *n;
+    int                    start, end, ucs4;
+    char           line[1024];
+    int                    lineno = 0;
 
     while (get_line (f, line, &lineno))
     {
@@ -135,9 +147,9 @@ scan (FILE *f, char *file)
            f = scanopen (file);
            if (!f)
                fatal (file, 0, "can't open");
-           c = scan (f, file);
+           n = scan (f, file, freezer);
            fclose (f);
-           return c;
+           return n;
        }
        if (strchr (line, '-'))
        {
@@ -158,7 +170,7 @@ scan (FILE *f, char *file)
                fatal (file, lineno, "out of memory");
        }
     }
-    n = FcCharSetFreeze (c);
+    n = FcCharSetFreeze (freezer, c);
     FcCharSetDestroy (c);
     return n;
 }
@@ -221,7 +233,7 @@ int
 main (int argc, char **argv)
 {
     static char                *files[MAX_LANG];
-    static FcCharSet   *sets[MAX_LANG];
+    static const FcCharSet     *sets[MAX_LANG];
     static int         duplicate[MAX_LANG];
     static int         country[MAX_LANG];
     static char                *names[MAX_LANG];
@@ -241,7 +253,11 @@ main (int argc, char **argv)
     int                setRangeStart[26];
     int                setRangeEnd[26];
     FcChar8    setRangeChar;
+    FcCharSetFreezer   *freezer;
     
+    freezer = FcCharSetFreezerCreate ();
+    if (!freezer)
+       fatal (argv[0], 0, "out of memory");
     argi = 1;
     while (argv[argi])
     {
@@ -263,7 +279,7 @@ main (int argc, char **argv)
        f = scanopen (files[i]);
        if (!f)
            fatal (files[i], 0, strerror (errno));
-       sets[i] = scan (f, files[i]);
+       sets[i] = scan (f, files[i], freezer);
        names[i] = get_name (files[i]);
        langs[i] = get_lang(names[i]);
        if (strchr (langs[i], '-'))
@@ -361,7 +377,7 @@ main (int argc, char **argv)
        if (j < 0)
            j = i;
 
-       printf ("    { (FcChar8 *) \"%s\", "
+       printf ("    { \"%s\", "
                " { FC_REF_CONSTANT, %d, OFF(%d,%d), NUM(%d,%d) } }, /* %d */\n",
                langs[i],
                sets[j]->num, i, off[j], i, off[j], i);