summaryrefslogtreecommitdiff
path: root/pango
diff options
context:
space:
mode:
Diffstat (limited to 'pango')
-rw-r--r--pango/break.c11
-rw-r--r--pango/modules.c8
-rw-r--r--pango/pango-context.c13
-rw-r--r--pango/pango-fontmap.c8
-rw-r--r--pango/pango-ot-ruleset.c6
-rw-r--r--pango/pango-renderer.c2
-rw-r--r--pango/pango-utils.c2
-rw-r--r--pango/pangocairo-context.c2
-rw-r--r--pango/pangocairo-font.c4
-rw-r--r--pango/pangocairo-render.c2
-rw-r--r--pango/pangocoretext-fontmap.c14
-rw-r--r--pango/pangofc-font.c11
-rw-r--r--pango/pangoft2-fontmap.c2
-rw-r--r--pango/pangoft2.c6
-rw-r--r--pango/pangowin32-fontmap.c4
-rw-r--r--pango/pangowin32.c13
-rw-r--r--pango/querymodules.c4
-rw-r--r--pango/shape.c2
18 files changed, 55 insertions, 59 deletions
diff --git a/pango/break.c b/pango/break.c
index 58d57d4b..c624fbe3 100644
--- a/pango/break.c
+++ b/pango/break.c
@@ -1871,8 +1871,8 @@ pango_get_log_attrs (const char *text,
const char *range_start, *range_end;
PangoScript script;
PangoEngineLang *range_engine;
- static guint engine_type_id = 0;
- static guint render_type_id = 0;
+ static guint engine_type_id = 0; /* MT-safe */
+ static guint render_type_id = 0; /* MT-safe */
PangoAnalysis analysis = { NULL };
PangoScriptIter iter;
@@ -1884,10 +1884,9 @@ pango_get_log_attrs (const char *text,
pango_default_break (text, length, &analysis, log_attrs, attrs_len);
if (engine_type_id == 0)
- {
- engine_type_id = g_quark_from_static_string (PANGO_ENGINE_TYPE_LANG);
- render_type_id = g_quark_from_static_string (PANGO_RENDER_TYPE_NONE);
- }
+ engine_type_id = g_quark_from_static_string (PANGO_ENGINE_TYPE_LANG);
+ if (render_type_id == 0)
+ render_type_id = g_quark_from_static_string (PANGO_RENDER_TYPE_NONE);
lang_map = pango_find_map (language, engine_type_id, render_type_id);
diff --git a/pango/modules.c b/pango/modules.c
index 4046d235..1fbd58de 100644
--- a/pango/modules.c
+++ b/pango/modules.c
@@ -106,7 +106,7 @@ static GType pango_module_get_type (void);
static GQuark
get_warned_quark (void)
{
- static GQuark warned_quark = 0;
+ static GQuark warned_quark = 0; /* MT-safe */
if (G_UNLIKELY (!warned_quark))
warned_quark = g_quark_from_static_string ("pango-module-warned");
@@ -382,8 +382,8 @@ script_from_string (const char *str)
{
static GEnumClass *class = NULL;
GEnumValue *value;
- if (!class)
- class = g_type_class_ref (PANGO_TYPE_SCRIPT);
+ if (g_once_init_enter (&class))
+ g_once_init_leave (&class, g_type_class_ref (PANGO_TYPE_SCRIPT));
value = g_enum_get_value_by_nick (class, str);
if (!value)
@@ -652,7 +652,7 @@ build_map (PangoMapInfo *info)
if (!dlloaded_engines && !registered_engines)
{
- static gboolean no_module_warning = FALSE;
+ static gboolean no_module_warning = FALSE; /* MT-safe */
if (!no_module_warning)
{
gchar *filename = g_build_filename (pango_get_sysconf_subdirectory (),
diff --git a/pango/pango-context.c b/pango/pango-context.c
index 97cb2786..2a100e94 100644
--- a/pango/pango-context.c
+++ b/pango/pango-context.c
@@ -590,7 +590,7 @@ get_shaper_font_cache (PangoFontset *fontset)
{
ShaperFontCache *cache;
- static GQuark cache_quark = 0;
+ static GQuark cache_quark = 0; /* MT-safe */
if (G_UNLIKELY (!cache_quark))
cache_quark = g_quark_from_static_string ("pango-shaper-font-cache");
@@ -1275,14 +1275,13 @@ compute_derived_language (PangoLanguage *lang,
static PangoMap *
get_lang_map (PangoLanguage *lang)
{
- static guint engine_type_id = 0;
- static guint render_type_id = 0;
+ static guint engine_type_id = 0; /* MT-safe */
+ static guint render_type_id = 0; /* MT-safe */
if (engine_type_id == 0)
- {
- engine_type_id = g_quark_from_static_string (PANGO_ENGINE_TYPE_LANG);
- render_type_id = g_quark_from_static_string (PANGO_RENDER_TYPE_NONE);
- }
+ engine_type_id = g_quark_from_static_string (PANGO_ENGINE_TYPE_LANG);
+ if (render_type_id == 0)
+ render_type_id = g_quark_from_static_string (PANGO_RENDER_TYPE_NONE);
return pango_find_map (lang, engine_type_id, render_type_id);
}
diff --git a/pango/pango-fontmap.c b/pango/pango-fontmap.c
index f6352828..6e90ada1 100644
--- a/pango/pango-fontmap.c
+++ b/pango/pango-fontmap.c
@@ -164,7 +164,8 @@ pango_font_map_real_load_fontset (PangoFontMap *fontmap,
char **families;
int i;
PangoFontsetSimple *fonts;
- static GHashTable *warned_fonts = NULL;
+ static GHashTable *warned_fonts = NULL; /* MT-safe */
+ G_LOCK_DEFINE_STATIC (warned_fonts);
family = pango_font_description_get_family (desc);
families = g_strsplit (family ? family : "", ",", -1);
@@ -193,6 +194,7 @@ pango_font_map_real_load_fontset (PangoFontMap *fontmap,
ctmp1 = pango_font_description_to_string (desc);
pango_font_description_set_family_static (tmp_desc, "Sans");
+ G_LOCK (warned_fonts);
if (!warned_fonts || !g_hash_table_lookup (warned_fonts, ctmp1))
{
if (!warned_fonts)
@@ -205,6 +207,7 @@ pango_font_map_real_load_fontset (PangoFontMap *fontmap,
"expect ugly output.", ctmp1, ctmp2);
g_free (ctmp2);
}
+ G_UNLOCK (warned_fonts);
g_free (ctmp1);
pango_font_map_fontset_add_fonts (fontmap,
@@ -227,6 +230,7 @@ pango_font_map_real_load_fontset (PangoFontMap *fontmap,
pango_font_description_set_variant (tmp_desc, PANGO_VARIANT_NORMAL);
pango_font_description_set_stretch (tmp_desc, PANGO_STRETCH_NORMAL);
+ G_LOCK (warned_fonts);
if (!warned_fonts || !g_hash_table_lookup (warned_fonts, ctmp1))
{
g_hash_table_insert (warned_fonts, g_strdup (ctmp1), GINT_TO_POINTER (1));
@@ -237,7 +241,7 @@ pango_font_map_real_load_fontset (PangoFontMap *fontmap,
"expect ugly output.", ctmp1, ctmp2);
g_free (ctmp2);
}
-
+ G_UNLOCK (warned_fonts);
g_free (ctmp1);
pango_font_map_fontset_add_fonts (fontmap,
diff --git a/pango/pango-ot-ruleset.c b/pango/pango-ot-ruleset.c
index 473647bb..93ba6174 100644
--- a/pango/pango-ot-ruleset.c
+++ b/pango/pango-ot-ruleset.c
@@ -68,10 +68,10 @@ const PangoOTRuleset *
pango_ot_ruleset_get_for_description (PangoOTInfo *info,
const PangoOTRulesetDescription *desc)
{
- static PangoOTRuleset *ruleset;
+ static PangoOTRuleset *ruleset; /* MT-safe */
- if (!ruleset)
- ruleset = g_object_new (PANGO_TYPE_OT_RULESET, NULL);
+ if (g_once_init_enter (&ruleset))
+ g_once_init_leave (&ruleset, g_object_new (PANGO_TYPE_OT_RULESET, NULL));
return ruleset;
}
diff --git a/pango/pango-renderer.c b/pango/pango-renderer.c
index 54161448..19d333d6 100644
--- a/pango/pango-renderer.c
+++ b/pango/pango-renderer.c
@@ -978,7 +978,7 @@ pango_renderer_default_draw_error_underline (PangoRenderer *renderer,
int square = height / HEIGHT_SQUARES;
int unit_width = (HEIGHT_SQUARES - 1) * square;
int width_units = (width + unit_width / 2) / unit_width;
- static const PangoMatrix identity = PANGO_MATRIX_INIT;
+ const PangoMatrix identity = PANGO_MATRIX_INIT;
const PangoMatrix *matrix;
double dx, dx0, dy0;
PangoMatrix total;
diff --git a/pango/pango-utils.c b/pango/pango-utils.c
index 88956057..0d138efc 100644
--- a/pango/pango-utils.c
+++ b/pango/pango-utils.c
@@ -684,7 +684,7 @@ pango_config_key_get (const char *key)
/* DllMain function needed to tuck away the DLL handle */
-static HMODULE pango_dll;
+static HMODULE pango_dll; /* MT-safe */
BOOL WINAPI
DllMain (HINSTANCE hinstDLL,
diff --git a/pango/pangocairo-context.c b/pango/pangocairo-context.c
index df1b889a..54cef064 100644
--- a/pango/pangocairo-context.c
+++ b/pango/pangocairo-context.c
@@ -62,7 +62,7 @@ static PangoCairoContextInfo *
get_context_info (PangoContext *context,
gboolean create)
{
- static GQuark context_info_quark;
+ static GQuark context_info_quark; /* MT-safe */
PangoCairoContextInfo *info;
if (G_UNLIKELY (!context_info_quark))
diff --git a/pango/pangocairo-font.c b/pango/pangocairo-font.c
index 2d5ee7fb..3b649595 100644
--- a/pango/pangocairo-font.c
+++ b/pango/pangocairo-font.c
@@ -92,7 +92,7 @@ done:
{
cairo_scaled_font_t *scaled_font = cf_priv->scaled_font;
PangoFont *font = PANGO_FONT (cf_priv->cfont);
- static GQuark warned_quark = 0;
+ static GQuark warned_quark = 0; /* MT-safe */
if (!warned_quark)
warned_quark = g_quark_from_static_string ("pangocairo-scaledfont-warned");
@@ -357,7 +357,7 @@ _pango_cairo_font_get_metrics (PangoFont *font,
static PangoCairoFontHexBoxInfo *
_pango_cairo_font_private_get_hex_box_info (PangoCairoFontPrivate *cf_priv)
{
- static const char hexdigits[] = "0123456789ABCDEF";
+ const char hexdigits[] = "0123456789ABCDEF";
char c[2] = {0, 0};
PangoFont *mini_font;
PangoCairoFontHexBoxInfo *hbi;
diff --git a/pango/pangocairo-render.c b/pango/pangocairo-render.c
index 2a66c7cf..b9ee221f 100644
--- a/pango/pangocairo-render.c
+++ b/pango/pangocairo-render.c
@@ -698,7 +698,7 @@ pango_cairo_renderer_class_init (PangoCairoRendererClass *klass)
renderer_class->draw_shape = pango_cairo_renderer_draw_shape;
}
-static PangoCairoRenderer *cached_renderer = NULL;
+static PangoCairoRenderer *cached_renderer = NULL; /* MT-safe */
G_LOCK_DEFINE_STATIC (cached_renderer);
static PangoCairoRenderer *
diff --git a/pango/pangocoretext-fontmap.c b/pango/pangocoretext-fontmap.c
index 034d0507..6f68d62e 100644
--- a/pango/pangocoretext-fontmap.c
+++ b/pango/pangocoretext-fontmap.c
@@ -111,8 +111,8 @@ typedef struct
PangoWeight weight;
} PangoCTWeight;
-static const float ct_weight_min = -1.00f;
-static const float ct_weight_max = 1.00f;
+const float ct_weight_min = -1.00f;
+const float ct_weight_max = 1.00f;
static const PangoCTWeight ct_weight_limits[] = {
{ -0.70, PANGO_WEIGHT_THIN},
@@ -780,7 +780,7 @@ get_context_matrix (PangoContext *context,
PangoMatrix *matrix)
{
const PangoMatrix *set_matrix;
- static const PangoMatrix identity = PANGO_MATRIX_INIT;
+ const PangoMatrix identity = PANGO_MATRIX_INIT;
if (context)
set_matrix = pango_context_get_matrix (context);
@@ -1275,7 +1275,7 @@ pango_core_text_font_map_load_fontset (PangoFontMap *fontmap,
PangoCoreTextFontset *fontset;
PangoCoreTextFontsetKey key;
PangoCoreTextFontMap *ctfontmap = PANGO_CORE_TEXT_FONT_MAP (fontmap);
- static gboolean warned_full_fallback = FALSE;
+ static gboolean warned_full_fallback = FALSE; /* MT-safe */
pango_core_text_fontset_key_init (&key, ctfontmap,
context, desc, language);
@@ -1492,8 +1492,6 @@ struct _PangoCoreTextFontset
typedef PangoFontsetClass PangoCoreTextFontsetClass;
-static PangoFontsetClass *core_text_fontset_parent_class;
-
/* This symbol does exist in the CoreText library shipped with Snow
* Leopard and Lion, however, it is not found in the public header files.
@@ -1619,8 +1617,6 @@ pango_core_text_fontset_class_init (PangoCoreTextFontsetClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
PangoFontsetClass *fontset_class = PANGO_FONTSET_CLASS (klass);
- core_text_fontset_parent_class = g_type_class_peek_parent (klass);
-
object_class->finalize = pango_core_text_fontset_finalize;
fontset_class->get_font = pango_core_text_fontset_get_font;
@@ -1666,7 +1662,7 @@ pango_core_text_fontset_finalize (GObject *object)
if (ctfontset->key)
pango_core_text_fontset_key_free (ctfontset->key);
- G_OBJECT_CLASS (core_text_fontset_parent_class)->finalize (object);
+ G_OBJECT_CLASS (pango_core_text_fontset_parent_class)->finalize (object);
}
static PangoCoreTextFontsetKey *
diff --git a/pango/pangofc-font.c b/pango/pangofc-font.c
index 66513057..f45298ab 100644
--- a/pango/pangofc-font.c
+++ b/pango/pangofc-font.c
@@ -300,14 +300,13 @@ pango_fc_font_describe_absolute (PangoFont *font)
static PangoMap *
pango_fc_get_shaper_map (PangoLanguage *language)
{
- static guint engine_type_id = 0;
- static guint render_type_id = 0;
+ static guint engine_type_id = 0; /* MT-safe */
+ static guint render_type_id = 0; /* MT-safe */
if (engine_type_id == 0)
- {
- engine_type_id = g_quark_from_static_string (PANGO_ENGINE_TYPE_SHAPE);
- render_type_id = g_quark_from_static_string (PANGO_RENDER_TYPE_FC);
- }
+ engine_type_id = g_quark_from_static_string (PANGO_ENGINE_TYPE_SHAPE);
+ if (render_type_id == 0)
+ render_type_id = g_quark_from_static_string (PANGO_RENDER_TYPE_FC);
return pango_find_map (language, engine_type_id, render_type_id);
}
diff --git a/pango/pangoft2-fontmap.c b/pango/pangoft2-fontmap.c
index c3a8439b..662b8ad9 100644
--- a/pango/pangoft2-fontmap.c
+++ b/pango/pangoft2-fontmap.c
@@ -67,7 +67,7 @@ static PangoFcFont * pango_ft2_font_map_new_font (PangoFcFontMap
static double pango_ft2_font_map_get_resolution (PangoFcFontMap *fcfontmap,
PangoContext *context);
-static PangoFT2FontMap *pango_ft2_global_fontmap = NULL;
+static PangoFT2FontMap *pango_ft2_global_fontmap = NULL; /* MT-safe */
G_DEFINE_TYPE (PangoFT2FontMap, pango_ft2_font_map, PANGO_TYPE_FC_FONT_MAP)
diff --git a/pango/pangoft2.c b/pango/pangoft2.c
index b41c468a..88a91740 100644
--- a/pango/pangoft2.c
+++ b/pango/pangoft2.c
@@ -542,10 +542,10 @@ _pango_ft2_ft_strerror (FT_Error error)
return found->msg;
else
{
- static char *default_msg = NULL;
+ static char *default_msg = NULL; /* MT-safe */
- if (!default_msg)
- default_msg = g_malloc (60);
+ if (g_once_init_enter (&default_msg))
+ g_once_init_leve (&default_msg, g_malloc (60));
g_sprintf (default_msg, "Unknown FreeType2 error %#x", error);
return default_msg;
diff --git a/pango/pangowin32-fontmap.c b/pango/pangowin32-fontmap.c
index 36456fcf..61e1460f 100644
--- a/pango/pangowin32-fontmap.c
+++ b/pango/pangowin32-fontmap.c
@@ -95,7 +95,7 @@ static PangoWin32Family *pango_win32_get_font_family (PangoWin32FontMap
static const char *pango_win32_face_get_face_name (PangoFontFace *face);
-static PangoWin32FontMap *default_fontmap = NULL;
+static PangoWin32FontMap *default_fontmap = NULL; /* MT-safe */
G_DEFINE_TYPE (PangoWin32FontMap, _pango_win32_font_map, PANGO_TYPE_FONT_MAP)
@@ -307,7 +307,7 @@ struct PangoAlias
gboolean visible; /* Do we want/need this? */
};
-static GHashTable *pango_aliases_ht = NULL;
+static GHashTable *pango_aliases_ht = NULL; /* MT-unsafe */
static guint
alias_hash (struct PangoAlias *alias)
diff --git a/pango/pangowin32.c b/pango/pangowin32.c
index 30ec8b6f..a1594266 100644
--- a/pango/pangowin32.c
+++ b/pango/pangowin32.c
@@ -862,14 +862,13 @@ pango_win32_font_describe_absolute (PangoFont *font)
static PangoMap *
pango_win32_get_shaper_map (PangoLanguage *lang)
{
- static guint engine_type_id = 0;
- static guint render_type_id = 0;
+ static guint engine_type_id = 0; /* MT-safe */
+ static guint render_type_id = 0; /* MT-safe */
if (engine_type_id == 0)
- {
- engine_type_id = g_quark_from_static_string (PANGO_ENGINE_TYPE_SHAPE);
- render_type_id = g_quark_from_static_string (PANGO_RENDER_TYPE_WIN32);
- }
+ engine_type_id = g_quark_from_static_string (PANGO_ENGINE_TYPE_SHAPE);
+ if (render_type_id == 0)
+ render_type_id = g_quark_from_static_string (PANGO_RENDER_TYPE_WIN32);
return pango_find_map (lang, engine_type_id, render_type_id);
}
@@ -1323,7 +1322,7 @@ find_segment (struct format_4_cmap *table,
guint16 seg_count = table->seg_count_x_2/2;
guint16 *end_count = get_end_count (table);
guint16 *start_count = get_start_count (table);
- static guint last = 0; /* Cache of one */
+ static guint last = 0; /* Cache of one */ /* MT-safe */
if (last < seg_count &&
wc >= start_count[last] &&
diff --git a/pango/querymodules.c b/pango/querymodules.c
index 4133ef92..549003fb 100644
--- a/pango/querymodules.c
+++ b/pango/querymodules.c
@@ -44,7 +44,7 @@
#endif
#define SOEXT_LEN ((int) strlen (SOEXT))
-static gboolean system_mode;
+static gboolean system_mode; /* MT-safe as we're single-threaded! */
static gboolean
string_needs_escape (const char *str)
@@ -97,7 +97,7 @@ escape_string (const char *str)
static const char *
string_from_script (PangoScript script)
{
- static GEnumClass *class = NULL;
+ static GEnumClass *class = NULL; /* MT-safe as we're single-threaded! */
GEnumValue *value;
if (!class)
class = g_type_class_ref (PANGO_TYPE_SCRIPT);
diff --git a/pango/shape.c b/pango/shape.c
index 1513b028..0fe3c953 100644
--- a/pango/shape.c
+++ b/pango/shape.c
@@ -148,7 +148,7 @@ pango_shape (const gchar *text,
glyphs->log_clusters[0] < glyphs->log_clusters[glyphs->num_glyphs - 1]))
{
/* Warn once per shaper */
- static GQuark warned_quark = 0;
+ static GQuark warned_quark = 0; /* MT-safe */
if (!warned_quark)
warned_quark = g_quark_from_static_string ("pango-shape-warned");