0
1
mirror of https://github.com/profanity-im/profanity.git synced 2025-07-05 17:28:00 -04:00

Use null check convention in parser.c

This commit is contained in:
James Booth 2015-05-04 22:57:19 +01:00
parent fa2e33e11d
commit fe216b4e97

View File

@ -156,7 +156,7 @@ parse_args(const char * const inp, int min, int max, gboolean *result)
token = g_slist_next(token); token = g_slist_next(token);
int arg_count = 0; int arg_count = 0;
while (token != NULL) { while (token) {
args[arg_count++] = strdup(token->data); args[arg_count++] = strdup(token->data);
token = g_slist_next(token); token = g_slist_next(token);
} }
@ -303,7 +303,7 @@ parse_args_with_freetext(const char * const inp, int min, int max, gboolean *res
token = g_slist_next(token); token = g_slist_next(token);
int arg_count = 0; int arg_count = 0;
while (token != NULL) { while (token) {
args[arg_count++] = strdup(token->data); args[arg_count++] = strdup(token->data);
token = g_slist_next(token); token = g_slist_next(token);
} }
@ -419,7 +419,7 @@ parse_options(gchar **args, gchar **opt_keys, gboolean *res)
} }
// check if duplicate // check if duplicate
if (g_list_find_custom(found_keys, args[curr], (GCompareFunc)g_strcmp0) != NULL) { if (g_list_find_custom(found_keys, args[curr], (GCompareFunc)g_strcmp0)) {
*res = FALSE; *res = FALSE;
g_list_free(keys); g_list_free(keys);
return options; return options;
@ -450,7 +450,7 @@ parse_options(gchar **args, gchar **opt_keys, gboolean *res)
void void
options_destroy(GHashTable *options) options_destroy(GHashTable *options)
{ {
if (options != NULL) { if (options) {
g_hash_table_destroy(options); g_hash_table_destroy(options);
} }
} }