Bug 792105 - Startup takes several minutes, take two.

First, remove the unnecessary locale push & pop on <CT_TIME64>load.

Second, the registry accesses were caused by using g_win32_get_locale
to convert the Microsoft locale strings to POSIX ones. We don't care
what kind of string we get as long as we can pass it back to setlocale,
so remove that.

Third, gnc_push/pop_locale were used only in backend/dbi in a
very limited way and did much more than was necessary, so
convert them to C++ inlines in gnc-backend-dbi.hpp that does
only what we need them to.
This commit is contained in:
John Ralls
2018-04-17 16:27:24 -07:00
parent 39aecb7610
commit cad6bb4272
6 changed files with 24 additions and 73 deletions

View File

@@ -150,43 +150,3 @@ gnc_locale_decimal_places (void)
return places;
}
static GList *locale_stack = NULL;
void
gnc_push_locale (int category, const char *locale)
{
char *saved_locale;
g_return_if_fail (locale != NULL);
# ifdef G_OS_WIN32
/* On win32, setlocale() doesn't say anything useful. Use
glib's function instead. */
saved_locale = g_win32_getlocale();
# else
saved_locale = g_strdup(setlocale(category, NULL) ?
setlocale(category, NULL) : "C");
#endif
locale_stack = g_list_prepend (locale_stack, saved_locale);
setlocale (category, locale);
}
void
gnc_pop_locale (int category)
{
char *saved_locale;
GList *node;
g_return_if_fail (locale_stack != NULL);
node = locale_stack;
saved_locale = node->data;
setlocale (category, saved_locale);
locale_stack = g_list_remove_link (locale_stack, node);
g_list_free_1 (node);
g_free (saved_locale);
}