mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user