[evolution-data-server] Bug 677933 - imapx_utils_init() called too early
- From: Matthew Barnes <mbarnes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evolution-data-server] Bug 677933 - imapx_utils_init() called too early
- Date: Tue, 12 Jun 2012 11:51:34 +0000 (UTC)
commit adf804da244ed2d29dc4bb0ffc1fc48cb170e6ce
Author: Matthew Barnes <mbarnes redhat com>
Date: Tue Jun 12 07:50:05 2012 -0400
Bug 677933 - imapx_utils_init() called too early
camel/camel-imapx-store.c | 2 +
camel/camel-imapx-utils.c | 51 +++++++++++++++-----------
camel/providers/imapx/camel-imapx-provider.c | 3 --
3 files changed, 32 insertions(+), 24 deletions(-)
---
diff --git a/camel/camel-imapx-store.c b/camel/camel-imapx-store.c
index da71fda..e847402 100644
--- a/camel/camel-imapx-store.c
+++ b/camel/camel-imapx-store.c
@@ -1771,5 +1771,7 @@ camel_imapx_store_init (CamelIMAPXStore *istore)
istore->last_refresh_time = time (NULL) - (FINFO_REFRESH_INTERVAL + 10);
istore->dir_sep = '/';
istore->con_man = camel_imapx_conn_manager_new (CAMEL_STORE (istore));
+
+ imapx_utils_init ();
}
diff --git a/camel/camel-imapx-utils.c b/camel/camel-imapx-utils.c
index 0b50d5d..856600a 100644
--- a/camel/camel-imapx-utils.c
+++ b/camel/camel-imapx-utils.c
@@ -1964,34 +1964,43 @@ guchar imapx_specials[256] = {
#define token_specials "\n*()[]+"
#define notid_specials "\x20\r\n()[]+"
-void imapx_utils_init (void)
+void
+imapx_utils_init (void)
{
- gint i;
- guchar v;
-
- for (i = 0; i < 128; i++) {
- v = 0;
- if (i >= 1 && i <= 0x7f) {
- v |= IMAPX_TYPE_CHAR;
- if (i != 0x0a && i != 0x0d) {
- v |= IMAPX_TYPE_TEXT_CHAR;
- if (i != '"' && i != '\\')
- v |= IMAPX_TYPE_QUOTED_CHAR;
+ static gsize imapx_utils_initialized = 0;
+
+ if (g_once_init_enter (&imapx_utils_initialized)) {
+ gint i;
+ guchar v;
+
+ for (i = 0; i < 128; i++) {
+ v = 0;
+ if (i >= 1 && i <= 0x7f) {
+ v |= IMAPX_TYPE_CHAR;
+ if (i != 0x0a && i != 0x0d) {
+ v |= IMAPX_TYPE_TEXT_CHAR;
+ if (i != '"' && i != '\\')
+ v |= IMAPX_TYPE_QUOTED_CHAR;
+ }
+ if (i> 0x20 && i <0x7f && strchr (atom_specials, i) == NULL)
+ v |= IMAPX_TYPE_ATOM_CHAR;
+ if (strchr (token_specials, i) != NULL)
+ v |= IMAPX_TYPE_TOKEN_CHAR;
+ if (strchr (notid_specials, i) != NULL)
+ v |= IMAPX_TYPE_NOTID_CHAR;
}
- if (i> 0x20 && i <0x7f && strchr (atom_specials, i) == NULL)
- v |= IMAPX_TYPE_ATOM_CHAR;
- if (strchr (token_specials, i) != NULL)
- v |= IMAPX_TYPE_TOKEN_CHAR;
- if (strchr (notid_specials, i) != NULL)
- v |= IMAPX_TYPE_NOTID_CHAR;
+
+ imapx_specials[i] = v;
}
- imapx_specials[i] = v;
+ camel_imapx_set_debug_flags ();
+
+ g_once_init_leave (&imapx_utils_initialized, 1);
}
- camel_imapx_set_debug_flags ();
}
-guchar imapx_is_mask (const gchar *p)
+guchar
+imapx_is_mask (const gchar *p)
{
guchar v = 0xff;
diff --git a/camel/providers/imapx/camel-imapx-provider.c b/camel/providers/imapx/camel-imapx-provider.c
index 649c346..427197b 100644
--- a/camel/providers/imapx/camel-imapx-provider.c
+++ b/camel/providers/imapx/camel-imapx-provider.c
@@ -115,9 +115,6 @@ camel_imapx_module_init (void)
imapx_provider.authtypes = g_list_prepend (imapx_provider.authtypes, &camel_imapx_password_authtype);
imapx_provider.translation_domain = GETTEXT_PACKAGE;
- /* TEMPORARY */
- imapx_utils_init ();
-
camel_provider_register (&imapx_provider);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]