genviron: Remove old win32 codepage ABI compat code

Makes new code link against the normal symbol names again.
Variants with utf8 suffix are there for existing binaries/ABI compat.

https://bugzilla.gnome.org/show_bug.cgi?id=780634
This commit is contained in:
Christoph Reiter 2017-03-28 08:00:46 +02:00
parent d43b3d889a
commit b67d071321
2 changed files with 19 additions and 57 deletions

View File

@ -631,61 +631,39 @@ g_get_environ (void)
return result;
}
/* Win32 binary compatibility versions {{{1 */
#ifndef _WIN64
#endif /* G_OS_WIN32 */
#undef g_getenv
#ifdef G_OS_WIN32
/* Binary compatibility versions. Not for newly compiled code. */
_GLIB_EXTERN const gchar *g_getenv_utf8 (const gchar *variable);
_GLIB_EXTERN gboolean g_setenv_utf8 (const gchar *variable,
const gchar *value,
gboolean overwrite);
_GLIB_EXTERN void g_unsetenv_utf8 (const gchar *variable);
const gchar *
g_getenv (const gchar *variable)
g_getenv_utf8 (const gchar *variable)
{
gchar *utf8_variable = g_locale_to_utf8 (variable, -1, NULL, NULL, NULL);
const gchar *utf8_value = g_getenv_utf8 (utf8_variable);
gchar *value;
GQuark quark;
g_free (utf8_variable);
if (!utf8_value)
return NULL;
value = g_locale_from_utf8 (utf8_value, -1, NULL, NULL, NULL);
quark = g_quark_from_string (value);
g_free (value);
return g_quark_to_string (quark);
return g_getenv (variable);
}
#undef g_setenv
gboolean
g_setenv (const gchar *variable,
const gchar *value,
gboolean overwrite)
g_setenv_utf8 (const gchar *variable,
const gchar *value,
gboolean overwrite)
{
gchar *utf8_variable = g_locale_to_utf8 (variable, -1, NULL, NULL, NULL);
gchar *utf8_value = g_locale_to_utf8 (value, -1, NULL, NULL, NULL);
gboolean retval = g_setenv_utf8 (utf8_variable, utf8_value, overwrite);
g_free (utf8_variable);
g_free (utf8_value);
return retval;
return g_setenv (variable, value, overwrite);
}
#undef g_unsetenv
void
g_unsetenv (const gchar *variable)
g_unsetenv_utf8 (const gchar *variable)
{
gchar *utf8_variable = g_locale_to_utf8 (variable, -1, NULL, NULL, NULL);
g_unsetenv_utf8 (utf8_variable);
g_free (utf8_variable);
return g_unsetenv (variable);
}
#endif /* _WIN64 */
#endif /* G_OS_WIN32 */
#endif
/* Epilogue {{{1 */
/* vim: set foldmethod=marker: */

View File

@ -58,22 +58,6 @@ GLIB_AVAILABLE_IN_ALL
gchar ** g_environ_unsetenv (gchar **envp,
const gchar *variable) G_GNUC_WARN_UNUSED_RESULT;
#ifndef __GTK_DOC_IGNORE__
#ifdef G_OS_WIN32
#define g_getenv g_getenv_utf8
#define g_setenv g_setenv_utf8
#define g_unsetenv g_unsetenv_utf8
GLIB_AVAILABLE_IN_ALL
const gchar *g_getenv_utf8 (const gchar *variable);
GLIB_AVAILABLE_IN_ALL
gboolean g_setenv_utf8 (const gchar *variable,
const gchar *value,
gboolean overwrite);
GLIB_AVAILABLE_IN_ALL
void g_unsetenv_utf8 (const gchar *variable);
#endif
#endif /* __GTK_DOC_IGNORE__ */
G_END_DECLS
#endif /* __G_ENVIRON_H__ */