summaryrefslogtreecommitdiff
path: root/src/matcher.c
diff options
context:
space:
mode:
authorNalin Dahyabhai <nalin@src.gnome.org>2003-05-21 21:42:17 +0000
committerNalin Dahyabhai <nalin@src.gnome.org>2003-05-21 21:42:17 +0000
commitdc2184423cc237fb277587553b0eb07a716089f7 (patch)
tree2ce83c23d422517acac3a8bb6cfd9953b10acabb /src/matcher.c
parent2b20f0ebd1d1b6007cad7b3a13de1b5f78526cd2 (diff)
free the temporary array. add. use _vte_matcher_free_params_array instead
* src/iso2022.c(_vte_iso2022_process): free the temporary array. * src/matcher.c(_vte_matcher_free_params_array): add. * src/vte.c: use _vte_matcher_free_params_array instead of the local copy, which is removed. * src/interpret.c, src/table.c, src/trie.c: use _vte_matcher_free_params_array to free parameter arrays instead of g_value_array_free, which doesn't take care of the pointer values. * src/vte.c(vte_sequence_handler_set_title_internal): only attempt to close the conversion descriptor if it was opened successfully. * src/vteapp.c: add the -k option to spin after gtk_main() returns. * src/vtefc.c: make copies of patterns with FcPatternDuplicate so that we know where all of the returned patterns came from. * src/vtexft.c(_vte_xft_font_for_char): set the item in the pattern array to NULL if we successfully opened a font using the pattern.
Diffstat (limited to 'src/matcher.c')
-rw-r--r--src/matcher.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/matcher.c b/src/matcher.c
index 6d0b949..5eeed59 100644
--- a/src/matcher.c
+++ b/src/matcher.c
@@ -127,3 +127,28 @@ _vte_matcher_print(struct _vte_matcher *matcher)
break;
}
}
+
+/* Free a parameter array. Most of the GValue elements can clean up after
+ * themselves, but we're using gpointers to hold unicode character strings, and
+ * we need to free those ourselves. */
+void
+_vte_matcher_free_params_array(GValueArray *params)
+{
+ guint i;
+ GValue *value;
+ gpointer ptr;
+ if (params != NULL) {
+ for (i = 0; i < params->n_values; i++) {
+ value = g_value_array_get_nth(params, i);
+ if (G_VALUE_HOLDS_POINTER(value)) {
+ ptr = g_value_get_pointer(value);
+ if (ptr != NULL) {
+ g_free(ptr);
+ }
+ g_value_set_pointer(value, NULL);
+ }
+ }
+ g_value_array_free(params);
+ }
+}
+