[geany/geany] f2d33b: Add stash_group_free_settings() function to API
Dimitar Zhekov
git-noreply at xxxxx
Fri Apr 6 13:04:01 UTC 2012
Branch: refs/heads/master
Author: Dimitar Zhekov <dimitar.zhekov at gmail.com>
Committer: Nick Treleaven <nick.treleaven at btinternet.com>
Date: Fri, 06 Apr 2012 13:04:01
Commit: f2d33bc16ea8c8c6ef5f8f5cd6aee77ec63f2129
https://github.com/geany/geany/commit/f2d33bc16ea8c8c6ef5f8f5cd6aee77ec63f2129
Log Message:
-----------
Add stash_group_free_settings() function to API
Frees the memory allocated for setting values in a group.
Modified Paths:
--------------
plugins/geanyfunctions.h
src/plugindata.h
src/plugins.c
src/stash.c
src/stash.h
Modified: plugins/geanyfunctions.h
2 files changed, 2 insertions(+), 0 deletions(-)
===================================================================
@@ -418,6 +418,8 @@
geany_functions->p_stash->stash_group_display
#define stash_group_update \
geany_functions->p_stash->stash_group_update
+#define stash_group_free_settings \
+ geany_functions->p_stash->stash_group_free_settings
#define symbols_get_context_separator \
geany_functions->p_symbols->symbols_get_context_separator
#define build_activate_menu_item \
Modified: src/plugindata.h
5 files changed, 3 insertions(+), 2 deletions(-)
===================================================================
@@ -55,7 +55,7 @@
* @warning You should not test for values below 200 as previously
* @c GEANY_API_VERSION was defined as an enum value, not a macro.
*/
-#define GEANY_API_VERSION 214
+#define GEANY_API_VERSION 215
/** The Application Binary Interface (ABI) version, incremented whenever
* existing fields in the plugin data types have to be changed or reordered.
@@ -701,6 +701,7 @@
const gchar *property_name, GType type);
void (*stash_group_display)(struct StashGroup *group, GtkWidget *owner);
void (*stash_group_update)(struct StashGroup *group, GtkWidget *owner);
+ void (*stash_group_free_settings)(struct StashGroup *group);
}
StashFuncs;
@@ -716,7 +717,7 @@
typedef struct BuildFuncs
{
void (*build_activate_menu_item)(const GeanyBuildGroup grp, const guint cmd);
- const gchar *(*build_get_current_menu_item)(const GeanyBuildGroup grp, const guint cmd,
+ const gchar *(*build_get_current_menu_item)(const GeanyBuildGroup grp, const guint cmd,
const GeanyBuildCmdEntries field);
void (*build_remove_menu_item)(const GeanyBuildSource src, const GeanyBuildGroup grp,
const gint cmd);
Modified: src/plugins.c
3 files changed, 2 insertions(+), 1 deletions(-)
===================================================================
@@ -346,7 +346,8 @@
&stash_group_add_entry,
&stash_group_add_widget_property,
&stash_group_display,
- &stash_group_update
+ &stash_group_update,
+ &stash_group_free_settings
};
static SymbolsFuncs symbols_funcs = {
Modified: src/stash.c
23 files changed, 23 insertions(+), 0 deletions(-)
===================================================================
@@ -335,6 +335,29 @@ gint stash_group_save_to_file(StashGroup *group, const gchar *filename,
}
+/** Frees the memory allocated for setting values in a group.
+ * Useful e.g. to avoid freeing strings individually.
+ * @note This is *not* called by stash_group_free().
+ * @param group . */
+void stash_group_free_settings(StashGroup *group)
+{
+ StashPref *entry;
+ guint i;
+
+ foreach_ptr_array(entry, i, group->entries)
+ {
+ if (entry->setting_type == G_TYPE_STRING)
+ g_free(*(gchararray *) entry->setting);
+ else if (entry->setting_type == G_TYPE_STRV)
+ g_strfreev(*(gchararray **) entry->setting);
+ else
+ continue;
+
+ *(gpointer**) entry->setting = NULL;
+ }
+}
+
+
/** Frees a group.
* @param group . */
void stash_group_free(StashGroup *group)
Modified: src/stash.h
2 files changed, 2 insertions(+), 0 deletions(-)
===================================================================
@@ -60,6 +60,8 @@ void stash_group_add_string_vector(StashGroup *group, gchar ***setting,
gint stash_group_save_to_file(StashGroup *group, const gchar *filename,
GKeyFileFlags flags);
+void stash_group_free_settings(StashGroup *group);
+
void stash_group_free(StashGroup *group);
@@ Diff output truncated at 100000 characters. @@
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: TBD).
More information about the Commits
mailing list