aboutsummaryrefslogtreecommitdiffstats
path: root/src/command
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2015-05-05 00:13:41 +0100
committerJames Booth <boothj5@gmail.com>2015-05-05 00:13:41 +0100
commitd52f86ef0fe6a7e88c218df5b9802d7901704c57 (patch)
tree44f6dd3562a0a7cd670f4075dfe3d004b2faa61f /src/command
parent6f3750c6aa1ba72378ac004e6abceb19ed1ddecb (diff)
downloadprofani-tty-d52f86ef0fe6a7e88c218df5b9802d7901704c57.tar.gz
Tidied form field autocompleters
Diffstat (limited to 'src/command')
-rw-r--r--src/command/command.c48
1 files changed, 26 insertions, 22 deletions
diff --git a/src/command/command.c b/src/command/command.c
index 04bb6603..bd0d741c 100644
--- a/src/command/command.c
+++ b/src/command/command.c
@@ -1653,35 +1653,39 @@ cmd_autocomplete_add(char *value)
void
cmd_autocomplete_add_form_fields(DataForm *form)
{
- if (form) {
- GSList *fields = autocomplete_create_list(form->tag_ac);
- GSList *curr_field = fields;
- while (curr_field) {
- GString *field_str = g_string_new("/");
- g_string_append(field_str, curr_field->data);
- cmd_autocomplete_add(field_str->str);
- g_string_free(field_str, TRUE);
- curr_field = g_slist_next(curr_field);
- }
- g_slist_free_full(fields, free);
+ if (form == NULL) {
+ return;
+ }
+
+ GSList *fields = autocomplete_create_list(form->tag_ac);
+ GSList *curr_field = fields;
+ while (curr_field) {
+ GString *field_str = g_string_new("/");
+ g_string_append(field_str, curr_field->data);
+ cmd_autocomplete_add(field_str->str);
+ g_string_free(field_str, TRUE);
+ curr_field = g_slist_next(curr_field);
}
+ g_slist_free_full(fields, free);
}
void
cmd_autocomplete_remove_form_fields(DataForm *form)
{
- if (form) {
- GSList *fields = autocomplete_create_list(form->tag_ac);
- GSList *curr_field = fields;
- while (curr_field) {
- GString *field_str = g_string_new("/");
- g_string_append(field_str, curr_field->data);
- cmd_autocomplete_remove(field_str->str);
- g_string_free(field_str, TRUE);
- curr_field = g_slist_next(curr_field);
- }
- g_slist_free_full(fields, free);
+ if (form == NULL) {
+ return;
+ }
+
+ GSList *fields = autocomplete_create_list(form->tag_ac);
+ GSList *curr_field = fields;
+ while (curr_field) {
+ GString *field_str = g_string_new("/");
+ g_string_append(field_str, curr_field->data);
+ cmd_autocomplete_remove(field_str->str);
+ g_string_free(field_str, TRUE);
+ curr_field = g_slist_next(curr_field);
}
+ g_slist_free_full(fields, free);
}
void