[Xfce4-commits] <libxfce4util:master> Remove unused or unrequired API functions.
Nick Schermer
noreply at xfce.org
Wed Sep 19 21:42:01 CEST 2012
Updating branch refs/heads/master
to e61d130124ae7d1b8184e4853e8270163ffec6b0 (commit)
from 35b855f7241d6a9a6abb857f79c398aab68145cf (commit)
commit e61d130124ae7d1b8184e4853e8270163ffec6b0
Author: Nick Schermer <nick at xfce.org>
Date: Fri May 4 20:35:26 2012 +0200
Remove unused or unrequired API functions.
Drop xfce_strjoin, xfce_putenv, xfce_setenv and xfce_unsetenv.
docs/libxfce4util-sections.txt | 4 -
docs/tmpl/xfce-miscutils.sgml | 39 --------
libxfce4util/libxfce4util.symbols | 4 -
libxfce4util/xfce-miscutils.c | 187 -------------------------------------
libxfce4util/xfce-miscutils.h | 10 --
5 files changed, 0 insertions(+), 244 deletions(-)
diff --git a/docs/libxfce4util-sections.txt b/docs/libxfce4util-sections.txt
index 4192244..053668a 100644
--- a/docs/libxfce4util-sections.txt
+++ b/docs/libxfce4util-sections.txt
@@ -134,11 +134,7 @@ xfce_get_homefile_r
xfce_get_userdir
xfce_get_userfile
xfce_get_userfile_r
-xfce_strjoin
xfce_gethostname
-xfce_putenv
-xfce_setenv
-xfce_unsetenv
xfce_expand_variables
</SECTION>
diff --git a/docs/tmpl/xfce-miscutils.sgml b/docs/tmpl/xfce-miscutils.sgml
index ff39dab..d68b134 100644
--- a/docs/tmpl/xfce-miscutils.sgml
+++ b/docs/tmpl/xfce-miscutils.sgml
@@ -91,17 +91,6 @@ formed by a NULL terminated list of path components.
@Returns:
-<!-- ##### FUNCTION xfce_strjoin ##### -->
-<para>
-
-</para>
-
- at separator:
- at strings:
- at count:
- at Returns:
-
-
<!-- ##### FUNCTION xfce_gethostname ##### -->
<para>
@@ -111,34 +100,6 @@ formed by a NULL terminated list of path components.
@Returns:
-<!-- ##### FUNCTION xfce_putenv ##### -->
-<para>
-
-</para>
-
- at string:
- at Returns:
-
-
-<!-- ##### FUNCTION xfce_setenv ##### -->
-<para>
-
-</para>
-
- at name:
- at value:
- at overwrite:
- at Returns:
-
-
-<!-- ##### FUNCTION xfce_unsetenv ##### -->
-<para>
-
-</para>
-
- at name:
-
-
<!-- ##### FUNCTION xfce_expand_variables ##### -->
<para>
diff --git a/libxfce4util/libxfce4util.symbols b/libxfce4util/libxfce4util.symbols
index d0ecc33..ad022c3 100644
--- a/libxfce4util/libxfce4util.symbols
+++ b/libxfce4util/libxfce4util.symbols
@@ -89,11 +89,7 @@ xfce_get_homedir G_GNUC_PURE
xfce_get_homefile_r
xfce_get_userdir G_GNUC_PURE
xfce_get_userfile_r
-xfce_strjoin G_GNUC_MALLOC
xfce_gethostname G_GNUC_MALLOC
-xfce_putenv
-xfce_setenv
-xfce_unsetenv
xfce_expand_variables G_GNUC_MALLOC
#endif
#endif
diff --git a/libxfce4util/xfce-miscutils.c b/libxfce4util/xfce-miscutils.c
index 74d3f9c..bf4c118 100644
--- a/libxfce4util/xfce-miscutils.c
+++ b/libxfce4util/xfce-miscutils.c
@@ -275,50 +275,6 @@ xfce_get_userfile_r (gchar *buffer, size_t length, const gchar *format, ...)
/**
- * xfce_strjoin:
- * @separator:
- * @strings:
- * @count:
- *
- * Joins the @count character strings pointed to by @strings using @separator
- * to a single string.
- *
- * Return value: the joined string. The string has to be freed by the caller
- * using g_free() when no longer needed.
- **/
-gchar*
-xfce_strjoin (const gchar *separator,
- gchar **strings,
- gint count)
-{
- gchar *result;
- gint length;
- gint n;
-
- g_return_val_if_fail (count > 0, NULL);
- g_return_val_if_fail (strings != NULL, NULL);
-
- for (length = 1, n = 0; n < count; n++)
- length += strlen (strings[n]);
-
- if (separator != NULL)
- length += (count - 1) * strlen (separator);
-
- result = g_new0 (gchar, length);
-
- for (n = 0; n < count; n++) {
- g_strlcat (result, strings[n], length);
-
- if (separator != NULL && n + 1 < count)
- g_strlcat (result, separator, length);
- }
-
- return result;
-}
-
-
-
-/**
* xfce_gethostname:
*
* Portable way to query the hostname of the node running the process. This
@@ -352,149 +308,6 @@ xfce_gethostname (void)
-/**
- * xfce_putenv:
- * @string: Character string in the form "name=value".
- *
- * Portable replacement for the Unix putenv() library function. @string has
- * to have the form "name=value". Calling xfce_putenv() this way is equal to
- * calling xfce_setenv("name", "value", %TRUE).
- *
- * Return value: 0 if the operation was successful; otherwise the global
- * variable errno is set to indicate the error and a value
- * of -1 is returned.
- *
- * Since: 4.2
- **/
-gint
-xfce_putenv (const gchar *string)
-{
-#ifdef HAVE_BROKEN_PUTENV
- gchar* buffer;
- int result, sverrno;
-
- /*
- * We need to use plattform malloc() here, cause g_malloc() need not
- * to use malloc(), and we don't know about the evil interna of this
- * plattforms putenv() implementation.
- */
-#ifdef HAVE_STRDUP
- if ((buffer = strdup (string)) != NULL)
- {
-#else
- if ((buffer = malloc (strlen (string) + 1)) != NULL)
- {
- strcpy(buffer, string);
-#endif
- if ((result = putenv (buffer)) < 0)
- {
- sverrno = errno;
- free (buffer);
- errno = sverrno;
- }
- }
- else
- {
- errno = ENOMEM;
- result = -1;
- }
-
- return result;
-#else /* !HAVE_BROKEN_PUTENV */
- return putenv (string);
-#endif /* !HAVE_BROKEN_PUTENV */
-}
-
-
-
-/**
- * xfce_setenv:
- * @name: the name of the environment variable to set, must not contain '='.
- * @value: the value to set the variable to.
- * @overwrite: whether to change the variable if it already exists.
- *
- * If the variable @name does not exists in the list of environment variables,
- * it is inserted with its value being set to @value. If the variable does
- * exist, then its value is only changed to @value if @overwrite is TRUE.
- *
- * On plattforms that provide a working native setenv() library call, this
- * functions is used, on all other plattforms setenv() is emulated using
- * xfce_putenv(). That says, xfce_setenv() is not subject to the limitations
- * that apply to some setenv() implementations and seem also to apply to
- * g_setenv() in Glib 2.4.
- *
- * Return value: 0 if the operation was successful; otherwise the global
- * variable errno is set to indicate the error and a value
- * of -1 is returned.
- *
- * Since: 4.2
- **/
-gint
-xfce_setenv (const gchar *name,
- const gchar *value,
- gboolean overwrite)
-{
- /* Plattforms with broken putenv() are unlikely to have a working setenv() */
-#if !defined(HAVE_SETENV) || defined(HAVE_BROKEN_PUTENV)
- int result = 0;
- gchar *buf;
-
- if (g_getenv (name) == NULL || overwrite)
- {
- buf = g_strdup_printf ("%s=%s", name, value);
- result = xfce_putenv (buf);
- g_free (buf);
- }
-
- return result;
-#else
- return setenv (name, value, overwrite);
-#endif /* !HAVE_SETENV */
-}
-
-
-
-/**
- * xfce_unsetenv:
- * @name : the name of the environment variable to unset, must not contain '='.
- *
- * Deletes all instances of the variables @name from the list of environment
- * variables in the current process.
- *
- * Note that on some systems, the memory used for the variable and its value
- * can't be reclaimed. Furthermore, this function can't be guaranteed to
- * operate in a threadsafe way.
- *
- * Since: 4.2
- **/
-void
-xfce_unsetenv (const gchar *name)
-{
-#if defined(HAVE_UNSETENV)
- unsetenv (name);
-#elif GLIB_CHECK_VERSION(2,4,0)
- g_unsetenv (name);
-#else
- /* Adopted the GLib way of doing things, since my putenv (name + "=") does
- * not work properly on most plattforms :-/
- */
- extern char **environ;
- char **envp1;
- char **envp2;
- int length;
-
- length = strlen (name);
-
- for (envp1 = envp2 = environ; *envp1 != NULL; ++envp1)
- if (strncmp (*envp1, name, length) != 0 || (*envp1)[length] != '=')
- *envp2++ = *envp1;
-
- *envp2 = NULL;
-#endif
-}
-
-
-
static inline gboolean
xfce_is_valid_tilde_prefix (const gchar *p)
{
diff --git a/libxfce4util/xfce-miscutils.h b/libxfce4util/xfce-miscutils.h
index b1af5a0..2ed3e11 100644
--- a/libxfce4util/xfce-miscutils.h
+++ b/libxfce4util/xfce-miscutils.h
@@ -80,18 +80,8 @@ xfce_get_userfile (const gchar *first_element, ...)
#endif
-gchar* xfce_strjoin (const gchar *separator,
- gchar **strings,
- gint count) G_GNUC_MALLOC;
-
gchar* xfce_gethostname (void) G_GNUC_MALLOC;
-gint xfce_putenv (const gchar *string);
-
-gint xfce_setenv (const gchar *name,
- const gchar *value,
- gboolean overwrite);
-void xfce_unsetenv (const gchar *name);
gchar* xfce_expand_variables (const gchar *command,
gchar **envp) G_GNUC_MALLOC;
More information about the Xfce4-commits
mailing list