From 31a4eddf44532c655f84145f1b54cf7be01a5f90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enrico=20Tr=C3=B6ger?= Date: Mon, 15 Mar 2010 14:48:43 +0000 Subject: [PATCH] Add utils_copy_environment() to the plugin API. git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@4764 ea778897-0a13-0410-b9d1-a72fbfd435f5 --- ChangeLog | 3 +++ plugins/geanyfunctions.h | 2 ++ src/plugindata.h | 4 +++- src/plugins.c | 1 + src/utils.c | 14 +++++++++++--- 5 files changed, 20 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2613569e4..4412cdb65 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,9 @@ * wscript: Fix/Improve GIT repository detection (patch by Thomas Martitz, thanks). + * plugins/geanyfunctions.h, src/plugindata.h, src/plugins.c, + src/utils.c: + Add utils_copy_environment() to the plugin API. 2010-03-15 Nick Treleaven diff --git a/plugins/geanyfunctions.h b/plugins/geanyfunctions.h index 443a6e7bf..9044b74e5 100644 --- a/plugins/geanyfunctions.h +++ b/plugins/geanyfunctions.h @@ -232,6 +232,8 @@ geany_functions->p_utils->utils_str_remove_chars #define utils_get_file_list_full \ geany_functions->p_utils->utils_get_file_list_full +#define utils_copy_environment \ + geany_functions->p_utils->utils_copy_environment #define ui_dialog_vbox_new \ geany_functions->p_ui->ui_dialog_vbox_new #define ui_frame_new_with_alignment \ diff --git a/src/plugindata.h b/src/plugindata.h index df261b273..13d853f45 100644 --- a/src/plugindata.h +++ b/src/plugindata.h @@ -50,7 +50,7 @@ enum { /** The Application Programming Interface (API) version, incremented * whenever any plugin data types are modified or appended to. */ - GEANY_API_VERSION = 176, + GEANY_API_VERSION = 177, /** The Application Binary Interface (ABI) version, incremented whenever * existing fields in the plugin data types have to be changed or reordered. */ @@ -393,6 +393,8 @@ typedef struct UtilsFuncs gchar* (*utils_str_remove_chars) (gchar *string, const gchar *chars); GSList* (*utils_get_file_list_full)(const gchar *path, gboolean full_path, gboolean sort, GError **error); + gchar** (*utils_copy_environment)(const gchar **exclude_vars, const gchar *first_varname, ...); + } UtilsFuncs; diff --git a/src/plugins.c b/src/plugins.c index 0f1c5e45f..eb8e8f091 100644 --- a/src/plugins.c +++ b/src/plugins.c @@ -210,6 +210,7 @@ static UtilsFuncs utils_funcs = { &utils_str_middle_truncate, &utils_str_remove_chars, &utils_get_file_list_full, + &utils_copy_environment }; static UIUtilsFuncs uiutils_funcs = { diff --git a/src/utils.c b/src/utils.c index b715feec3..947f2c36a 100644 --- a/src/utils.c +++ b/src/utils.c @@ -1916,12 +1916,20 @@ static gboolean str_in_array(const gchar **haystack, const gchar *needle) } -/* Copies the current environment into a new array. - * exclude_vars is a NULL-terminated array of variable names which should be not copied. +/** + * Copies the current environment into a new array. + * @a exclude_vars is a @c NULL-terminated array of variable names which should be not copied. * All further arguments are key, value pairs of variables which should be added to * the environment. * - * The argument list must be terminated with NULL. */ + * The argument list must be @c NULL-terminated. + * + * @param exclude_vars @c NULL-terminated array of variable names to exclude. + * @param first_varname Name of the first variable to copy into the new array. + * @param ... Key-value pairs of variable names and values, @c NULL-terminated. + * + * @return The new environment array. + **/ gchar **utils_copy_environment(const gchar **exclude_vars, const gchar *first_varname, ...) { gchar **result;