+2006-03-01 Tor Lillqvist <tml@novell.com>
+
+ * glib/gutils.c (g_listenv): Separate implementation on Win32: Use
+ the wide character API on NT-based Windows. Return UTF-8 strings.
+
+ * glib/glib.symbols: Don't mark g_listenv as PRIVATE, as that
+ meant it wasn't present in the import library. PRIVATE is used
+ only for the backwards-compatibility DLL ABI stability hacks.
+
2006-02-24 Matthias Clasen <mclasen@redhat.com>
* configure.in: Bump version
+2006-03-01 Tor Lillqvist <tml@novell.com>
+
+ * glib/gutils.c (g_listenv): Separate implementation on Win32: Use
+ the wide character API on NT-based Windows. Return UTF-8 strings.
+
+ * glib/glib.symbols: Don't mark g_listenv as PRIVATE, as that
+ meant it wasn't present in the import library. PRIVATE is used
+ only for the backwards-compatibility DLL ABI stability hacks.
+
2006-02-24 Matthias Clasen <mclasen@redhat.com>
* configure.in: Bump version
+2006-03-01 Tor Lillqvist <tml@novell.com>
+
+ * glib/gutils.c (g_listenv): Separate implementation on Win32: Use
+ the wide character API on NT-based Windows. Return UTF-8 strings.
+
+ * glib/glib.symbols: Don't mark g_listenv as PRIVATE, as that
+ meant it wasn't present in the import library. PRIVATE is used
+ only for the backwards-compatibility DLL ABI stability hacks.
+
2006-02-24 Matthias Clasen <mclasen@redhat.com>
* configure.in: Bump version
g_get_home_dir PRIVATE
g_get_host_name
g_setenv PRIVATE
-g_listenv PRIVATE
+g_listenv
#ifdef G_OS_WIN32
g_find_program_in_path_utf8
g_get_current_dir_utf8
gchar **
g_listenv (void)
{
+#ifndef G_OS_WIN32
gchar **result, *eq;
gint len, i, j;
result[j] = NULL;
return result;
+#else
+ gchar **result, *eq;
+ gint len = 0, i, j;
+
+ if (G_WIN32_HAVE_WIDECHAR_API ())
+ {
+ wchar_t *p, *q;
+
+ p = (wchar_t *) GetEnvironmentStringsW ();
+ if (p != NULL)
+ {
+ q = p;
+ while (*q)
+ {
+ q += wcslen (q) + 1;
+ len++;
+ }
+ }
+ result = g_new0 (gchar *, len + 1);
+
+ j = 0;
+ q = p;
+ while (*q)
+ {
+ result[j] = g_utf16_to_utf8 (q, -1, NULL, NULL, NULL);
+ if (result[j] != NULL)
+ {
+ eq = strchr (result[j], '=');
+ if (eq && eq > result[j])
+ {
+ *eq = '\0';
+ j++;
+ }
+ else
+ g_free (result[j]);
+ }
+ q += wcslen (q) + 1;
+ }
+ result[j] = NULL;
+ FreeEnvironmentStringsW (p);
+ }
+ else
+ {
+ len = g_strv_length (environ);
+ result = g_new0 (gchar *, len + 1);
+
+ j = 0;
+ for (i = 0; i < len; i++)
+ {
+ result[j] = g_locale_to_utf8 (environ[i], -1, NULL, NULL, NULL);
+ if (result[j] != NULL)
+ {
+ eq = strchr (result[j], '=');
+ if (eq && eq > result[j])
+ {
+ *eq = '\0';
+ j++;
+ }
+ else
+ g_free (result[j]);
+ }
+ }
+ result[j] = NULL;
+ }
+
+ return result;
+#endif
}
G_LOCK_DEFINE_STATIC (g_utils_global);