Cleanup g_strfreev() to auto_gcharv

Include some additional minor cleanups
This commit is contained in:
John Hernandez
2023-07-13 16:31:31 +02:00
parent 029f1caa52
commit 865a056315
16 changed files with 165 additions and 234 deletions

View File

@@ -2768,7 +2768,7 @@ _cmd_index(const Command* cmd)
index_source = g_string_append(index_source, " ");
}
gchar** tokens = g_str_tokenize_and_fold(index_source->str, NULL, NULL);
auto_gcharv gchar** tokens = g_str_tokenize_and_fold(index_source->str, NULL, NULL);
g_string_free(index_source, TRUE);
GString* index = g_string_new("");
@@ -2776,7 +2776,6 @@ _cmd_index(const Command* cmd)
index = g_string_append(index, tokens[i]);
index = g_string_append(index, " ");
}
g_strfreev(tokens);
return g_string_free(index, FALSE);
}
@@ -2786,7 +2785,7 @@ cmd_search_index_any(char* term)
{
GList* results = NULL;
gchar** processed_terms = g_str_tokenize_and_fold(term, NULL, NULL);
auto_gcharv gchar** processed_terms = g_str_tokenize_and_fold(term, NULL, NULL);
int terms_len = g_strv_length(processed_terms);
for (int i = 0; i < terms_len; i++) {
@@ -2802,8 +2801,6 @@ cmd_search_index_any(char* term)
g_list_free(index_keys);
}
g_strfreev(processed_terms);
return results;
}
@@ -2812,7 +2809,7 @@ cmd_search_index_all(char* term)
{
GList* results = NULL;
gchar** terms = g_str_tokenize_and_fold(term, NULL, NULL);
auto_gcharv gchar** terms = g_str_tokenize_and_fold(term, NULL, NULL);
int terms_len = g_strv_length(terms);
GList* commands = g_hash_table_get_keys(search_index);
@@ -2833,7 +2830,6 @@ cmd_search_index_all(char* term)
}
g_list_free(commands);
g_strfreev(terms);
return results;
}