summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessandro Pignotti <a.pignotti@sssup.it>2011-05-18 19:49:51 +0200
committerBehdad Esfahbod <behdad@behdad.org>2012-08-27 22:18:16 -0400
commitb47c2247e398bdb56f929a1144d6cc0b995233b0 (patch)
tree9f6e4b6c1054568fe3f40d64fc3790c5d9bb3685
parent8316111583488356b77ec8ea4e5249d902127b3b (diff)
downloadpango-b47c2247e398bdb56f929a1144d6cc0b995233b0.tar.gz
Make static data thread safe in pango-utils.c
-rw-r--r--pango/pango-utils.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/pango/pango-utils.c b/pango/pango-utils.c
index dbf06021..c753683c 100644
--- a/pango/pango-utils.c
+++ b/pango/pango-utils.c
@@ -719,19 +719,21 @@ pango_get_sysconf_subdirectory (void)
{
static const gchar *result = NULL;
- if (result == NULL)
+ if (g_once_init_enter ((gsize*)&result))
{
+ gchar *tmp_result = NULL;
#ifdef G_OS_WIN32
gchar *root = g_win32_get_package_installation_directory_of_module (pango_dll);
- result = g_build_filename (root, "etc\\pango", NULL);
+ tmp_result = g_build_filename (root, "etc\\pango", NULL);
g_free (root);
#else
const char *sysconfdir = g_getenv ("PANGO_SYSCONFDIR");
if (sysconfdir != NULL)
- result = g_build_filename (sysconfdir, "pango", NULL);
+ tmp_result = g_build_filename (sysconfdir, "pango", NULL);
else
- result = SYSCONFDIR "/pango";
+ tmp_result = SYSCONFDIR "/pango";
#endif
+ g_once_init_leave((gsize*)&result, (gsize)tmp_result);
}
return result;
}
@@ -752,25 +754,27 @@ pango_get_lib_subdirectory (void)
{
static const gchar *result = NULL;
- if (result == NULL)
+ if (g_once_init_enter ((gsize*)&result))
{
+ gchar *tmp_result = NULL;
#ifdef G_OS_WIN32
gchar *root = g_win32_get_package_installation_directory_of_module (pango_dll);
/* If we are running against an uninstalled copy of the Pango DLL,
* use the compile-time installation prefix.
*/
if (g_str_has_suffix (root, "\\.libs"))
- result = g_strdup (LIBDIR "/pango");
+ tmp_result = g_strdup (LIBDIR "/pango");
else
- result = g_build_filename (root, "lib\\pango", NULL);
+ tmp_result = g_build_filename (root, "lib\\pango", NULL);
g_free (root);
#else
const char *libdir = g_getenv ("PANGO_LIBDIR");
if (libdir != NULL)
- result = g_build_filename (libdir, "pango", NULL);
+ tmp_result = g_build_filename (libdir, "pango", NULL);
else
- result = LIBDIR "/pango";
+ tmp_result = LIBDIR "/pango";
#endif
+ g_once_init_leave((gsize*)&result, (gsize)tmp_result);
}
return result;
}