From 0c9c94c6e1fb94dfad446a59d8fc9313efacac1f Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Tue, 23 Oct 2001 09:26:54 +0000 Subject: [PATCH] Remove G_HARDCODED_PATH_WRAPPER, Owen didn't like it. 2001-10-23 Tor Lillqvist * glib/gutils.h: Remove G_HARDCODED_PATH_WRAPPER, Owen didn't like it. * glib/gutils.c: Instead, expand it on Win32 as _glib_get_locale_dir(), and #define GLIB_LOCALE_DIR as a call to it. --- ChangeLog | 11 ++++++++++- ChangeLog.pre-2-0 | 11 ++++++++++- ChangeLog.pre-2-10 | 11 ++++++++++- ChangeLog.pre-2-12 | 11 ++++++++++- ChangeLog.pre-2-2 | 11 ++++++++++- ChangeLog.pre-2-4 | 11 ++++++++++- ChangeLog.pre-2-6 | 11 ++++++++++- ChangeLog.pre-2-8 | 11 ++++++++++- glib/gutils.c | 21 +++++++++++++++++++-- glib/gutils.h | 43 ------------------------------------------- 10 files changed, 99 insertions(+), 53 deletions(-) diff --git a/ChangeLog b/ChangeLog index 59ac36c64..97471e7e4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2001-10-23 Tor Lillqvist + + * glib/gutils.h: Remove G_HARDCODED_PATH_WRAPPER, Owen didn't like + it. + + * glib/gutils.c: Instead, expand it on Win32 as + _glib_get_locale_dir(), and #define GLIB_LOCALE_DIR as a call to + it. + 2001-10-23 Tor Lillqvist * config.h.win32.in: Typo. @@ -13,7 +22,7 @@ G_HARDCODED_PATH_WRAPPER. These are used to avoid hardcoding path names into Windows DLLs. - * glib/gutils.c: Use them for GLIB_LOCALEDIR. + * glib/gutils.c: Use them for GLIB_LOCALE_DIR. * glib/gwin32.c (get_package_directory_from_module): Plug a small memory leak. Minor code reordering. diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index 59ac36c64..97471e7e4 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,12 @@ +2001-10-23 Tor Lillqvist + + * glib/gutils.h: Remove G_HARDCODED_PATH_WRAPPER, Owen didn't like + it. + + * glib/gutils.c: Instead, expand it on Win32 as + _glib_get_locale_dir(), and #define GLIB_LOCALE_DIR as a call to + it. + 2001-10-23 Tor Lillqvist * config.h.win32.in: Typo. @@ -13,7 +22,7 @@ G_HARDCODED_PATH_WRAPPER. These are used to avoid hardcoding path names into Windows DLLs. - * glib/gutils.c: Use them for GLIB_LOCALEDIR. + * glib/gutils.c: Use them for GLIB_LOCALE_DIR. * glib/gwin32.c (get_package_directory_from_module): Plug a small memory leak. Minor code reordering. diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 59ac36c64..97471e7e4 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,12 @@ +2001-10-23 Tor Lillqvist + + * glib/gutils.h: Remove G_HARDCODED_PATH_WRAPPER, Owen didn't like + it. + + * glib/gutils.c: Instead, expand it on Win32 as + _glib_get_locale_dir(), and #define GLIB_LOCALE_DIR as a call to + it. + 2001-10-23 Tor Lillqvist * config.h.win32.in: Typo. @@ -13,7 +22,7 @@ G_HARDCODED_PATH_WRAPPER. These are used to avoid hardcoding path names into Windows DLLs. - * glib/gutils.c: Use them for GLIB_LOCALEDIR. + * glib/gutils.c: Use them for GLIB_LOCALE_DIR. * glib/gwin32.c (get_package_directory_from_module): Plug a small memory leak. Minor code reordering. diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index 59ac36c64..97471e7e4 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,3 +1,12 @@ +2001-10-23 Tor Lillqvist + + * glib/gutils.h: Remove G_HARDCODED_PATH_WRAPPER, Owen didn't like + it. + + * glib/gutils.c: Instead, expand it on Win32 as + _glib_get_locale_dir(), and #define GLIB_LOCALE_DIR as a call to + it. + 2001-10-23 Tor Lillqvist * config.h.win32.in: Typo. @@ -13,7 +22,7 @@ G_HARDCODED_PATH_WRAPPER. These are used to avoid hardcoding path names into Windows DLLs. - * glib/gutils.c: Use them for GLIB_LOCALEDIR. + * glib/gutils.c: Use them for GLIB_LOCALE_DIR. * glib/gwin32.c (get_package_directory_from_module): Plug a small memory leak. Minor code reordering. diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index 59ac36c64..97471e7e4 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,12 @@ +2001-10-23 Tor Lillqvist + + * glib/gutils.h: Remove G_HARDCODED_PATH_WRAPPER, Owen didn't like + it. + + * glib/gutils.c: Instead, expand it on Win32 as + _glib_get_locale_dir(), and #define GLIB_LOCALE_DIR as a call to + it. + 2001-10-23 Tor Lillqvist * config.h.win32.in: Typo. @@ -13,7 +22,7 @@ G_HARDCODED_PATH_WRAPPER. These are used to avoid hardcoding path names into Windows DLLs. - * glib/gutils.c: Use them for GLIB_LOCALEDIR. + * glib/gutils.c: Use them for GLIB_LOCALE_DIR. * glib/gwin32.c (get_package_directory_from_module): Plug a small memory leak. Minor code reordering. diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 59ac36c64..97471e7e4 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,12 @@ +2001-10-23 Tor Lillqvist + + * glib/gutils.h: Remove G_HARDCODED_PATH_WRAPPER, Owen didn't like + it. + + * glib/gutils.c: Instead, expand it on Win32 as + _glib_get_locale_dir(), and #define GLIB_LOCALE_DIR as a call to + it. + 2001-10-23 Tor Lillqvist * config.h.win32.in: Typo. @@ -13,7 +22,7 @@ G_HARDCODED_PATH_WRAPPER. These are used to avoid hardcoding path names into Windows DLLs. - * glib/gutils.c: Use them for GLIB_LOCALEDIR. + * glib/gutils.c: Use them for GLIB_LOCALE_DIR. * glib/gwin32.c (get_package_directory_from_module): Plug a small memory leak. Minor code reordering. diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 59ac36c64..97471e7e4 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,12 @@ +2001-10-23 Tor Lillqvist + + * glib/gutils.h: Remove G_HARDCODED_PATH_WRAPPER, Owen didn't like + it. + + * glib/gutils.c: Instead, expand it on Win32 as + _glib_get_locale_dir(), and #define GLIB_LOCALE_DIR as a call to + it. + 2001-10-23 Tor Lillqvist * config.h.win32.in: Typo. @@ -13,7 +22,7 @@ G_HARDCODED_PATH_WRAPPER. These are used to avoid hardcoding path names into Windows DLLs. - * glib/gutils.c: Use them for GLIB_LOCALEDIR. + * glib/gutils.c: Use them for GLIB_LOCALE_DIR. * glib/gwin32.c (get_package_directory_from_module): Plug a small memory leak. Minor code reordering. diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 59ac36c64..97471e7e4 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,12 @@ +2001-10-23 Tor Lillqvist + + * glib/gutils.h: Remove G_HARDCODED_PATH_WRAPPER, Owen didn't like + it. + + * glib/gutils.c: Instead, expand it on Win32 as + _glib_get_locale_dir(), and #define GLIB_LOCALE_DIR as a call to + it. + 2001-10-23 Tor Lillqvist * config.h.win32.in: Typo. @@ -13,7 +22,7 @@ G_HARDCODED_PATH_WRAPPER. These are used to avoid hardcoding path names into Windows DLLs. - * glib/gutils.c: Use them for GLIB_LOCALEDIR. + * glib/gutils.c: Use them for GLIB_LOCALE_DIR. * glib/gwin32.c (get_package_directory_from_module): Plug a small memory leak. Minor code reordering. diff --git a/glib/gutils.c b/glib/gutils.c index 7fb0007ed..6727181b9 100644 --- a/glib/gutils.c +++ b/glib/gutils.c @@ -1093,8 +1093,25 @@ g_get_codeset (void) #include +#ifdef G_PLATFORM_WIN32 + G_WIN32_DLLMAIN_FOR_DLL_NAME (static, dll_name) -G_HARDCODED_PATH_WRAPPER (GLIB_LOCALE_DIR, GETTEXT_PACKAGE, _glib_get_locale_dir, dll_name, "lib/locale") + +static const gchar * +_glib_get_locale_dir (void) +{ + static const gchar *cache = NULL; + if (cache == NULL) + cache = g_win32_get_package_installation_subdirectory + (GETTEXT_PACKAGE, dll_name, "lib\\locale"); + + return cache; +} + +#undef GLIB_LOCALE_DIR +#define GLIB_LOCALE_DIR _glib_get_locale_dir () + +#endif /* G_PLATFORM_WIN32 */ G_CONST_RETURN gchar * _glib_gettext (const gchar *str) @@ -1103,7 +1120,7 @@ _glib_gettext (const gchar *str) if (!_glib_gettext_initialized) { - bindtextdomain(GETTEXT_PACKAGE, _glib_get_locale_dir ()); + bindtextdomain(GETTEXT_PACKAGE, GLIB_LOCALE_DIR); _glib_gettext_initialized = TRUE; } diff --git a/glib/gutils.h b/glib/gutils.h index e8dce6f37..5a69a2641 100644 --- a/glib/gutils.h +++ b/glib/gutils.h @@ -365,47 +365,4 @@ DllMain (HINSTANCE hinstDLL, \ } #endif /* G_PLATFORM_WIN32 */ -/* - * Expands to a function called FUNCTION that on non-Windows - * returns HARDCODED_VALUE. On Windows, deduce a pathname from - * the MODULE_NAME, PACKAGE and SUBDIR. If the code being compiled - * goes into a DLL, MODULE_NAME should be the dll_name passed to - * G_WIN32_DLLMAIN_FOR_DLL_NAME. If the code is for a .EXE, use NULL. - * - * An example: Wherever you would be tempted to write the name of a - * compile-time path macro, like FOOBAR_LIBDIR, instead use - * _get_foobar_libdir(). This requires you to insert in one place in - * your code something like this: - -G_WIN32_DLLMAIN_FOR_DLL_NAME(static, dll_name) -G_HARDCODED_PATH_WRAPPER(FOOBAR_LIBDIR, GETTEXT_PACKAGE, _get_foobar_libdir, dll_name, "lib") - - * This will on Windows define the DllMain function, and always define - * the _get_foobar_libdir() function. On Windows, this function - * calculates the value corresponding to FOOBAR_LIBDIR at run-time, on - * other systems it returns said constant, as configured before - * compilation. - */ - -#ifndef G_PLATFORM_WIN32 -# define G_HARDCODED_PATH_WRAPPER(hardcoded_value, package, function, module_name, subdir) \ -const gchar * \ -function (void) \ -{ \ - return hardcoded_value; \ -} -#else -# define G_HARDCODED_PATH_WRAPPER(hardcoded_value, package, function, module_name, subdir) \ -const gchar * \ -function (void) \ -{ \ - static char *cache = NULL; \ - if (cache == NULL) \ - cache = g_win32_get_package_installation_subdirectory \ - (package, module_name, subdir); \ - \ - return cache; \ -} -#endif - #endif /* __G_UTILS_H__ */ -- 2.34.1