diff options
author | James Booth <boothj5@gmail.com> | 2014-09-07 14:13:05 +0100 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2014-09-07 14:13:44 +0100 |
commit | ee6208866a1834cfea23ceec6ef2224dc05d3a24 (patch) | |
tree | c052e16a4c03bce492d849b25936494d9eaeceee /src | |
parent | 99ca436dd99c4f731da94608055e5e714cfad25c (diff) | |
download | profani-tty-ee6208866a1834cfea23ceec6ef2224dc05d3a24.tar.gz |
Removed unnecessary NULL checks when freeing form
Diffstat (limited to 'src')
-rw-r--r-- | src/xmpp/form.c | 52 |
1 files changed, 12 insertions, 40 deletions
diff --git a/src/xmpp/form.c b/src/xmpp/form.c index 43eb7503..002f366c 100644 --- a/src/xmpp/form.c +++ b/src/xmpp/form.c @@ -203,13 +203,8 @@ static void _free_option(FormOption *option) { if (option != NULL) { - if (option->label != NULL) { - free(option->label); - } - if (option->value != NULL) { - free(option->value); - } - + free(option->label); + free(option->value); free(option); } } @@ -218,25 +213,12 @@ static void _free_field(FormField *field) { if (field != NULL) { - if (field->label != NULL) { - free(field->label); - } - if (field->type != NULL) { - free(field->type); - } - if (field->var != NULL) { - free(field->var); - } - if (field->description != NULL) { - free(field->description); - } - if (field->values != NULL) { - g_slist_free_full(field->values, free); - } - if (field->options != NULL) { - g_slist_free_full(field->options, (GDestroyNotify)_free_option); - } - + free(field->label); + free(field->type); + free(field->var); + free(field->description); + g_slist_free_full(field->values, free); + g_slist_free_full(field->options, (GDestroyNotify)_free_option); free(field); } } @@ -245,20 +227,10 @@ static void _form_destroy(DataForm *form) { if (form != NULL) { - if (form->type != NULL) { - free(form->type); - } - if (form->title != NULL) { - free(form->title); - } - if (form->instructions != NULL) { - free(form->instructions); - } - - if (form->fields != NULL) { - g_slist_free_full(form->fields, (GDestroyNotify)_free_field); - } - + free(form->type); + free(form->title); + free(form->instructions); + g_slist_free_full(form->fields, (GDestroyNotify)_free_field); free(form); } } |