[glib] genviron: Remove old win32 codepage ABI compat code
- From: Christoph Reiter <creiter src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] genviron: Remove old win32 codepage ABI compat code
- Date: Thu, 6 Apr 2017 17:27:22 +0000 (UTC)
commit b67d071321264cc4a7bb9df47a4381918232279a
Author: Christoph Reiter <creiter src gnome org>
Date: Tue Mar 28 08:00:46 2017 +0200
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
glib/genviron.c | 60 +++++++++++++++++-------------------------------------
glib/genviron.h | 16 --------------
2 files changed, 19 insertions(+), 57 deletions(-)
---
diff --git a/glib/genviron.c b/glib/genviron.c
index 0dfcb5c..4b40050 100644
--- a/glib/genviron.c
+++ b/glib/genviron.c
@@ -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
-const gchar *
-g_getenv (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;
+/* Binary compatibility versions. Not for newly compiled code. */
- 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);
+_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);
- return g_quark_to_string (quark);
+const gchar *
+g_getenv_utf8 (const gchar *variable)
+{
+ 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: */
diff --git a/glib/genviron.h b/glib/genviron.h
index a4bcd41..3e2b4b0 100644
--- a/glib/genviron.h
+++ b/glib/genviron.h
@@ -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__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]