diff options
author | Lucas De Marchi <lucas.demarchi@profusion.mobi> | 2010-11-27 17:39:00 -0200 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2010-11-29 12:05:29 -0600 |
commit | 521071a7853b225713606de3e0421e680f187709 (patch) | |
tree | 57927fea85638f448436ea02706b99429ff13fc5 /gatchat/gatchat.c | |
parent | 00cdf2b427a788492baeb0e29b9063a36ef1effe (diff) | |
download | ofono-521071a7853b225713606de3e0421e680f187709.tar.gz |
gatchat: explicitly compare pointers to NULL
This patch was generated by the following semantic patch
(http://coccinelle.lip6.fr/)
// <smpl>
@fix disable is_null,isnt_null1@
expression *E;
@@
- !E
+ E == NULL
// </smpl>
Diffstat (limited to 'gatchat/gatchat.c')
-rw-r--r-- | gatchat/gatchat.c | 52 |
1 files changed, 24 insertions, 28 deletions
diff --git a/gatchat/gatchat.c b/gatchat/gatchat.c index 218f5921..d82a02ea 100644 --- a/gatchat/gatchat.c +++ b/gatchat/gatchat.c @@ -253,12 +253,12 @@ static struct at_command *at_command_create(guint gid, const char *cmd, } c = g_try_new0(struct at_command, 1); - if (!c) + if (c == NULL) return 0; len = strlen(cmd); c->cmd = g_try_new(char, len + 2); - if (!c->cmd) { + if (c->cmd == NULL) { g_free(c); return 0; } @@ -408,7 +408,7 @@ static gboolean at_chat_match_notify(struct at_chat *chat, char *line) return TRUE; } - if (!result.lines) + if (result.lines == NULL) result.lines = g_slist_prepend(NULL, line); g_slist_foreach(notify->nodes, at_notify_call_callback, @@ -434,7 +434,7 @@ static void at_chat_finish_command(struct at_chat *p, gboolean ok, char *final) GSList *response_lines; /* Cannot happen, but lets be paranoid */ - if (!cmd) + if (cmd == NULL) return; p->cmd_bytes_written = 0; @@ -567,7 +567,7 @@ static void have_line(struct at_chat *p, char *str) /* We're not going to copy terminal <CR><LF> */ struct at_command *cmd; - if (!str) + if (str == NULL) return; /* Check for echo, this should not happen, but lets be paranoid */ @@ -638,7 +638,7 @@ static void have_pdu(struct at_chat *p, char *pdu) GAtResult result; gboolean listing_pdu = FALSE; - if (!pdu) + if (pdu == NULL) goto error; result.lines = g_slist_prepend(NULL, p->pdu_notify); @@ -703,7 +703,7 @@ static char *extract_line(struct at_chat *p, struct ring_buffer *rbuf) } line = g_try_new(char, line_length + 1); - if (!line) { + if (line == NULL) { ring_buffer_drain(rbuf, p->read_so_far); return NULL; } @@ -800,10 +800,10 @@ static gboolean wakeup_no_response(gpointer user_data) return FALSE; at_chat_finish_command(chat, FALSE, NULL); + cmd = at_command_create(0, chat->wakeup, none_prefix, FALSE, NULL, wakeup_cb, chat, NULL, TRUE); - - if (!cmd) { + if (cmd == NULL) { chat->timeout_source = 0; return FALSE; } @@ -842,7 +842,7 @@ static gboolean can_write_data(gpointer data) return FALSE; if (chat->wakeup) { - if (!chat->wakeup_timer) { + if (chat->wakeup_timer == NULL) { wakeup_first = TRUE; chat->wakeup_timer = g_timer_new(); @@ -854,8 +854,7 @@ static gboolean can_write_data(gpointer data) if (chat->cmd_bytes_written == 0 && wakeup_first == TRUE) { cmd = at_command_create(0, chat->wakeup, none_prefix, FALSE, NULL, wakeup_cb, chat, NULL, TRUE); - - if (!cmd) + if (cmd == NULL) return FALSE; g_queue_push_head(chat->command_queue, cmd); @@ -1005,8 +1004,7 @@ static guint at_chat_send_common(struct at_chat *chat, guint gid, c = at_command_create(gid, cmd, prefix_list, expect_pdu, listing, func, user_data, notify, FALSE); - - if (!c) + if (c == NULL) return 0; c->id = chat->next_cmd_id++; @@ -1027,12 +1025,11 @@ static struct at_notify *at_notify_create(struct at_chat *chat, char *key; key = g_strdup(prefix); - - if (!key) + if (key == NULL) return 0; notify = g_try_new0(struct at_notify, 1); - if (!notify) { + if (notify == NULL) { g_free(key); return 0; } @@ -1055,7 +1052,7 @@ static gboolean at_chat_cancel(struct at_chat *chat, guint group, guint id) l = g_queue_find_custom(chat->command_queue, GUINT_TO_POINTER(id), at_command_compare_by_id); - if (!l) + if (l == NULL) return FALSE; c = l->data; @@ -1124,14 +1121,14 @@ static guint at_chat_register(struct at_chat *chat, guint group, notify = g_hash_table_lookup(chat->notify_list, prefix); - if (!notify) + if (notify == NULL) notify = at_notify_create(chat, prefix, expect_pdu); - if (!notify || notify->pdu != expect_pdu) + if (notify == NULL || notify->pdu != expect_pdu) return 0; node = g_try_new0(struct at_notify_node, 1); - if (!node) + if (node == NULL) return 0; node->id = chat->next_notify_id++; @@ -1165,7 +1162,7 @@ static gboolean at_chat_unregister(struct at_chat *chat, gboolean mark_only, l = g_slist_find_custom(notify->nodes, GUINT_TO_POINTER(id), at_notify_node_compare_by_id); - if (!l) + if (l == NULL) continue; node = l->data; @@ -1206,14 +1203,14 @@ static struct at_chat *create_chat(GIOChannel *channel, GIOFlags flags, { struct at_chat *chat; - if (!channel) + if (channel == NULL) return NULL; - if (!syntax) + if (syntax == NULL) return NULL; chat = g_try_new0(struct at_chat, 1); - if (!chat) + if (chat == NULL) return chat; chat->ref_count = 1; @@ -1226,14 +1223,13 @@ static struct at_chat *create_chat(GIOChannel *channel, GIOFlags flags, else chat->io = g_at_io_new_blocking(channel); - if (!chat->io) + if (chat->io == NULL) goto error; g_at_io_set_disconnect_function(chat->io, io_disconnect, chat); chat->command_queue = g_queue_new(); - - if (!chat->command_queue) + if (chat->command_queue == NULL) goto error; chat->notify_list = g_hash_table_new_full(g_str_hash, g_str_equal, |