[glib] glib/genviron.c, GSubprocessLauncher: ain't no "filename encoding"



commit 16190d2dcd111b75b240baffe88653e5fa2822f6
Author: Mikhail Zabaluev <mikhail zabaluev gmail com>
Date:   Mon Oct 6 02:01:38 2014 +0300

    glib/genviron.c, GSubprocessLauncher: ain't no "filename encoding"
    
    Removed all mentions of GLib file name encoding referring to
    the environment strings. The env var content has no defined relation
    to GLib's notion of filename encoding, or any encoding whatsoever.
    It would be wrong to pass all UTF-8 strings through
    g_filename_from_utf8() in order to put them into the environment,
    for one thing.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=738185

 gio/gsubprocesslauncher.c |   22 +++++++++-------------
 glib/genviron.c           |   19 ++++++++-----------
 2 files changed, 17 insertions(+), 24 deletions(-)
---
diff --git a/gio/gsubprocesslauncher.c b/gio/gsubprocesslauncher.c
index fbcbf6a..e32f9bd 100644
--- a/gio/gsubprocesslauncher.c
+++ b/gio/gsubprocesslauncher.c
@@ -237,9 +237,8 @@ g_subprocess_launcher_new (GSubprocessFlags flags)
  * As an alternative, you can use g_subprocess_launcher_setenv(),
  * g_subprocess_launcher_unsetenv(), etc.
  *
- * All strings in this array are expected to be in the GLib file name
- * encoding.  On UNIX, this means that they can be arbitrary byte
- * strings.  On Windows, they should be in UTF-8.
+ * On UNIX, all strings in this array can be arbitrary byte strings.
+ * On Windows, they should be in UTF-8.
  *
  * Since: 2.40
  **/
@@ -261,10 +260,9 @@ g_subprocess_launcher_set_environ (GSubprocessLauncher  *self,
  * Sets the environment variable @variable in the environment of
  * processes launched from this launcher.
  *
- * Both the variable's name and value should be in the GLib file name
- * encoding. On UNIX, this means that they can be arbitrary byte
- * strings. On Windows, they should be in UTF-8.
- *
+ * On UNIX, both the variable's name and value can be arbitrary byte
+ * strings, except that the variable's name cannot contain '='.
+ * On Windows, they should be in UTF-8.
  *
  * Since: 2.40
  **/
@@ -285,9 +283,8 @@ g_subprocess_launcher_setenv (GSubprocessLauncher *self,
  * Removes the environment variable @variable from the environment of
  * processes launched from this launcher.
  *
- * The variable name should be in the GLib file name encoding.  On UNIX,
- * this means that they can be arbitrary byte strings.  On Windows, they
- * should be in UTF-8.
+ * On UNIX, the variable's name can be an arbitrary byte string not
+ * containing '='. On Windows, it should be in UTF-8.
  *
  * Since: 2.40
  **/
@@ -306,9 +303,8 @@ g_subprocess_launcher_unsetenv (GSubprocessLauncher *self,
  * Returns the value of the environment variable @variable in the
  * environment of processes launched from this launcher.
  *
- * The returned string is in the GLib file name encoding.  On UNIX, this
- * means that it can be an arbitrary byte string.  On Windows, it will
- * be UTF-8.
+ * On UNIX, the returned string can be an arbitrary byte string.
+ * On Windows, it will be UTF-8.
  *
  * Returns: the value of the environment variable, %NULL if unset
  *
diff --git a/glib/genviron.c b/glib/genviron.c
index 0a83ac9..8c64cda 100644
--- a/glib/genviron.c
+++ b/glib/genviron.c
@@ -70,8 +70,7 @@ g_environ_find (gchar       **envp,
  * @envp: (allow-none) (array zero-terminated=1) (transfer none): an environment
  *     list (eg, as returned from g_get_environ()), or %NULL
  *     for an empty environment list
- * @variable: the environment variable to get, in the GLib file name
- *     encoding
+ * @variable: the environment variable to get
  *
  * Returns the value of the environment variable @variable in the
  * provided list @envp.
@@ -218,14 +217,13 @@ g_environ_unsetenv (gchar       **envp,
 
 /**
  * g_getenv:
- * @variable: the environment variable to get, in the GLib file name
- *     encoding
+ * @variable: the environment variable to get
  *
  * Returns the value of an environment variable.
  *
- * The name and value are in the GLib file name encoding. On UNIX,
- * this means the actual bytes which might or might not be in some
- * consistent character set and encoding. On Windows, it is in UTF-8.
+ * On UNIX, the name and value are byte strings which might or might not
+ * be in some consistent character set and encoding. On Windows, they are
+ * in UTF-8.
  * On Windows, in case the environment variable's value contains
  * references to other environment variables, they are expanded.
  *
@@ -248,10 +246,9 @@ g_getenv (const gchar *variable)
  * @value: the value for to set the variable to.
  * @overwrite: whether to change the variable if it already exists.
  *
- * Sets an environment variable. Both the variable's name and value
- * should be in the GLib file name encoding. On UNIX, this means that
- * they can be arbitrary byte strings. On Windows, they should be in
- * UTF-8.
+ * Sets an environment variable. On UNIX, both the variable's name and
+ * value can be arbitrary byte strings, except that the variable's name
+ * cannot contain '='. On Windows, they should be in UTF-8.
  *
  * Note that on some systems, when variables are overwritten, the memory
  * used for the previous variables and its value isn't reclaimed.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]