mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-04 02:06:18 +01:00
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:
parent
d43b3d889a
commit
b67d071321
@ -631,61 +631,39 @@ g_get_environ (void)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Win32 binary compatibility versions {{{1 */
|
#endif /* G_OS_WIN32 */
|
||||||
#ifndef _WIN64
|
|
||||||
|
|
||||||
#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 *
|
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);
|
return g_getenv (variable);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef g_setenv
|
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
g_setenv (const gchar *variable,
|
g_setenv_utf8 (const gchar *variable,
|
||||||
const gchar *value,
|
const gchar *value,
|
||||||
gboolean overwrite)
|
gboolean overwrite)
|
||||||
{
|
{
|
||||||
gchar *utf8_variable = g_locale_to_utf8 (variable, -1, NULL, NULL, NULL);
|
return g_setenv (variable, value, overwrite);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef g_unsetenv
|
|
||||||
|
|
||||||
void
|
void
|
||||||
g_unsetenv (const gchar *variable)
|
g_unsetenv_utf8 (const gchar *variable)
|
||||||
{
|
{
|
||||||
gchar *utf8_variable = g_locale_to_utf8 (variable, -1, NULL, NULL, NULL);
|
return g_unsetenv (variable);
|
||||||
|
|
||||||
g_unsetenv_utf8 (utf8_variable);
|
|
||||||
|
|
||||||
g_free (utf8_variable);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* _WIN64 */
|
#endif
|
||||||
|
|
||||||
#endif /* G_OS_WIN32 */
|
|
||||||
|
|
||||||
/* Epilogue {{{1 */
|
/* Epilogue {{{1 */
|
||||||
/* vim: set foldmethod=marker: */
|
/* vim: set foldmethod=marker: */
|
||||||
|
@ -58,22 +58,6 @@ GLIB_AVAILABLE_IN_ALL
|
|||||||
gchar ** g_environ_unsetenv (gchar **envp,
|
gchar ** g_environ_unsetenv (gchar **envp,
|
||||||
const gchar *variable) G_GNUC_WARN_UNUSED_RESULT;
|
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
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __G_ENVIRON_H__ */
|
#endif /* __G_ENVIRON_H__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user