Keith Packard
2007-Nov-03 20:09 UTC
[Fontconfig] fontconfig: Branch ''master'' - 2 commits
doc/fcatomic.fncs | 6 +- fontconfig/Makefile.am | 3 - fontconfig/fcprivate.h | 123 ------------------------------------------------- src/Makefile.am | 3 - src/fcint.h | 95 +++++++++++++++++++++++++++++++++++++ 5 files changed, 99 insertions(+), 131 deletions(-) New commits: commit b607922909acfc7ae96de688ed34efd19cd038ac Author: Keith Packard <keithp at koto.keithp.com> Date: Sat Nov 3 13:09:01 2007 -0700 Remove fcprivate.h, move the remaining macros to fcint.h. fcprivate.h was supposed to extend the fontconfig API for the various fontconfig utilities. Instead, just have those utilities use the internal fcint.h header file (which they already do), removing fcprivate.h from the installation and hence from the defacto public API. diff --git a/fontconfig/Makefile.am b/fontconfig/Makefile.am index 72fec33..7616d8f 100644 --- a/fontconfig/Makefile.am +++ b/fontconfig/Makefile.am @@ -2,7 +2,6 @@ fontconfigincludedir=$(includedir)/fontconfig fontconfig_headers= \ fontconfig.h \ - fcfreetype.h \ - fcprivate.h + fcfreetype.h fontconfiginclude_HEADERS = $(fontconfig_headers) diff --git a/fontconfig/fcprivate.h b/fontconfig/fcprivate.h deleted file mode 100644 index 9be4c01..0000000 --- a/fontconfig/fcprivate.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * $RCSId: xc/lib/fontconfig/fontconfig/fcprivate.h,v 1.5 2002/08/19 19:32:04 keithp Exp $ - * - * Copyright ?? 2001 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef _FCPRIVATE_H_ -#define _FCPRIVATE_H_ - -/* - * I tried this with functions that took va_list* arguments - * but portability concerns made me change these functions - * into macros (sigh). - */ - -#define FcPatternVapBuild(result, orig, va) \ -{ \ - FcPattern *__p__ = (orig); \ - const char *__o__; \ - FcValue __v__; \ - \ - if (!__p__) \ - { \ - __p__ = FcPatternCreate (); \ - if (!__p__) \ - goto _FcPatternVapBuild_bail0; \ - } \ - for (;;) \ - { \ - __o__ = va_arg (va, const char *); \ - if (!__o__) \ - break; \ - __v__.type = va_arg (va, FcType); \ - switch (__v__.type) { \ - case FcTypeVoid: \ - goto _FcPatternVapBuild_bail1; \ - case FcTypeInteger: \ - __v__.u.i = va_arg (va, int); \ - break; \ - case FcTypeDouble: \ - __v__.u.d = va_arg (va, double); \ - break; \ - case FcTypeString: \ - __v__.u.s = va_arg (va, const FcChar8 *); \ - break; \ - case FcTypeBool: \ - __v__.u.b = va_arg (va, FcBool); \ - break; \ - case FcTypeMatrix: \ - __v__.u.m = va_arg (va, const FcMatrix *); \ - break; \ - case FcTypeCharSet: \ - __v__.u.c = va_arg (va, const FcCharSet *); \ - break; \ - case FcTypeFTFace: \ - __v__.u.f = va_arg (va, FT_Face); \ - break; \ - case FcTypeLangSet: \ - __v__.u.l = va_arg (va, const FcLangSet *); \ - break; \ - } \ - if (!FcPatternAdd (__p__, __o__, __v__, FcTrue)) \ - goto _FcPatternVapBuild_bail1; \ - } \ - result = __p__; \ - goto _FcPatternVapBuild_return; \ - \ -_FcPatternVapBuild_bail1: \ - if (!orig) \ - FcPatternDestroy (__p__); \ -_FcPatternVapBuild_bail0: \ - result = (void*)0; \ - \ -_FcPatternVapBuild_return: \ - ; \ -} - - -#define FcObjectSetVapBuild(__ret__, __first__, __va__) \ -{ \ - FcObjectSet *__os__; \ - const char *__ob__; \ - \ - __ret__ = 0; \ - __os__ = FcObjectSetCreate (); \ - if (!__os__) \ - goto _FcObjectSetVapBuild_bail0; \ - __ob__ = __first__; \ - while (__ob__) \ - { \ - if (!FcObjectSetAdd (__os__, __ob__)) \ - goto _FcObjectSetVapBuild_bail1; \ - __ob__ = va_arg (__va__, const char *); \ - } \ - __ret__ = __os__; \ - \ -_FcObjectSetVapBuild_bail1: \ - if (!__ret__ && __os__) \ - FcObjectSetDestroy (__os__); \ -_FcObjectSetVapBuild_bail0: \ - ; \ -} - -#endif /* _FCPRIVATE_H_ */ - diff --git a/src/Makefile.am b/src/Makefile.am index 418b74b..2ff1f3c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -124,8 +124,7 @@ uninstall-local: uninstall-ms-import-lib uninstall-libtool-import-lib PUBLIC_FILES = \ $(top_srcdir)/fontconfig/fontconfig.h \ - $(top_srcdir)/fontconfig/fcfreetype.h \ - $(top_srcdir)/fontconfig/fcprivate.h + $(top_srcdir)/fontconfig/fcfreetype.h fcaliastail.h: fcalias.h diff --git a/src/fcint.h b/src/fcint.h index ce2ec46..25fb00f 100644 --- a/src/fcint.h +++ b/src/fcint.h @@ -46,7 +46,6 @@ #include <sys/stat.h> #include <time.h> #include <fontconfig/fontconfig.h> -#include <fontconfig/fcprivate.h> #include <fontconfig/fcfreetype.h> #ifndef FC_CONFIG_PATH @@ -496,6 +495,100 @@ typedef struct _FcCharMap FcCharMap; /* watch out; assumes that v is void * -PL */ #define ALIGN(v,type) ((void *)(((uintptr_t)(v) + fc_alignof(type) - 1) & ~(fc_alignof(type) - 1))) +/* + * I tried this with functions that took va_list* arguments + * but portability concerns made me change these functions + * into macros (sigh). + */ + +#define FcPatternVapBuild(result, orig, va) \ +{ \ + FcPattern *__p__ = (orig); \ + const char *__o__; \ + FcValue __v__; \ + \ + if (!__p__) \ + { \ + __p__ = FcPatternCreate (); \ + if (!__p__) \ + goto _FcPatternVapBuild_bail0; \ + } \ + for (;;) \ + { \ + __o__ = va_arg (va, const char *); \ + if (!__o__) \ + break; \ + __v__.type = va_arg (va, FcType); \ + switch (__v__.type) { \ + case FcTypeVoid: \ + goto _FcPatternVapBuild_bail1; \ + case FcTypeInteger: \ + __v__.u.i = va_arg (va, int); \ + break; \ + case FcTypeDouble: \ + __v__.u.d = va_arg (va, double); \ + break; \ + case FcTypeString: \ + __v__.u.s = va_arg (va, const FcChar8 *); \ + break; \ + case FcTypeBool: \ + __v__.u.b = va_arg (va, FcBool); \ + break; \ + case FcTypeMatrix: \ + __v__.u.m = va_arg (va, const FcMatrix *); \ + break; \ + case FcTypeCharSet: \ + __v__.u.c = va_arg (va, const FcCharSet *); \ + break; \ + case FcTypeFTFace: \ + __v__.u.f = va_arg (va, FT_Face); \ + break; \ + case FcTypeLangSet: \ + __v__.u.l = va_arg (va, const FcLangSet *); \ + break; \ + } \ + if (!FcPatternAdd (__p__, __o__, __v__, FcTrue)) \ + goto _FcPatternVapBuild_bail1; \ + } \ + result = __p__; \ + goto _FcPatternVapBuild_return; \ + \ +_FcPatternVapBuild_bail1: \ + if (!orig) \ + FcPatternDestroy (__p__); \ +_FcPatternVapBuild_bail0: \ + result = (void*)0; \ + \ +_FcPatternVapBuild_return: \ + ; \ +} + + +#define FcObjectSetVapBuild(__ret__, __first__, __va__) \ +{ \ + FcObjectSet *__os__; \ + const char *__ob__; \ + \ + __ret__ = 0; \ + __os__ = FcObjectSetCreate (); \ + if (!__os__) \ + goto _FcObjectSetVapBuild_bail0; \ + __ob__ = __first__; \ + while (__ob__) \ + { \ + if (!FcObjectSetAdd (__os__, __ob__)) \ + goto _FcObjectSetVapBuild_bail1; \ + __ob__ = va_arg (__va__, const char *); \ + } \ + __ret__ = __os__; \ + \ +_FcObjectSetVapBuild_bail1: \ + if (!__ret__ && __os__) \ + FcObjectSetDestroy (__os__); \ +_FcObjectSetVapBuild_bail0: \ + ; \ +} + /* fcblanks.c */ /* fccache.c */ commit 910db318ae67693f7bc17f0bdc61caaf555365ae Author: Keith Packard <keithp at koto.keithp.com> Date: Sat Nov 3 13:05:25 2007 -0700 Correct documentation for FcAtomicLock (Bug 12947). FcAtomicLock can only be called once from any process. diff --git a/doc/fcatomic.fncs b/doc/fcatomic.fncs index 9cd633c..ae27c68 100644 --- a/doc/fcatomic.fncs +++ b/doc/fcatomic.fncs @@ -38,9 +38,9 @@ a consistent and complete file without the need to lock for reading. @TYPE1@ FcAtomic * @ARG1@ atomic @PURPOSE@ lock a file @DESC@ -Attempts to lock the file referenced by <parameter>atomic</parameter>. Returns FcFalse if the -file is locked by another process, else returns FcTrue and leaves the file -locked. +Attempts to lock the file referenced by <parameter>atomic</parameter>. +Returns FcFalse if the file is already locked, else returns FcTrue and +leaves the file locked. @@ @RET@ FcChar8 *