Skip to content

Commit 1f925d9

Browse files
committed
Use automatic cleanup
1 parent dc73fa0 commit 1f925d9

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

zathura/utils.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,28 +136,23 @@ static bool find_substring(const char* source_str, const char* search_str) {
136136
}
137137

138138
static bool search_equal_iter(GtkTreeModel* model, gint column, const gchar* key, GtkTreeIter* iter) {
139-
GValue value = G_VALUE_INIT;
139+
g_auto(GValue) value = G_VALUE_INIT;
140140
gtk_tree_model_get_value(model, iter, column, &value);
141141

142-
GValue transformed = G_VALUE_INIT;
142+
g_auto(GValue) transformed = G_VALUE_INIT;
143143
g_value_init(&transformed, G_TYPE_STRING);
144144

145145
const gboolean ret = g_value_transform(&value, &transformed);
146-
g_value_unset(&value);
147146
if (!ret) {
148147
return true;
149148
}
150149

151150
const gchar* source_string = g_value_get_string(&transformed);
152151
if (!source_string) {
153-
g_value_unset(&transformed);
154152
return true;
155153
}
156154

157-
const bool ret2 = find_substring(source_string, key);
158-
g_value_unset(&transformed);
159-
160-
return !ret2;
155+
return !find_substring(source_string, key);
161156
}
162157

163158
gboolean search_equal_func_index(GtkTreeModel* model, gint column, const gchar* key, GtkTreeIter* iter,

zathura/zathura.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1699,7 +1699,7 @@ void zathura_show_signature_information(zathura_t* zathura, bool show) {
16991699
return;
17001700
}
17011701

1702-
g_auto(GValue) show_sig_info_value = {0};
1702+
g_auto(GValue) show_sig_info_value = G_VALUE_INIT;
17031703
g_value_init(&show_sig_info_value, G_TYPE_BOOLEAN);
17041704
g_value_set_boolean(&show_sig_info_value, show);
17051705

0 commit comments

Comments
 (0)