From ddc05759f098f06bd93253a7bffe38640963dfb3 Mon Sep 17 00:00:00 2001 From: marha Date: Fri, 11 Jan 2013 08:00:45 +0100 Subject: fontconfig libX11 mesa mkfontscale xserver git update 11 jan 2013 fontconfig: 0831c1770e4bac7269a190936bbb0529d747e233 libX11: 0b148750027fd0557c5ed93afda861ddf4b92e0f mkfontscale: 9cbe3256bc932b82f2435b23cda0931f4f5f5ba2 xserver: 6703a7c7cf1a349c137e247a0c8eb462ff7b07be mesa: babab2876080af0fe65249dff559244aebd0b87e --- fontconfig/Makefile.am | 2 +- fontconfig/README | 105 +++++++++++++- fontconfig/autogen.sh | 4 +- fontconfig/configure.ac | 25 +++- fontconfig/doc/fclangset.fncs | 8 ++ fontconfig/doc/func.sgml | 2 +- fontconfig/fc-validate/Makefile.am | 60 ++++++++ fontconfig/fc-validate/fc-validate.c | 242 ++++++++++++++++++++++++++++++++ fontconfig/fc-validate/fc-validate.sgml | 182 ++++++++++++++++++++++++ fontconfig/fontconfig/fontconfig.h | 5 +- fontconfig/new-version.sh | 4 +- fontconfig/src/fcatomic.h | 12 ++ fontconfig/src/fcint.h | 3 - fontconfig/src/fcstr.c | 13 +- fontconfig/test/Makefile.am | 11 ++ fontconfig/test/test-pthread.c | 79 +++++++++++ 16 files changed, 741 insertions(+), 16 deletions(-) create mode 100644 fontconfig/fc-validate/Makefile.am create mode 100644 fontconfig/fc-validate/fc-validate.c create mode 100644 fontconfig/fc-validate/fc-validate.sgml create mode 100644 fontconfig/test/test-pthread.c (limited to 'fontconfig') diff --git a/fontconfig/Makefile.am b/fontconfig/Makefile.am index 6aee88a59..84c91acbb 100644 --- a/fontconfig/Makefile.am +++ b/fontconfig/Makefile.am @@ -23,7 +23,7 @@ SUBDIRS=fontconfig fc-case fc-lang fc-glyphname src \ fc-cache fc-cat fc-list fc-match fc-pattern fc-query fc-scan \ - conf.d test + fc-validate conf.d test if ENABLE_DOCS SUBDIRS += doc DIST_SUBDIRS = $(SUBDIRS) diff --git a/fontconfig/README b/fontconfig/README index 5c666b0f6..fcd3ab343 100644 --- a/fontconfig/README +++ b/fontconfig/README @@ -1,12 +1,113 @@ Fontconfig Font configuration and customization library - Version 2.10.2 - 2012-03-11 + Version 2.10.91 (2.11 RC1) + 2013-01-10 Check INSTALL for compilation and installation instructions. Report bugs to https://bugs.freedesktop.org in the fontconfig module. +2.10.91 (2.11 RC1) + +Akira TAGOH (19): + Fix a potability issue about stdint.h + Fix build issues on clean tree + Do not show the deprecation warning if it is a symlink + Fix a typo + Fix the wrong estimation for the memory usage information in fontconfig + Remove the duplicate null-check + Remove the dead code + clean up + Fix a typo that accessing to the out of array + Fix a memory leak + Check the system font to be initialized + Missing header file for _mkdir declaration + Clean up the unused variable + Bug 47705 - Using O_CLOEXEC + missing header file to declare _mkdir + Fix a build fail on mingw + Fix a typo in the manpages template + Bug 29312 - RFE: feature to indicate which characters are missing to satisfy the language support + Update the date in README properly + +Behdad Esfahbod (73): + Fix typo + Parse matrices of expressions + Fix compiler warnings + Fix unused-parameter warnings + Fix more warnings + Fix sign-compare warnings + Fix warning + Fix more warnings + Fixup from 4f6767470f52b287a2923e7e6d8de5fae1993f67 + Remove memory accounting and reporting + Allow target="font/pattern/default" in elements + Don't warn if an unknown element is used in an expression + Unbreak build when FC_ARCHITECTURE is defined + Remove unneeded stuff + Enable fcarch assert checks even when FC_ARCHITECTURE is explicitly given + Make tests run on Windows + Initialize matrix during name parsing + Adjust docs for recent changes + Warn if appears in + Make FC_DBG_OBJTYPES debug messages into warnings + Refuse to set value to unsupported types during config too + Add NULL check + Don't crash in FcPatternDestroy with NULL pattern + Don't crash in FcPatternFormat() with NULL pattern + Minor + Whitespace + Deprecate FcName(Un)RegisterObjectTypes / FcName(Un)RegisterConstants + Use a static perfect hash table for object-name lookup + Switch .gitignore to git.mk + Remove shared-str pool + Fix build stuff + Add build stuff for threadsafety primitives + Add thread-safety primitives + Make refcounts, patterns, charsets, strings, and FcLang thread-safe + Make FcGetDefaultLang and FcGetDefaultLangs thread-safe + Make FcInitDebug() idempotent + Make FcDefaultFini() threadsafe + Refactor; contain default config in fccfg.c + Minor + Make default-FcConfig threadsafe + Minor + Make FcCacheIsMmapSafe() threadsafe + Minor + Make cache refcounting threadsafe + Add a big cache lock + Make random-state initialization threadsafe + Make cache hash threadsafe + Make FcDirCacheDispose() threadsafe + Make fcobjs.c thread-safe + Warn about undefined/invalid attributes during config parsing + Fixup fcobjs.c + Remove FcSharedStr* + Fix compiler warnings + Minor + Fix build and warnings on win32 + Use CC_FOR_BUILD to generate source files + Fix more warnings. + Trying to fix distcheck + Fix build around true/false + Work around Sun CPP + Really fix cross-compiling and building of tools this time + Second try to make Sun CPP happy + Ugh, add Tools.mk + Minor + Don't use blanks for fc-query + Remove FcInit() calls from tools + Add 10-scale-bitmap-fonts.conf and enable by default + Oops, add the actual file + Fix pthreads setup + Fix memory corruption! + Add pthread test + Add atomic ops for Solaris + Make linker happy + +Jon TURNEY (1): + Fix build when srcdir != builddir + 2.10.2 Akira TAGOH (13): diff --git a/fontconfig/autogen.sh b/fontconfig/autogen.sh index 93855cb2f..1482e401c 100644 --- a/fontconfig/autogen.sh +++ b/fontconfig/autogen.sh @@ -86,7 +86,7 @@ test $TEST_TYPE $FILE || { exit 1 } -if test -z "$AUTOGEN_SUBDIR_MODE"; then +if test -z "$AUTOGEN_SUBDIR_MODE" -a -z "$NOCONFIGURE"; then if test -z "$*"; then echo "I am going to run ./configure with no arguments - if you wish " echo "to pass any to it, please specify them on the $0 command line." @@ -115,7 +115,7 @@ echo Running $AUTOCONF $AUTOCONF cd $ORIGDIR -if test -z "$AUTOGEN_SUBDIR_MODE"; then +if test -z "$AUTOGEN_SUBDIR_MODE" -a -z "$NOCONFIGURE"; then echo Running $srcdir/configure "$@" $srcdir/configure "$@" diff --git a/fontconfig/configure.ac b/fontconfig/configure.ac index 803084c09..06ac8a2e7 100644 --- a/fontconfig/configure.ac +++ b/fontconfig/configure.ac @@ -34,7 +34,7 @@ dnl This is the package version number, not the shared library dnl version. This same version number must appear in fontconfig/fontconfig.h dnl Yes, it is a pain to synchronize version numbers. Unfortunately, it's dnl not possible to extract the version number here from fontconfig.h -AM_INIT_AUTOMAKE(fontconfig, 2.10.2) +AM_INIT_AUTOMAKE(fontconfig, 2.10.91) m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) dnl libtool versioning @@ -592,8 +592,26 @@ if $fc_cv_have_intel_atomic_primitives; then AC_DEFINE(HAVE_INTEL_ATOMIC_PRIMITIVES, 1, [Have Intel __sync_* atomic primitives]) fi -AC_CHECK_HEADERS(sched.h) -AC_CHECK_FUNCS(sched_yield) +AC_CACHE_CHECK([for Solaris atomic operations], fc_cv_have_solaris_atomic_ops, [ + fc_cv_have_solaris_atomic_ops=false + AC_TRY_LINK([ + #include + /* This requires Solaris Studio 12.2 or newer: */ + #include + void memory_barrier (void) { __machine_rw_barrier (); } + int atomic_add (volatile unsigned *i) { return atomic_add_int_nv (i, 1); } + void *atomic_ptr_cmpxchg (volatile void **target, void *cmp, void *newval) { return atomic_cas_ptr (target, cmp, newval); } + ], [], fc_cv_have_solaris_atomic_ops=true + ) +]) +if $fc_cv_have_solaris_atomic_ops; then + AC_DEFINE(HAVE_SOLARIS_ATOMIC_OPS, 1, [Have Solaris __machine_*_barrier and atomic_* operations]) +fi + +if test "$os_win32" = no && ! $have_pthread; then + AC_CHECK_HEADERS(sched.h) + AC_SEARCH_LIBS(sched_yield,rt,AC_DEFINE(HAVE_SCHED_YIELD, 1, [Have sched_yield])) +fi have_pthread=false if test "$os_win32" = no; then @@ -677,6 +695,7 @@ fc-match/Makefile fc-pattern/Makefile fc-query/Makefile fc-scan/Makefile +fc-validate/Makefile doc/Makefile doc/version.sgml test/Makefile diff --git a/fontconfig/doc/fclangset.fncs b/fontconfig/doc/fclangset.fncs index e2a40b854..c08d60c70 100644 --- a/fontconfig/doc/fclangset.fncs +++ b/fontconfig/doc/fclangset.fncs @@ -178,6 +178,14 @@ Returns a string set of all languages in langset. Returns a string set of all known languages. @@ +@RET@ FcChar8 * +@FUNC@ FcLangNormalize +@TYPE1@ const FcChar8 * @ARG1@ lang +@PURPOSE@ Normalize the language string +@DESC@ +Returns a string to make lang suitable on fontconfig. +@@ + @RET@ const FcCharSet * @FUNC@ FcLangGetCharSet @TYPE1@ const FcChar8 * @ARG1@ lang diff --git a/fontconfig/doc/func.sgml b/fontconfig/doc/func.sgml index 88be32047..73e7761ce 100644 --- a/fontconfig/doc/func.sgml +++ b/fontconfig/doc/func.sgml @@ -46,7 +46,7 @@ @?SYNOPSIS@ @SYNOPSIS@ @:@ -#include <fontconfig.h> +#include <fontconfig/fontconfig.h> @;@ @{PROTOTYPE@ diff --git a/fontconfig/fc-validate/Makefile.am b/fontconfig/fc-validate/Makefile.am new file mode 100644 index 000000000..54edec295 --- /dev/null +++ b/fontconfig/fc-validate/Makefile.am @@ -0,0 +1,60 @@ +# +# fontconfig/fc-query/Makefile.am +# +# Copyright © 2003 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 the author(s) not be used in +# advertising or publicity pertaining to distribution of the software without +# specific, written prior permission. The authors make no +# representations about the suitability of this software for any purpose. It +# is provided "as is" without express or implied warranty. +# +# THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +# EVENT SHALL THE AUTHOR(S) 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. + +bin_PROGRAMS=fc-validate + +DOC2MAN = docbook2man + +FC_VALIDATE_SRC=${top_srcdir}/fc-validate + +SGML = ${FC_VALIDATE_SRC}/fc-validate.sgml + +INCLUDES=-I${top_srcdir} $(FREETYPE_CFLAGS) $(WARN_CFLAGS) + +BUILT_MANS=fc-validate.1 + +if ENABLE_DOCS +man_MANS=${BUILT_MANS} +endif + +EXTRA_DIST=fc-validate.sgml $(BUILT_MANS) + +CLEANFILES = + +fc_validate_LDADD = ${top_builddir}/src/libfontconfig.la $(FREETYPE_LIBS) + +if USEDOCBOOK + +${man_MANS}: ${SGML} + $(AM_V_GEN) $(RM) $@; \ + $(DOC2MAN) ${SGML}; \ + $(RM) manpage.* + +all-local: $(man_MANS) + +CLEANFILES += $(man_MANS) +else +all-local: +endif + +-include $(top_srcdir)/git.mk diff --git a/fontconfig/fc-validate/fc-validate.c b/fontconfig/fc-validate/fc-validate.c new file mode 100644 index 000000000..6ecff3671 --- /dev/null +++ b/fontconfig/fc-validate/fc-validate.c @@ -0,0 +1,242 @@ +/* + * fontconfig/fc-validate/fc-validate.c + * + * Copyright © 2003 Keith Packard + * Copyright © 2012 Red Hat, Inc. + * Red Hat Author(s): Akira TAGOH + * + * 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 the author(s) not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. The authors make no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * THE AUTHOR(S) DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE AUTHOR(S) 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. + */ + +#ifdef HAVE_CONFIG_H +#include +#else +#ifdef linux +#define HAVE_GETOPT_LONG 1 +#endif +#define HAVE_GETOPT 1 +#endif + +#include +#include +#include +#include +#include +#include +#include + +#ifndef HAVE_GETOPT +#define HAVE_GETOPT 0 +#endif +#ifndef HAVE_GETOPT_LONG +#define HAVE_GETOPT_LONG 0 +#endif + +#if HAVE_GETOPT_LONG +#undef _GNU_SOURCE +#define _GNU_SOURCE +#include +static const struct option longopts[] = { + {"index", 1, 0, 'i'}, + {"lang", 1, 0, 'l'}, + {"verbose", 0, 0, 'v'}, + {"version", 0, 0, 'V'}, + {"help", 0, 0, 'h'}, + {NULL,0,0,0}, +}; +#else +#if HAVE_GETOPT +extern char *optarg; +extern int optind, opterr, optopt; +#endif +#endif + +static void +usage (char *program, int error) +{ + FILE *file = error ? stderr : stdout; +#if HAVE_GETOPT_LONG + fprintf (file, "usage: %s [-Vhv] [-i index] [-l LANG] [--index index] [--lang LANG] [--verbose] [--version] [--help] font-file...\n", + program); +#else + fprintf (file, "usage: %s [-Vhv] [-i index] [-l LANG] font-file...\n", + program); +#endif + fprintf (file, "Validate font files and print result\n"); + fprintf (file, "\n"); +#if HAVE_GETOPT_LONG + fprintf (file, " -i, --index INDEX display the INDEX face of each font file only\n"); + fprintf (file, " -l, --lang=LANG set LANG instead of current locale\n"); + fprintf (file, " -v, --verbose show more detailed information\n"); + fprintf (file, " -V, --version display font config version and exit\n"); + fprintf (file, " -h, --help display this help and exit\n"); +#else + fprintf (file, " -i INDEX (index) display the INDEX face of each font file only\n"); + fprintf (file, " -l LANG (lang) set LANG instead of current locale\n"); + fprintf (file, " -v (verbose) show more detailed information\n"); + fprintf (file, " -V (version) display font config version and exit\n"); + fprintf (file, " -h (help) display this help and exit\n"); +#endif + exit (error); +} + +int +main (int argc, char **argv) +{ + int index_set = 0; + int set_index = 0; + FcChar8 *lang = NULL; + const FcCharSet *fcs_lang = NULL; + int err = 0; + int i; + FT_Library ftlib; + FcBool verbose = FcFalse; +#if HAVE_GETOPT_LONG || HAVE_GETOPT + int c; + + setlocale (LC_ALL, ""); + +#if HAVE_GETOPT_LONG + while ((c = getopt_long (argc, argv, "i:l:mVhv", longopts, NULL)) != -1) +#else + while ((c = getopt (argc, argv, "i:l:mVhv")) != -1) +#endif + { + switch (c) { + case 'i': + index_set = 1; + set_index = atoi (optarg); + break; + case 'l': + lang = (FcChar8 *) FcLangNormalize ((const FcChar8 *) optarg); + break; + case 'v': + verbose = FcTrue; + break; + case 'V': + fprintf (stderr, "fontconfig version %d.%d.%d\n", + FC_MAJOR, FC_MINOR, FC_REVISION); + exit (0); + case 'h': + usage (argv[0], 0); + default: + usage (argv[0], 1); + } + } + i = optind; +#else + i = 1; + verbose = FcTrue; +#endif + + if (i == argc) + usage (argv[0], 1); + + if (!lang) + lang = FcLangNormalize ((const FcChar8 *) setlocale (LC_CTYPE, NULL)); + + if (lang) + fcs_lang = FcLangGetCharSet (lang); + + if (FT_Init_FreeType (&ftlib)) + { + fprintf (stderr, "Can't initalize FreeType library\n"); + return 1; + } + + for (; i < argc; i++) + { + int index; + + index = set_index; + + do { + FT_Face face; + FcCharSet *fcs, *fcs_sub; + + if (FT_New_Face (ftlib, argv[i], index, &face)) + { + if (!index_set && index > 0) + break; + fprintf (stderr, "Unable to open %s\n", argv[i]); + err = 1; + } + else + { + FcChar32 count; + + fcs = FcFreeTypeCharSet (face, NULL); + fcs_sub = FcCharSetSubtract (fcs_lang, fcs); + + count = FcCharSetCount (fcs_sub); + if (count > 0) + { + FcChar32 ucs4, pos, map[FC_CHARSET_MAP_SIZE]; + + printf ("%s:%d Missing %d glyph(s) to satisfy the coverage for %s language\n", + argv[i], index, count, lang); + + if (verbose) + { + for (ucs4 = FcCharSetFirstPage (fcs_sub, map, &pos); + ucs4 != FC_CHARSET_DONE; + ucs4 = FcCharSetNextPage (fcs_sub, map, &pos)) + { + int j; + + for (j = 0; j < FC_CHARSET_MAP_SIZE; j++) + { + FcChar32 bits = map[j]; + FcChar32 base = ucs4 + j * 32; + int b = 0; + + while (bits) + { + if (bits & 1) + printf (" 0x%04x\n", base + b); + bits >>= 1; + b++; + } + } + } + } + } + else + { + printf ("%s:%d Satisfy the coverage for %s language\n", argv[i], index, lang); + } + + FcCharSetDestroy (fcs); + FcCharSetDestroy (fcs_sub); + + FT_Done_Face (face); + } + + index++; + } while (index_set == 0); + } + + FT_Done_FreeType (ftlib); + + if (lang) + FcStrFree (lang); + + FcFini (); + return err; +} diff --git a/fontconfig/fc-validate/fc-validate.sgml b/fontconfig/fc-validate/fc-validate.sgml new file mode 100644 index 000000000..c677ef292 --- /dev/null +++ b/fontconfig/fc-validate/fc-validate.sgml @@ -0,0 +1,182 @@ + manpage.1'. You may view + the manual page with: `docbook-to-man manpage.sgml | nroff -man | + less'. A typical entry in a Makefile or Makefile.am is: + +manpage.1: manpage.sgml + docbook-to-man $< > $@ + + + The docbook-to-man binary is found in the docbook-to-man package. + Please remember that if you create the nroff version in one of the + debian/rules file targets (such as build), you will need to include + docbook-to-man in your Build-Depends control field. + + --> + + + Akira"> + TAGOH"> + + Sep 10, 2012"> + + 1"> + akira@tagoh.org"> + + fc-validate"> + + + GNU"> + GPL"> +]> + + + +
+ &dhemail; +
+ + &dhfirstname; + &dhsurname; + + + 2012 + &dhusername; + + &dhdate; +
+ + &dhucpackage; + + &dhsection; + + + &dhpackage; + + validate font files + + + + &dhpackage; + + + + + + + + + + + + + + + + + + + + DESCRIPTION + + &dhpackage; validates + font-file(s) if each fonts satisfies + the language coverage according to the orthography files in fontconfig. + If is given, only one face of each file is + validated, otherwise all faces are validated. + + + + OPTIONS + + This program follows the usual &gnu; command line syntax, + with long options starting with two dashes (`-'). A summary of + options is included below. + + + + + + + + + Only query face indexed index of + each file. + + + + + + + + + Set lang as a language instead of current locale. this is used for . + + + + + + + + Show more detailed information. + + + + + + + + Show version of the program and exit. + + + + + + + + Show summary of options. + + + + + + + Query font-file for font faces. + + + + + + + RETURN CODES + fc-validate returns error code 0 for successful parsing, + or 1 if any errors occured or if at least one font face could not be opened. + + + + AUTHOR + + This manual page was updated by &dhusername; &dhemail;. + + +
+ + diff --git a/fontconfig/fontconfig/fontconfig.h b/fontconfig/fontconfig/fontconfig.h index 1af63abfb..52e9438fe 100644 --- a/fontconfig/fontconfig/fontconfig.h +++ b/fontconfig/fontconfig/fontconfig.h @@ -52,7 +52,7 @@ typedef int FcBool; #define FC_MAJOR 2 #define FC_MINOR 10 -#define FC_REVISION 2 +#define FC_REVISION 91 #define FC_VERSION ((FC_MAJOR * 10000) + (FC_MINOR * 100) + (FC_REVISION)) @@ -580,6 +580,9 @@ FcInitBringUptoDate (void); FcPublic FcStrSet * FcGetLangs (void); +FcPublic FcChar8 * +FcLangNormalize (const FcChar8 *lang); + FcPublic const FcCharSet * FcLangGetCharSet (const FcChar8 *lang); diff --git a/fontconfig/new-version.sh b/fontconfig/new-version.sh index 3c620ae4c..39514302e 100644 --- a/fontconfig/new-version.sh +++ b/fontconfig/new-version.sh @@ -71,8 +71,8 @@ if [ $version != $last ]; then # header # (sed '/^2\.[0-9.]*/,$d' README | - sed -e "s/Version.*/Version $version_note/" \ - -e "s/200.*/$date/" | awk ' + sed -r -e "s/Version.*/Version $version_note/" \ + -e "s/[0-9]{4}\-[0-9]{2}\-[0-9]{2}$/$date/" | awk ' /^[ \t]/ { gsub ("^[ \t]*", ""); gsub ("[ \t]*$", ""); diff --git a/fontconfig/src/fcatomic.h b/fontconfig/src/fcatomic.h index 72ae37280..a76431139 100644 --- a/fontconfig/src/fcatomic.h +++ b/fontconfig/src/fcatomic.h @@ -87,6 +87,18 @@ typedef int fc_atomic_int_t; #define fc_atomic_ptr_cmpexch(P,O,N) __sync_bool_compare_and_swap ((P), (O), (N)) +#elif !defined(FC_NO_MT) && defined(HAVE_SOLARIS_ATOMIC_OPS) + +#include +#include + +typedef unsigned int fc_atomic_int_t; +#define fc_atomic_int_add(AI, V) ( ({__machine_rw_barrier ();}), atomic_add_int_nv (&(AI), (V)) - (V)) + +#define fc_atomic_ptr_get(P) ( ({__machine_rw_barrier ();}), (void *) *(P)) +#define fc_atomic_ptr_cmpexch(P,O,N) ( ({__machine_rw_barrier ();}), atomic_cas_ptr ((P), (O), (N)) == (void *) (O) ? FcTrue : FcFalse) + + #elif !defined(FC_NO_MT) #define FC_ATOMIC_INT_NIL 1 /* Warn that fallback implementation is in use. */ diff --git a/fontconfig/src/fcint.h b/fontconfig/src/fcint.h index 3883bc96e..512926797 100644 --- a/fontconfig/src/fcint.h +++ b/fontconfig/src/fcint.h @@ -817,9 +817,6 @@ FcPrivate FcLangSet * FcFreeTypeLangSet (const FcCharSet *charset, const FcChar8 *exclusiveLang); -FcPrivate FcChar8 * -FcLangNormalize (const FcChar8 *lang); - FcPrivate FcLangResult FcLangCompare (const FcChar8 *s1, const FcChar8 *s2); diff --git a/fontconfig/src/fcstr.c b/fontconfig/src/fcstr.c index cdab38397..414d6dd6b 100644 --- a/fontconfig/src/fcstr.c +++ b/fontconfig/src/fcstr.c @@ -1217,6 +1217,17 @@ FcStrSetDel (FcStrSet *set, const FcChar8 *s) return FcFalse; } +/* TODO Make public */ +static FcStrSet * +FcStrSetReference (FcStrSet *set) +{ + if (FcRefIsConst (&set->ref)) + return set; + + FcRefInc (&set->ref); + return set; +} + void FcStrSetDestroy (FcStrSet *set) { @@ -1245,7 +1256,7 @@ FcStrListCreate (FcStrSet *set) if (!list) return 0; list->set = set; - FcRefInc (&set->ref); + FcStrSetReference (set); list->n = 0; return list; } diff --git a/fontconfig/test/Makefile.am b/fontconfig/test/Makefile.am index 3fd343a24..664138a5b 100644 --- a/fontconfig/test/Makefile.am +++ b/fontconfig/test/Makefile.am @@ -4,6 +4,17 @@ TESTS=run-test.sh TESTDATA=4x6.pcf 8x16.pcf out.expected fonts.conf.in +AM_CPPFLAGS = -I$(top_srcdir) -I$(top_builddir) + +if HAVE_PTHREAD +check_PROGRAMS = test-pthread +noinst_PROGRAMS = $(check_PROGRAMS) +test_pthread_LDADD = $(top_builddir)/src/libfontconfig.la +# We don't enable this test by default because it will require config and fonts +# to meaningfully test anything, and we are not installed yet. +#TESTS += test-pthread +endif + EXTRA_DIST=$(check_SCRIPTS) $(TESTDATA) CLEANFILES= diff --git a/fontconfig/test/test-pthread.c b/fontconfig/test/test-pthread.c new file mode 100644 index 000000000..7701a24f7 --- /dev/null +++ b/fontconfig/test/test-pthread.c @@ -0,0 +1,79 @@ +/* Code originally from Raimund Steger. */ + +#include +#include +#include +#include +#include + +#define NTHR 100 +#define NTEST 100 + +struct thr_arg_s +{ + int thr_num; +}; + +static void test_match(int thr_num,int test_num) +{ + FcPattern *pat; + FcPattern *match; + FcResult result; + + FcInit(); + + pat = FcNameParse((const FcChar8 *)"New Century Schoolbook"); + + FcConfigSubstitute(0,pat,FcMatchPattern); + FcDefaultSubstitute(pat); + + match = FcFontMatch(0,pat,&result); + + FcPatternDestroy(pat); + FcPatternDestroy(match); +} + +static void *run_test_in_thread(void *arg) +{ + struct thr_arg_s *thr_arg=(struct thr_arg_s *)arg; + int thread_num = thr_arg->thr_num; + int i=0; + + for(;i