From b82a7f851159a42f6ca38a2357551a94a4402e11 Mon Sep 17 00:00:00 2001 From: Lucas De Marchi Date: Sat, 27 Nov 2010 17:38:56 -0200 Subject: drivers: explicitly compare pointers to NULL This patch was generated by the following semantic patch (http://coccinelle.lip6.fr/) // @fix disable is_null,isnt_null1@ expression *E; @@ - !E + E == NULL // --- drivers/hfpmodem/voicecall.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'drivers/hfpmodem/voicecall.c') diff --git a/drivers/hfpmodem/voicecall.c b/drivers/hfpmodem/voicecall.c index e96ec7c1..53ca4bd5 100644 --- a/drivers/hfpmodem/voicecall.c +++ b/drivers/hfpmodem/voicecall.c @@ -80,7 +80,7 @@ static GSList *find_dialing(GSList *calls) c = g_slist_find_custom(calls, GINT_TO_POINTER(CALL_STATUS_DIALING), at_util_call_compare_by_status); - if (!c) + if (c == NULL) c = g_slist_find_custom(calls, GINT_TO_POINTER(CALL_STATUS_ALERTING), at_util_call_compare_by_status); @@ -97,8 +97,7 @@ static struct ofono_call *create_call(struct ofono_voicecall *vc, int type, /* Generate a call structure for the waiting call */ call = g_try_new0(struct ofono_call, 1); - - if (!call) + if (call == NULL) return NULL; call->id = ofono_voicecall_get_next_callid(vc); @@ -225,7 +224,7 @@ static void clcc_poll_cb(gboolean ok, GAtResult *result, gpointer user_data) if (nc && (nc->status == CALL_STATUS_HELD)) num_held++; - if (oc && (!nc || (nc->id > oc->id))) { + if (oc && (nc == NULL || (nc->id > oc->id))) { enum ofono_disconnect_reason reason; if (vd->local_release & (0x1 << oc->id)) @@ -240,7 +239,7 @@ static void clcc_poll_cb(gboolean ok, GAtResult *result, gpointer user_data) vd->local_release &= ~(1 << oc->id); o = o->next; - } else if (nc && (!oc || (nc->id < oc->id))) { + } else if (nc && (oc == NULL || (nc->id < oc->id))) { /* new call, signal it */ if (nc->type == 0) ofono_voicecall_notify(vc, nc); @@ -344,8 +343,7 @@ static void atd_cb(gboolean ok, GAtResult *result, gpointer user_data) } call = create_call(vc, 0, 0, CALL_STATUS_DIALING, NULL, type, validity); - - if (!call) { + if (call == NULL) { ofono_error("Unable to allocate call, " "call tracking will fail!"); return; @@ -364,7 +362,7 @@ static void hfp_dial(struct ofono_voicecall *vc, struct cb_data *cbd = cb_data_new(cb, data); char buf[256]; - if (!cbd) + if (cbd == NULL) goto error; cbd->user = vc; @@ -392,7 +390,7 @@ static void hfp_template(const char *cmd, struct ofono_voicecall *vc, struct voicecall_data *vd = ofono_voicecall_get_data(vc); struct change_state_req *req = g_try_new0(struct change_state_req, 1); - if (!req) + if (req == NULL) goto error; req->vc = vc; @@ -506,7 +504,7 @@ static void hfp_release_specific(struct ofono_voicecall *vc, int id, req = g_try_new0(struct release_id_req, 1); - if (!req) + if (req == NULL) goto error; req->vc = vc; @@ -584,7 +582,7 @@ static void hfp_send_dtmf(struct ofono_voicecall *vc, const char *dtmf, char *buf; int s; - if (!req) + if (req == NULL) goto error; req->vc = vc; @@ -595,7 +593,7 @@ static void hfp_send_dtmf(struct ofono_voicecall *vc, const char *dtmf, /* strlen("AT+VTS=") = 7 */ buf = g_try_new(char, strlen(dtmf) + 7); - if (!buf) + if (buf == NULL) goto error; sprintf(buf, "AT+VTS=%s", dtmf); @@ -654,7 +652,7 @@ static void ccwa_notify(GAtResult *result, gpointer user_data) call = create_call(vc, 0, 1, 5, num, num_type, validity); - if (!call) { + if (call == NULL) { ofono_error("malloc call struct failed. " "Call management is fubar"); return; @@ -725,7 +723,7 @@ static void ring_notify(GAtResult *result, gpointer user_data) /* Generate an incoming call of voice type */ call = create_call(vc, 0, 1, CALL_STATUS_INCOMING, NULL, 128, 2); - if (!call) + if (call == NULL) ofono_error("Couldn't create call, call management is fubar!"); /* We don't know the number must wait for CLIP to arrive before @@ -878,11 +876,11 @@ static void sync_dialing_cb(gboolean ok, GAtResult *result, gpointer user_data) */ o = find_dialing(vd->calls); - if (!n && o) { + if (n == NULL && o) { oc = o->data; release_call(vc, oc); vd->calls = g_slist_remove(vd->calls, oc); - } else if (n && !o) { + } else if (n && o == NULL) { nc = n->data; new_call_notify(vc, nc->type, nc->direction, nc->status, nc->phone_number.number, nc->phone_number.type, -- cgit v1.2.3