[Commit] fontconfig/doc Makefile.am, 1.14, 1.15 edit-sgml.c, 1.4,
1.5 fcinit.fncs, 1.1, 1.2
Carl Worth
commit at keithp.com
Fri Aug 15 13:45:21 PDT 2003
Committed by: cworth
Update of /local/src/CVS/fontconfig/doc
In directory home.keithp.com:/tmp/cvs-serv29091/doc
Modified Files:
Makefile.am edit-sgml.c fcinit.fncs
Log Message:
Added new FcFini function for cleaning up all memory.
Fixed a few memory leaks.
fc-list now calls FcFini, (and is now leak-free according to valgrind)
Index: Makefile.am
===================================================================
RCS file: /local/src/CVS/fontconfig/doc/Makefile.am,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- Makefile.am 17 Jun 2003 18:28:20 -0000 1.14
+++ Makefile.am 15 Aug 2003 19:45:19 -0000 1.15
@@ -26,7 +26,7 @@
fcstring.fncs \
fcstrset.fncs \
fcvalue.fncs
-
+
DOC_FUNCS_SGML=\
fcatomic.sgml \
fcblanks.sgml \
@@ -60,7 +60,7 @@
FcConfigGetFontDirs.3 FcConfigGetFonts.3 FcConfigGetRescanInverval.3 \
FcConfigParseAndLoad.3 FcConfigSetCurrent.3 FcConfigSetRescanInverval.3 \
FcConfigSubstitute.3 FcConfigSubstituteWithPat.3 FcConfigUptoDate.3 \
-FcDefaultSubstitute.3 FcDirCacheValid.3 FcDirSave.3 FcDirScan.3 FcFileScan.3 \
+FcDefaultSubstitute.3 FcDirCacheValid.3 FcDirSave.3 FcDirScan.3 FcFini.3 FcFileScan.3 \
FcFontList.3 FcFontMatch.3 FcFontRenderPrepare.3 FcFontSetAdd.3 \
FcFontSetCreate.3 FcFontSetDestroy.3 FcFontSort.3 FcFreeTypeCharIndex.3 \
FcFreeTypeCharSet.3 FcFreeTypeQuery.3 FcGetVersion.3 FcInit.3 \
@@ -89,8 +89,8 @@
DOC_DIRS=$(HTML_DIRS)
LOCAL_DOCS=$(man_MANS) $(DOC_FILES) $(DOC_DIRS)
-EXTRA_DIST = $(LOCAL_DOCS) $(SGML) $(DOC_FUNCS_FNCS) $(FNCS_TMPL)
-
+EXTRA_DIST=$(LOCAL_DOCS) $(SGML) $(DOC_FUNCS_FNCS) $(FNCS_TMPL)
+
SUFFIXES=.fncs .sgml .txt .html
if USEDOCBOOK
Index: edit-sgml.c
===================================================================
RCS file: /local/src/CVS/fontconfig/doc/edit-sgml.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- edit-sgml.c 17 Apr 2003 17:43:04 -0000 1.4
+++ edit-sgml.c 15 Aug 2003 19:45:19 -0000 1.5
@@ -27,6 +27,15 @@
#include <string.h>
#include <ctype.h>
+static void *
+New (int size);
+
+static void *
+Reallocate (void *p, int size);
+
+static void
+Dispose (void *p);
+
typedef enum { False, True } Bool;
typedef struct {
@@ -35,9 +44,107 @@
int len;
} String;
+static String *
+StringNew (void);
+
+static void
+StringAdd (String *s, char c);
+
+static void
+StringAddString (String *s, char *buf);
+
+static String *
+StringMake (char *buf);
+
+static void
+StringDel (String *s);
+
+static void
+StringPut (FILE *f, String *s);
+
+static void
+StringDispose (String *s);
+
+typedef struct {
+ String *tag;
+ String *text;
+} Replace;
+
+static Replace *
+ReplaceNew (void);
+
+static void
+ReplaceDispose (Replace *r);
+
+static void
+Bail (char *format, char *arg);
+
+static Replace *
+ReplaceRead (FILE *f);
+
+typedef struct _replaceList {
+ struct _replaceList *next;
+ Replace *r;
+} ReplaceList;
+
+static ReplaceList *
+ReplaceListNew (Replace *r, ReplaceList *next);
+
+static void
+ReplaceListDispose (ReplaceList *l);
+
+typedef struct {
+ ReplaceList *head;
+} ReplaceSet;
+
+static ReplaceSet *
+ReplaceSetNew (void);
+
+static void
+ReplaceSetDispose (ReplaceSet *s);
+
+static void
+ReplaceSetAdd (ReplaceSet *s, Replace *r);
+
+static Replace *
+ReplaceSetFind (ReplaceSet *s, char *tag);
+
+static ReplaceSet *
+ReplaceSetRead (FILE *f);
+
+typedef struct _skipStack {
+ struct _skipStack *prev;
+ int skipping;
+} SkipStack;
+
+static SkipStack *
+SkipStackPush (SkipStack *prev, int skipping);
+
+static SkipStack *
+SkipStackPop (SkipStack *prev);
+
+typedef struct _loopStack {
+ struct _loopStack *prev;
+ String *tag;
+ String *extra;
+ long pos;
+} LoopStack;
+
+static LoopStack *
+LoopStackPush (LoopStack *prev, FILE *f, char *tag);
+
+static LoopStack *
+LoopStackLoop (ReplaceSet *rs, LoopStack *ls, FILE *f);
+
+static void
+LineSkip (FILE *f);
+
+static void
+DoReplace (FILE *f, ReplaceSet *s);
+
#define STRING_INIT 128
-void *
+static void *
New (int size)
{
void *m = malloc (size);
@@ -46,7 +153,7 @@
return m;
}
-void *
+static void *
Reallocate (void *p, int size)
{
void *r = realloc (p, size);
@@ -56,13 +163,13 @@
return r;
}
-void
+static void
Dispose (void *p)
{
free (p);
}
-String *
+static String *
StringNew (void)
{
String *s;
@@ -75,7 +182,7 @@
return s;
}
-void
+static void
StringAdd (String *s, char c)
{
if (s->len == s->size)
@@ -84,14 +191,14 @@
s->buf[s->len] = '\0';
}
-void
+static void
StringAddString (String *s, char *buf)
{
while (*buf)
StringAdd (s, *buf++);
}
-String *
+static String *
StringMake (char *buf)
{
String *s = StringNew ();
@@ -99,14 +206,14 @@
return s;
}
-void
+static void
StringDel (String *s)
{
if (s->len)
s->buf[--s->len] = '\0';
}
-void
+static void
StringPut (FILE *f, String *s)
{
char *b = s->buf;
@@ -117,19 +224,14 @@
#define StringLast(s) ((s)->len ? (s)->buf[(s)->len - 1] : '\0')
-void
+static void
StringDispose (String *s)
{
Dispose (s->buf);
Dispose (s);
}
-typedef struct {
- String *tag;
- String *text;
-} Replace;
-
-Replace *
+static Replace *
ReplaceNew (void)
{
Replace *r = New (sizeof (Replace));
@@ -138,7 +240,7 @@
return r;
}
-void
+static void
ReplaceDispose (Replace *r)
{
StringDispose (r->tag);
@@ -146,7 +248,7 @@
Dispose (r);
}
-void
+static void
Bail (char *format, char *arg)
{
fprintf (stderr, "fatal: ");
@@ -155,7 +257,7 @@
exit (1);
}
-Replace *
+static Replace *
ReplaceRead (FILE *f)
{
int c;
@@ -195,12 +297,7 @@
return r;
}
-typedef struct _replaceList {
- struct _replaceList *next;
- Replace *r;
-} ReplaceList;
-
-ReplaceList *
+static ReplaceList *
ReplaceListNew (Replace *r, ReplaceList *next)
{
ReplaceList *l = New (sizeof (ReplaceList));
@@ -209,7 +306,7 @@
return l;
}
-void
+static void
ReplaceListDispose (ReplaceList *l)
{
if (l)
@@ -220,11 +317,7 @@
}
}
-typedef struct {
- ReplaceList *head;
-} ReplaceSet;
-
-ReplaceSet *
+static ReplaceSet *
ReplaceSetNew (void)
{
ReplaceSet *s = New (sizeof (ReplaceSet));
@@ -232,20 +325,20 @@
return s;
}
-void
+static void
ReplaceSetDispose (ReplaceSet *s)
{
ReplaceListDispose (s->head);
Dispose (s);
}
-void
+static void
ReplaceSetAdd (ReplaceSet *s, Replace *r)
{
s->head = ReplaceListNew (r, s->head);
}
-Replace *
+static Replace *
ReplaceSetFind (ReplaceSet *s, char *tag)
{
ReplaceList *l;
@@ -256,7 +349,7 @@
return 0;
}
-ReplaceSet *
+static ReplaceSet *
ReplaceSetRead (FILE *f)
{
ReplaceSet *s = ReplaceSetNew ();
@@ -276,12 +369,7 @@
return s;
}
-typedef struct _skipStack {
- struct _skipStack *prev;
- int skipping;
-} SkipStack;
-
-SkipStack *
+static SkipStack *
SkipStackPush (SkipStack *prev, int skipping)
{
SkipStack *ss = New (sizeof (SkipStack));
@@ -290,7 +378,7 @@
return ss;
}
-SkipStack *
+static SkipStack *
SkipStackPop (SkipStack *prev)
{
SkipStack *ss = prev->prev;
@@ -298,14 +386,7 @@
return ss;
}
-typedef struct _loopStack {
- struct _loopStack *prev;
- String *tag;
- String *extra;
- long pos;
-} LoopStack;
-
-LoopStack *
+static LoopStack *
LoopStackPush (LoopStack *prev, FILE *f, char *tag)
{
LoopStack *ls = New (sizeof (LoopStack));
@@ -316,7 +397,7 @@
return ls;
}
-LoopStack *
+static LoopStack *
LoopStackLoop (ReplaceSet *rs, LoopStack *ls, FILE *f)
{
String *s = StringMake (ls->tag->buf);
@@ -339,7 +420,7 @@
return ret;
}
-void
+static void
LineSkip (FILE *f)
{
int c;
@@ -349,7 +430,7 @@
ungetc (c, f);
}
-void
+static void
DoReplace (FILE *f, ReplaceSet *s)
{
int c;
Index: fcinit.fncs
===================================================================
RCS file: /local/src/CVS/fontconfig/doc/fcinit.fncs,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- fcinit.fncs 7 Mar 2003 19:01:41 -0000 1.1
+++ fcinit.fncs 15 Aug 2003 19:45:19 -0000 1.2
@@ -50,6 +50,17 @@
been loaded, this routine does nothing and returns FcTrue.
@@
+ at RET@ void
+ at FUNC@ FcFini
+ at TYPE1@ void
+ at PURPOSE@ finalize fonconfig library
+ at DESC@
+Frees all data structures allocated by previous calls to fontconfig
+functions. Fontconfig returns to an uninitialized state, requiring a
+new call to one of the FcInit functions before any other fontconfig
+function may be called.
+@@
+
@RET@ int
@FUNC@ FcGetVersion
@TYPE1@ void
More information about the Commit
mailing list