* [PATCH 2/9] drivers: explicitly compare pointers to NULL
2010-11-27 19:38 [PATCH 1/9] coding-style: add rule about checking NULL pointer Lucas De Marchi
@ 2010-11-27 19:38 ` Lucas De Marchi
2010-11-29 20:48 ` Denis Kenzior
2010-11-27 19:38 ` [PATCH 3/9] unit: " Lucas De Marchi
` (7 subsequent siblings)
8 siblings, 1 reply; 20+ messages in thread
From: Lucas De Marchi @ 2010-11-27 19:38 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 78356 bytes --]
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>
---
drivers/atmodem/atutil.c | 2 +-
drivers/atmodem/atutil.h | 2 +-
drivers/atmodem/call-barring.c | 6 ++--
drivers/atmodem/call-forwarding.c | 4 +-
drivers/atmodem/call-meter.c | 14 ++++++------
drivers/atmodem/call-settings.c | 14 ++++++------
drivers/atmodem/call-volume.c | 4 +-
drivers/atmodem/cbs.c | 6 ++--
drivers/atmodem/devinfo.c | 8 +++---
drivers/atmodem/gprs-context.c | 2 +-
drivers/atmodem/gprs.c | 6 ++--
drivers/atmodem/network-registration.c | 18 ++++++++--------
drivers/atmodem/phonebook.c | 4 +-
drivers/atmodem/sim-poll.c | 2 +-
drivers/atmodem/sim.c | 32 +++++++++++++++---------------
drivers/atmodem/sms.c | 12 +++++-----
drivers/atmodem/stk.c | 4 +-
drivers/atmodem/ussd.c | 6 ++--
drivers/atmodem/voicecall.c | 24 +++++++++++-----------
drivers/calypsomodem/stk.c | 6 ++--
drivers/calypsomodem/voicecall.c | 6 ++--
drivers/hfpmodem/call-volume.c | 4 +-
drivers/hfpmodem/network-registration.c | 6 ++--
drivers/hfpmodem/voicecall.c | 28 +++++++++++++-------------
drivers/hsomodem/gprs-context.c | 4 +-
drivers/hsomodem/radio-settings.c | 2 +-
drivers/huaweimodem/audio-settings.c | 2 +-
drivers/huaweimodem/gprs-context.c | 6 ++--
drivers/huaweimodem/voicecall.c | 8 +++---
drivers/ifxmodem/audio-settings.c | 2 +-
drivers/ifxmodem/gprs-context.c | 8 +++---
drivers/ifxmodem/radio-settings.c | 2 +-
drivers/ifxmodem/stk.c | 6 ++--
drivers/ifxmodem/voicecall.c | 18 ++++++++--------
drivers/isimodem/audio-settings.c | 6 ++--
drivers/isimodem/call-barring.c | 12 +++++-----
drivers/isimodem/call-forwarding.c | 12 +++++-----
drivers/isimodem/call-meter.c | 4 +-
drivers/isimodem/call-settings.c | 10 ++++----
drivers/isimodem/cbs.c | 9 +++----
drivers/isimodem/devinfo.c | 12 +++++-----
drivers/isimodem/gprs-context.c | 19 +++++++----------
drivers/isimodem/gprs.c | 10 ++++----
drivers/isimodem/infoserver.c | 4 +-
drivers/isimodem/network-registration.c | 22 +++++++++-----------
drivers/isimodem/phonebook.c | 10 ++++----
drivers/isimodem/radio-settings.c | 10 ++++----
drivers/isimodem/sim.c | 12 +++++-----
drivers/isimodem/sms.c | 17 +++++++--------
drivers/isimodem/ssn.c | 6 ++--
drivers/isimodem/ussd.c | 10 ++++----
drivers/isimodem/voicecall.c | 12 ++++------
drivers/mbmmodem/gprs-context.c | 6 ++--
drivers/mbmmodem/stk.c | 6 ++--
drivers/nwmodem/radio-settings.c | 2 +-
drivers/stemodem/gprs-context.c | 14 ++++++------
drivers/stemodem/radio-settings.c | 2 +-
drivers/stemodem/voicecall.c | 16 +++++++-------
58 files changed, 256 insertions(+), 265 deletions(-)
diff --git a/drivers/atmodem/atutil.c b/drivers/atmodem/atutil.c
index fe7cbfc..576094f 100644
--- a/drivers/atmodem/atutil.c
+++ b/drivers/atmodem/atutil.c
@@ -134,7 +134,7 @@ GSList *at_util_parse_clcc(GAtResult *result)
call = g_try_new0(struct ofono_call, 1);
- if (!call)
+ if (call == NULL)
break;
call->id = id;
diff --git a/drivers/atmodem/atutil.h b/drivers/atmodem/atutil.h
index 7dbb8a6..324fb4e 100644
--- a/drivers/atmodem/atutil.h
+++ b/drivers/atmodem/atutil.h
@@ -83,7 +83,7 @@ static inline struct cb_data *cb_data_new(void *cb, void *data)
ret = g_try_new0(struct cb_data, 1);
- if (!ret)
+ if (ret == NULL)
return ret;
ret->cb = cb;
diff --git a/drivers/atmodem/call-barring.c b/drivers/atmodem/call-barring.c
index 50e0eef..c0b1d11 100644
--- a/drivers/atmodem/call-barring.c
+++ b/drivers/atmodem/call-barring.c
@@ -86,7 +86,7 @@ static void at_call_barring_query(struct ofono_call_barring *cb,
struct cb_data *cbd = cb_data_new(callback, data);
char buf[64];
- if (!cbd || strlen(lock) != 2)
+ if (cbd == NULL || strlen(lock) != 2)
goto error;
snprintf(buf, sizeof(buf), "AT+CLCK=\"%s\",2", lock);
@@ -121,7 +121,7 @@ static void at_call_barring_set(struct ofono_call_barring *cb, const char *lock,
char buf[64];
int len;
- if (!cbd || strlen(lock) != 2 || (cls && !passwd))
+ if (cbd == NULL || strlen(lock) != 2 || (cls && passwd == NULL))
goto error;
len = snprintf(buf, sizeof(buf), "AT+CLCK=\"%s\",%i", lock, enable);
@@ -164,7 +164,7 @@ static void at_call_barring_set_passwd(struct ofono_call_barring *cb,
struct cb_data *cbd = cb_data_new(callback, data);
char buf[64];
- if (!cbd || strlen(lock) != 2)
+ if (cbd == NULL || strlen(lock) != 2)
goto error;
snprintf(buf, sizeof(buf), "AT+CPWD=\"%s\",\"%s\",\"%s\"",
diff --git a/drivers/atmodem/call-forwarding.c b/drivers/atmodem/call-forwarding.c
index d20ac2e..a74d4c3 100644
--- a/drivers/atmodem/call-forwarding.c
+++ b/drivers/atmodem/call-forwarding.c
@@ -128,7 +128,7 @@ static void at_ccfc_query(struct ofono_call_forwarding *cf, int type, int cls,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[64];
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = GINT_TO_POINTER(cls);
@@ -165,7 +165,7 @@ static void at_ccfc_set(struct ofono_call_forwarding *cf, const char *buf,
GAtChat *chat = ofono_call_forwarding_get_data(cf);
struct cb_data *cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (g_at_chat_send(chat, buf, none_prefix,
diff --git a/drivers/atmodem/call-meter.c b/drivers/atmodem/call-meter.c
index 28359af..5c93397 100644
--- a/drivers/atmodem/call-meter.c
+++ b/drivers/atmodem/call-meter.c
@@ -116,7 +116,7 @@ static void at_caoc_query(struct ofono_call_meter *cm,
GAtChat *chat = ofono_call_meter_get_data(cm);
struct cb_data *cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = "+CAOC:";
@@ -137,7 +137,7 @@ static void at_cacm_query(struct ofono_call_meter *cm,
GAtChat *chat = ofono_call_meter_get_data(cm);
struct cb_data *cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = "+CACM:";
@@ -169,7 +169,7 @@ static void at_cacm_set(struct ofono_call_meter *cm, const char *passwd,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[64];
- if (!cbd)
+ if (cbd == NULL)
goto error;
snprintf(buf, sizeof(buf), "AT+CACM=\"%s\"", passwd);
@@ -191,7 +191,7 @@ static void at_camm_query(struct ofono_call_meter *cm,
GAtChat *chat = ofono_call_meter_get_data(cm);
struct cb_data *cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = "+CAMM:";
@@ -213,7 +213,7 @@ static void at_camm_set(struct ofono_call_meter *cm,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[64];
- if (!cbd)
+ if (cbd == NULL)
goto error;
snprintf(buf, sizeof(buf), "AT+CAMM=\"%06X\",\"%s\"", accmax, passwd);
@@ -274,7 +274,7 @@ static void at_cpuc_query(struct ofono_call_meter *cm,
GAtChat *chat = ofono_call_meter_get_data(cm);
struct cb_data *cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = "+CPUC:";
@@ -296,7 +296,7 @@ static void at_cpuc_set(struct ofono_call_meter *cm, const char *currency,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[64];
- if (!cbd)
+ if (cbd == NULL)
goto error;
snprintf(buf, sizeof(buf), "AT+CPUC=\"%s\",\"%f\",\"%s\"",
diff --git a/drivers/atmodem/call-settings.c b/drivers/atmodem/call-settings.c
index b5acc02..05c9438 100644
--- a/drivers/atmodem/call-settings.c
+++ b/drivers/atmodem/call-settings.c
@@ -84,7 +84,7 @@ static void at_ccwa_query(struct ofono_call_settings *cs, int cls,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[64];
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = GINT_TO_POINTER(cls);
@@ -122,7 +122,7 @@ static void at_ccwa_set(struct ofono_call_settings *cs, int mode, int cls,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[64];
- if (!cbd)
+ if (cbd == NULL)
goto error;
snprintf(buf, sizeof(buf), "AT+CCWA=1,%d,%d", mode, cls);
@@ -175,7 +175,7 @@ static void at_clip_query(struct ofono_call_settings *cs,
GAtChat *chat = ofono_call_settings_get_data(cs);
struct cb_data *cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (g_at_chat_send(chat, "AT+CLIP?", clip_prefix,
@@ -225,7 +225,7 @@ static void at_colp_query(struct ofono_call_settings *cs,
GAtChat *chat = ofono_call_settings_get_data(cs);
struct cb_data *cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (g_at_chat_send(chat, "AT+COLP?", colp_prefix,
@@ -274,7 +274,7 @@ static void at_clir_query(struct ofono_call_settings *cs,
GAtChat *chat = ofono_call_settings_get_data(cs);
struct cb_data *cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (g_at_chat_send(chat, "AT+CLIR?", clir_prefix,
@@ -305,7 +305,7 @@ static void at_clir_set(struct ofono_call_settings *cs, int mode,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[64];
- if (!cbd)
+ if (cbd == NULL)
goto error;
snprintf(buf, sizeof(buf), "AT+CLIR=%d", mode);
@@ -358,7 +358,7 @@ static void at_colr_query(struct ofono_call_settings *cs,
GAtChat *chat = ofono_call_settings_get_data(cs);
struct cb_data *cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (g_at_chat_send(chat, "AT+COLR", colr_prefix,
diff --git a/drivers/atmodem/call-volume.c b/drivers/atmodem/call-volume.c
index 76d2f96..fbec668 100644
--- a/drivers/atmodem/call-volume.c
+++ b/drivers/atmodem/call-volume.c
@@ -138,7 +138,7 @@ static void at_call_volume_speaker_volume(struct ofono_call_volume *cv,
char buf[64];
int level;
- if (!cbd)
+ if (cbd == NULL)
goto error;
level = ((cvd->clvl_max - cvd->clvl_min) *
@@ -163,7 +163,7 @@ static void at_call_volume_mute(struct ofono_call_volume *cv, int muted,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[64];
- if (!cbd)
+ if (cbd == NULL)
goto error;
snprintf(buf, sizeof(buf), "AT+CMUT=%d", muted);
diff --git a/drivers/atmodem/cbs.c b/drivers/atmodem/cbs.c
index 2ae75fb..17488ef 100644
--- a/drivers/atmodem/cbs.c
+++ b/drivers/atmodem/cbs.c
@@ -75,7 +75,7 @@ static void at_cbm_notify(GAtResult *result, gpointer user_data)
hexpdu = g_at_result_pdu(result);
- if (!hexpdu) {
+ if (hexpdu == NULL) {
ofono_error("Got a CBM, but no PDU. Are we in text mode?");
return;
}
@@ -116,7 +116,7 @@ static void at_cbs_set_topics(struct ofono_cbs *cbs, const char *topics,
DBG("");
- if (!cbd)
+ if (cbd == NULL)
goto error;
/* For the Qualcomm based devices it is required to clear
@@ -155,7 +155,7 @@ static void at_cbs_clear_topics(struct ofono_cbs *cbs,
DBG("");
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (data->cscb_mode_1)
diff --git a/drivers/atmodem/devinfo.c b/drivers/atmodem/devinfo.c
index 4d3cf98..84ff898 100644
--- a/drivers/atmodem/devinfo.c
+++ b/drivers/atmodem/devinfo.c
@@ -92,7 +92,7 @@ static void at_query_manufacturer(struct ofono_devinfo *info,
struct cb_data *cbd = cb_data_new(cb, data);
GAtChat *chat = ofono_devinfo_get_data(info);
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = "+CGMI:";
@@ -113,7 +113,7 @@ static void at_query_model(struct ofono_devinfo *info,
struct cb_data *cbd = cb_data_new(cb, data);
GAtChat *chat = ofono_devinfo_get_data(info);
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = "+CGMM:";
@@ -134,7 +134,7 @@ static void at_query_revision(struct ofono_devinfo *info,
struct cb_data *cbd = cb_data_new(cb, data);
GAtChat *chat = ofono_devinfo_get_data(info);
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = "+CGMR:";
@@ -155,7 +155,7 @@ static void at_query_serial(struct ofono_devinfo *info,
struct cb_data *cbd = cb_data_new(cb, data);
GAtChat *chat = ofono_devinfo_get_data(info);
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = "+CGSN:";
diff --git a/drivers/atmodem/gprs-context.c b/drivers/atmodem/gprs-context.c
index 03c6f46..6b657f3 100644
--- a/drivers/atmodem/gprs-context.c
+++ b/drivers/atmodem/gprs-context.c
@@ -282,7 +282,7 @@ static int at_gprs_context_probe(struct ofono_gprs_context *gc,
}
gcd = g_try_new0(struct gprs_context_data, 1);
- if (!gcd)
+ if (gcd == NULL)
return -ENOMEM;
gcd->chat = g_at_chat_clone(chat);
diff --git a/drivers/atmodem/gprs.c b/drivers/atmodem/gprs.c
index 94247ec..8cff35b 100644
--- a/drivers/atmodem/gprs.c
+++ b/drivers/atmodem/gprs.c
@@ -69,7 +69,7 @@ static void at_gprs_set_attached(struct ofono_gprs *gprs, int attached,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[64];
- if (!cbd)
+ if (cbd == NULL)
goto error;
snprintf(buf, sizeof(buf), "AT+CGATT=%i", attached ? 1 : 0);
@@ -115,7 +115,7 @@ static void at_gprs_registration_status(struct ofono_gprs *gprs,
struct gprs_data *gd = ofono_gprs_get_data(gprs);
struct cb_data *cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = gd;
@@ -350,7 +350,7 @@ static int at_gprs_probe(struct ofono_gprs *gprs,
struct gprs_data *gd;
gd = g_try_new0(struct gprs_data, 1);
- if (!gd)
+ if (gd == NULL)
return -ENOMEM;
gd->chat = g_at_chat_clone(chat);
diff --git a/drivers/atmodem/network-registration.c b/drivers/atmodem/network-registration.c
index 5b87b39..1f0bc4f 100644
--- a/drivers/atmodem/network-registration.c
+++ b/drivers/atmodem/network-registration.c
@@ -182,7 +182,7 @@ static void at_registration_status(struct ofono_netreg *netreg,
struct netreg_data *nd = ofono_netreg_get_data(netreg);
struct cb_data *cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = nd;
@@ -349,7 +349,7 @@ static void at_current_operator(struct ofono_netreg *netreg,
struct cb_data *cbd = cb_data_new(cb, data);
gboolean ok;
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = netreg;
@@ -409,7 +409,7 @@ static void cops_list_cb(gboolean ok, GAtResult *result, gpointer user_data)
list = g_try_new0(struct ofono_network_operator, num);
- if (!list) {
+ if (list == NULL) {
CALLBACK_WITH_FAILURE(cb, 0, NULL, cbd->data);
return;
}
@@ -492,7 +492,7 @@ static void at_list_operators(struct ofono_netreg *netreg,
struct netreg_data *nd = ofono_netreg_get_data(netreg);
struct cb_data *cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (g_at_chat_send(nd->chat, "AT+COPS=?", cops_prefix,
@@ -522,7 +522,7 @@ static void at_register_auto(struct ofono_netreg *netreg,
struct netreg_data *nd = ofono_netreg_get_data(netreg);
struct cb_data *cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (g_at_chat_send(nd->chat, "AT+COPS=0", none_prefix,
@@ -543,7 +543,7 @@ static void at_register_manual(struct ofono_netreg *netreg,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[128];
- if (!cbd)
+ if (cbd == NULL)
goto error;
snprintf(buf, sizeof(buf), "AT+COPS=1,2,\"%s%s\"", mcc, mnc);
@@ -564,7 +564,7 @@ static void at_deregister(struct ofono_netreg *netreg,
struct netreg_data *nd = ofono_netreg_get_data(netreg);
struct cb_data *cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (g_at_chat_send(nd->chat, "AT+COPS=2", none_prefix,
@@ -862,7 +862,7 @@ static void at_signal_strength(struct ofono_netreg *netreg,
struct netreg_data *nd = ofono_netreg_get_data(netreg);
struct cb_data *cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = nd;
@@ -1045,7 +1045,7 @@ static void creg_notify(GAtResult *result, gpointer user_data)
switch (nd->vendor) {
case OFONO_VENDOR_OPTION_HSO:
tq = g_new0(struct tech_query, 1);
- if (!tq)
+ if (tq == NULL)
break;
tq->status = status;
diff --git a/drivers/atmodem/phonebook.c b/drivers/atmodem/phonebook.c
index dede235..731205e 100644
--- a/drivers/atmodem/phonebook.c
+++ b/drivers/atmodem/phonebook.c
@@ -368,7 +368,7 @@ static void at_export_entries(struct ofono_phonebook *pb, const char *storage,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[32];
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = pb;
@@ -536,7 +536,7 @@ static int at_phonebook_probe(struct ofono_phonebook *pb, unsigned int vendor,
struct pb_data *pbd;
pbd = g_try_new0(struct pb_data, 1);
- if (!pbd)
+ if (pbd == NULL)
return -ENOMEM;
pbd->chat = g_at_chat_clone(chat);
diff --git a/drivers/atmodem/sim-poll.c b/drivers/atmodem/sim-poll.c
index ae1b55c..daef24a 100644
--- a/drivers/atmodem/sim-poll.c
+++ b/drivers/atmodem/sim-poll.c
@@ -246,7 +246,7 @@ void atmodem_poll_enable(struct ofono_modem *modem, GAtChat *chat)
sim_atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_SIM);
stk_atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_STK);
- if (!sim_atom)
+ if (sim_atom == NULL)
return;
spd = g_new0(struct sim_poll_data, 1);
diff --git a/drivers/atmodem/sim.c b/drivers/atmodem/sim.c
index 9cfdc65..1653ede 100644
--- a/drivers/atmodem/sim.c
+++ b/drivers/atmodem/sim.c
@@ -138,7 +138,7 @@ static void at_sim_read_info(struct ofono_sim *sim, int fileid,
}
cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
snprintf(buf, sizeof(buf), "AT+CRSM=192,%i", fileid);
@@ -211,7 +211,7 @@ static void at_sim_read_binary(struct ofono_sim *sim, int fileid,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[64];
- if (!cbd)
+ if (cbd == NULL)
goto error;
snprintf(buf, sizeof(buf), "AT+CRSM=176,%i,%i,%i,%i", fileid,
@@ -235,7 +235,7 @@ static void at_sim_read_record(struct ofono_sim *sim, int fileid,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[64];
- if (!cbd)
+ if (cbd == NULL)
goto error;
snprintf(buf, sizeof(buf), "AT+CRSM=178,%i,%i,4,%i", fileid,
@@ -300,7 +300,7 @@ static void at_sim_update_binary(struct ofono_sim *sim, int fileid,
char *buf = g_try_new(char, 36 + length * 2);
int len, ret;
- if (!cbd || !buf)
+ if (cbd == NULL || buf == NULL)
goto error;
len = sprintf(buf, "AT+CRSM=214,%i,%i,%i,%i,", fileid,
@@ -333,7 +333,7 @@ static void at_sim_update_record(struct ofono_sim *sim, int fileid,
char *buf = g_try_new(char, 36 + length * 2);
int len, ret;
- if (!cbd || !buf)
+ if (cbd == NULL || buf == NULL)
goto error;
len = sprintf(buf, "AT+CRSM=220,%i,%i,4,%i,", fileid,
@@ -365,7 +365,7 @@ static void at_sim_update_cyclic(struct ofono_sim *sim, int fileid,
char *buf = g_try_new(char, 36 + length * 2);
int len, ret;
- if (!cbd || !buf)
+ if (cbd == NULL || buf == NULL)
goto error;
len = sprintf(buf, "AT+CRSM=220,%i,0,3,%i,", fileid, length);
@@ -421,7 +421,7 @@ static void at_read_imsi(struct ofono_sim *sim, ofono_sim_imsi_cb_t cb,
struct sim_data *sd = ofono_sim_get_data(sim);
struct cb_data *cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (g_at_chat_send(sd->chat, "AT+CIMI", NULL,
@@ -517,7 +517,7 @@ static void at_pin_query(struct ofono_sim *sim, ofono_sim_passwd_cb_t cb,
struct sim_data *sd = ofono_sim_get_data(sim);
struct cb_data *cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = sim;
@@ -626,7 +626,7 @@ static void at_pin_send(struct ofono_sim *sim, const char *passwd,
char buf[64];
int ret;
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = sd;
@@ -656,7 +656,7 @@ static void at_pin_send_puk(struct ofono_sim *sim, const char *puk,
char buf[64];
int ret;
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = sd;
@@ -711,10 +711,10 @@ static void at_pin_enable(struct ofono_sim *sim,
int ret;
unsigned int len = sizeof(at_clck_cpwd_fac) / sizeof(*at_clck_cpwd_fac);
- if (!cbd)
+ if (cbd == NULL)
goto error;
- if (passwd_type >= len || !at_clck_cpwd_fac[passwd_type])
+ if (passwd_type >= len || at_clck_cpwd_fac[passwd_type] == NULL)
goto error;
snprintf(buf, sizeof(buf), "AT+CLCK=\"%s\",%i,\"%s\"",
@@ -745,11 +745,11 @@ static void at_change_passwd(struct ofono_sim *sim,
int ret;
unsigned int len = sizeof(at_clck_cpwd_fac) / sizeof(*at_clck_cpwd_fac);
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (passwd_type >= len ||
- !at_clck_cpwd_fac[passwd_type])
+ at_clck_cpwd_fac[passwd_type] == NULL)
goto error;
snprintf(buf, sizeof(buf), "AT+CPWD=\"%s\",\"%s\",\"%s\"",
@@ -808,10 +808,10 @@ static void at_pin_query_enabled(struct ofono_sim *sim,
char buf[64];
unsigned int len = sizeof(at_clck_cpwd_fac) / sizeof(*at_clck_cpwd_fac);
- if (!cbd)
+ if (cbd == NULL)
goto error;
- if (passwd_type >= len || !at_clck_cpwd_fac[passwd_type])
+ if (passwd_type >= len || at_clck_cpwd_fac[passwd_type] == NULL)
goto error;
snprintf(buf, sizeof(buf), "AT+CLCK=\"%s\",2",
diff --git a/drivers/atmodem/sms.c b/drivers/atmodem/sms.c
index d6683fe..5298b1b 100644
--- a/drivers/atmodem/sms.c
+++ b/drivers/atmodem/sms.c
@@ -106,7 +106,7 @@ static void at_csca_set(struct ofono_sms *sms,
struct cb_data *cbd = cb_data_new(cb, user_data);
char buf[64];
- if (!cbd)
+ if (cbd == NULL)
goto error;
snprintf(buf, sizeof(buf), "AT+CSCA=\"%s\",%d", sca->number, sca->type);
@@ -173,7 +173,7 @@ static void at_csca_query(struct ofono_sms *sms, ofono_sms_sca_query_cb_t cb,
struct sms_data *data = ofono_sms_get_data(sms);
struct cb_data *cbd = cb_data_new(cb, user_data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (g_at_chat_send(data->chat, "AT+CSCA?", csca_prefix,
@@ -227,7 +227,7 @@ static void at_cmgs(struct ofono_sms *sms, unsigned char *pdu, int pdu_len,
char buf[512];
int len;
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (mms) {
@@ -267,7 +267,7 @@ static void at_cgsms_set(struct ofono_sms *sms, int bearer,
struct cb_data *cbd = cb_data_new(cb, user_data);
char buf[64];
- if (!cbd)
+ if (cbd == NULL)
goto error;
snprintf(buf, sizeof(buf), "AT+CGSMS=%d", bearer);
@@ -319,7 +319,7 @@ static void at_cgsms_query(struct ofono_sms *sms,
struct sms_data *data = ofono_sms_get_data(sms);
struct cb_data *cbd = cb_data_new(cb, user_data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (g_at_chat_send(data->chat, "AT+CGSMS?", cgsms_prefix,
@@ -867,7 +867,7 @@ static void construct_ack_pdu(struct sms_data *d)
d->cnma_ack_pdu = encode_hex(pdu, tpdu_len, 0);
- if (!d->cnma_ack_pdu)
+ if (d->cnma_ack_pdu == NULL)
goto err;
d->cnma_ack_pdu_len = tpdu_len;
diff --git a/drivers/atmodem/stk.c b/drivers/atmodem/stk.c
index bd4a7d2..fa8175a 100644
--- a/drivers/atmodem/stk.c
+++ b/drivers/atmodem/stk.c
@@ -153,7 +153,7 @@ static void at_stk_envelope(struct ofono_stk *stk, int length,
char *buf = g_try_new(char, 64 + length * 2);
int len, ret;
- if (!cbd || !buf)
+ if (cbd == NULL || buf == NULL)
goto error;
len = sprintf(buf, "AT+CSIM=%i,A0C20000%02hhX",
@@ -236,7 +236,7 @@ static void at_stk_terminal_response(struct ofono_stk *stk, int length,
char *buf = g_try_new(char, 64 + length * 2);
int len, ret;
- if (!cbd || !buf)
+ if (cbd == NULL || buf == NULL)
goto error;
len = sprintf(buf, "AT+CSIM=%i,A0140000%02hhX",
diff --git a/drivers/atmodem/ussd.c b/drivers/atmodem/ussd.c
index f38dfd0..78f6004 100644
--- a/drivers/atmodem/ussd.c
+++ b/drivers/atmodem/ussd.c
@@ -187,7 +187,7 @@ static void at_ussd_request(struct ofono_ussd *ussd, int dcs,
char buf[512];
enum sms_charset charset;
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = ussd;
@@ -212,7 +212,7 @@ static void at_ussd_request(struct ofono_ussd *ussd, int dcs,
char coded_buf[321];
char *converted = encode_hex_own_buf(pdu, len, 0, coded_buf);
- if (!converted)
+ if (converted == NULL)
goto error;
snprintf(buf, sizeof(buf), "AT+CUSD=1,\"%s\",%d",
@@ -264,7 +264,7 @@ static void at_ussd_cancel(struct ofono_ussd *ussd,
struct ussd_data *data = ofono_ussd_get_data(ussd);
struct cb_data *cbd = cb_data_new(cb, user_data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = data;
diff --git a/drivers/atmodem/voicecall.c b/drivers/atmodem/voicecall.c
index 10b8f4b..83c43d6 100644
--- a/drivers/atmodem/voicecall.c
+++ b/drivers/atmodem/voicecall.c
@@ -106,7 +106,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);
@@ -154,7 +154,7 @@ static void clcc_poll_cb(gboolean ok, GAtResult *result, gpointer user_data)
if (nc && nc->status >= 2 && nc->status <= 5)
poll_again = TRUE;
- 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))
@@ -167,7 +167,7 @@ static void clcc_poll_cb(gboolean ok, GAtResult *result, gpointer user_data)
reason, NULL);
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);
@@ -309,7 +309,7 @@ static void atd_cb(gboolean ok, GAtResult *result, gpointer user_data)
/* Generate a voice call that was just dialed, we guess the ID */
call = create_call(vc, 0, 0, 2, num, type, validity);
- if (!call) {
+ if (call == NULL) {
ofono_error("Unable to malloc, call tracking will fail!");
return;
}
@@ -339,7 +339,7 @@ static void at_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;
@@ -387,7 +387,7 @@ static void at_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;
@@ -467,7 +467,7 @@ static void at_release_specific(struct ofono_voicecall *vc, int id,
struct release_id_req *req = g_try_new0(struct release_id_req, 1);
char buf[32];
- if (!req)
+ if (req == NULL)
goto error;
req->vc = vc;
@@ -571,14 +571,14 @@ static void at_send_dtmf(struct ofono_voicecall *vc, const char *dtmf,
int i;
char *buf;
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = vd;
/* strlen("+VTS=T;") = 7 + initial AT + null */
buf = g_try_new(char, len * 9 + 3);
- if (!buf)
+ if (buf == NULL)
goto error;
s = sprintf(buf, "AT+VTS=%c", dtmf[0]);
@@ -621,7 +621,7 @@ static void ring_notify(GAtResult *result, gpointer user_data)
/* Generate an incoming call of unknown type */
call = create_call(vc, 9, 1, 4, NULL, 128, 2);
- if (!call) {
+ if (call == NULL) {
ofono_error("Couldn't create call, call management is fubar!");
return;
}
@@ -788,7 +788,7 @@ static void ccwa_notify(GAtResult *result, gpointer user_data)
call = create_call(vc, class_to_call_type(cls), 1, 5,
num, num_type, validity);
- if (!call) {
+ if (call == NULL) {
ofono_error("Unable to malloc. Call management is fubar");
return;
}
@@ -887,7 +887,7 @@ static int at_voicecall_probe(struct ofono_voicecall *vc, unsigned int vendor,
struct voicecall_data *vd;
vd = g_try_new0(struct voicecall_data, 1);
- if (!vd)
+ if (vd == NULL)
return -ENOMEM;
vd->chat = g_at_chat_clone(chat);
diff --git a/drivers/calypsomodem/stk.c b/drivers/calypsomodem/stk.c
index 334abc6..203cb9b 100644
--- a/drivers/calypsomodem/stk.c
+++ b/drivers/calypsomodem/stk.c
@@ -101,7 +101,7 @@ static void calypso_stk_envelope(struct ofono_stk *stk, int length,
DBG("");
- if (!cbd || !buf)
+ if (cbd == NULL || buf == NULL)
goto error;
len = sprintf(buf, "AT%%SATE=\"");
@@ -148,7 +148,7 @@ static void calypso_stk_terminal_response(struct ofono_stk *stk, int length,
DBG("");
- if (!cbd || !buf)
+ if (cbd == NULL || buf == NULL)
goto error;
len = sprintf(buf, "AT%%SATR=\"");
@@ -258,7 +258,7 @@ static int calypso_stk_probe(struct ofono_stk *stk,
DBG("");
sd = g_try_new0(struct stk_data, 1);
- if (!sd)
+ if (sd == NULL)
return -ENOMEM;
sd->chat = g_at_chat_clone(chat);
diff --git a/drivers/calypsomodem/voicecall.c b/drivers/calypsomodem/voicecall.c
index b2c9a96..0e6a388 100644
--- a/drivers/calypsomodem/voicecall.c
+++ b/drivers/calypsomodem/voicecall.c
@@ -64,7 +64,7 @@ static void calypso_template(struct ofono_voicecall *vc, const char *cmd,
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
struct cb_data *cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (g_at_chat_send(vd->chat, cmd, none_prefix,
@@ -210,7 +210,7 @@ static void calypso_send_dtmf(struct ofono_voicecall *vc, const char *dtmf,
/* strlen("+VTS=\"T\";") = 9 + initial AT + null */
buf = g_try_new(char, len * 9 + 3);
- if (!buf) {
+ if (buf == NULL) {
CALLBACK_WITH_FAILURE(cb, data);
return;
}
@@ -390,7 +390,7 @@ static int calypso_voicecall_probe(struct ofono_voicecall *vc,
struct voicecall_data *vd;
vd = g_try_new0(struct voicecall_data, 1);
- if (!vd)
+ if (vd == NULL)
return -ENOMEM;
vd->chat = g_at_chat_clone(chat);
diff --git a/drivers/hfpmodem/call-volume.c b/drivers/hfpmodem/call-volume.c
index d3807f7..f985175 100644
--- a/drivers/hfpmodem/call-volume.c
+++ b/drivers/hfpmodem/call-volume.c
@@ -73,7 +73,7 @@ static void hfp_speaker_volume(struct ofono_call_volume *cv,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[64];
- if (!cbd)
+ if (cbd == NULL)
goto error;
vd->sp_volume = percent;
@@ -100,7 +100,7 @@ static void hfp_microphone_volume(struct ofono_call_volume *cv,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[64];
- if (!cbd)
+ if (cbd == NULL)
goto error;
vd->mic_volume = percent;
diff --git a/drivers/hfpmodem/network-registration.c b/drivers/hfpmodem/network-registration.c
index 5f123fc..03ddc7b 100644
--- a/drivers/hfpmodem/network-registration.c
+++ b/drivers/hfpmodem/network-registration.c
@@ -236,7 +236,7 @@ static void hfp_registration_status(struct ofono_netreg *netreg,
struct cb_data *cbd = cb_data_new(cb, data);
gboolean ok;
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = netreg;
@@ -259,7 +259,7 @@ static void hfp_current_operator(struct ofono_netreg *netreg,
struct cb_data *cbd = cb_data_new(cb, data);
gboolean ok;
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = netreg;
@@ -284,7 +284,7 @@ static void hfp_signal_strength(struct ofono_netreg *netreg,
struct netreg_data *nd = ofono_netreg_get_data(netreg);
struct cb_data *cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = netreg;
diff --git a/drivers/hfpmodem/voicecall.c b/drivers/hfpmodem/voicecall.c
index e96ec7c..a8adc78 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);
@@ -98,7 +98,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 +225,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 +240,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);
@@ -345,7 +345,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 +364,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 +392,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 +506,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 +584,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 +595,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 +654,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 +725,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 +878,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,
diff --git a/drivers/hsomodem/gprs-context.c b/drivers/hsomodem/gprs-context.c
index dc6f1b6..a3f55ab 100644
--- a/drivers/hsomodem/gprs-context.c
+++ b/drivers/hsomodem/gprs-context.c
@@ -156,7 +156,7 @@ static void hso_gprs_activate_primary(struct ofono_gprs_context *gc,
char buf[AUTH_BUF_LENGTH];
int len;
- if (!cbd)
+ if (cbd == NULL)
goto error;
gcd->active_context = ctx->cid;
@@ -200,7 +200,7 @@ static void hso_gprs_deactivate_primary(struct ofono_gprs_context *gc,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[128];
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = gc;
diff --git a/drivers/hsomodem/radio-settings.c b/drivers/hsomodem/radio-settings.c
index 3e22065..70c0efe 100644
--- a/drivers/hsomodem/radio-settings.c
+++ b/drivers/hsomodem/radio-settings.c
@@ -172,7 +172,7 @@ static int hso_radio_settings_probe(struct ofono_radio_settings *rs,
struct radio_settings_data *rsd;
rsd = g_try_new0(struct radio_settings_data, 1);
- if (!rsd)
+ if (rsd == NULL)
return -ENOMEM;
rsd->chat = g_at_chat_clone(chat);
diff --git a/drivers/huaweimodem/audio-settings.c b/drivers/huaweimodem/audio-settings.c
index d5d3bba..305776f 100644
--- a/drivers/huaweimodem/audio-settings.c
+++ b/drivers/huaweimodem/audio-settings.c
@@ -90,7 +90,7 @@ static int huawei_audio_settings_probe(struct ofono_audio_settings *as,
struct audio_settings_data *asd;
asd = g_try_new0(struct audio_settings_data, 1);
- if (!asd)
+ if (asd == NULL)
return -ENOMEM;
asd->chat = g_at_chat_clone(chat);
diff --git a/drivers/huaweimodem/gprs-context.c b/drivers/huaweimodem/gprs-context.c
index 48e21ab..ef3d93c 100644
--- a/drivers/huaweimodem/gprs-context.c
+++ b/drivers/huaweimodem/gprs-context.c
@@ -311,7 +311,7 @@ static void huawei_gprs_activate_primary(struct ofono_gprs_context *gc,
DBG("cid %u", ctx->cid);
- if (!cbd)
+ if (cbd == NULL)
goto error;
gcd->active_context = ctx->cid;
@@ -344,7 +344,7 @@ static void huawei_gprs_deactivate_primary(struct ofono_gprs_context *gc,
DBG("cid %u", cid);
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = gc;
@@ -376,7 +376,7 @@ static int huawei_gprs_context_probe(struct ofono_gprs_context *gc,
}
gcd = g_try_new0(struct gprs_context_data, 1);
- if (!gcd)
+ if (gcd == NULL)
return -ENOMEM;
gcd->chat = g_at_chat_clone(chat);
diff --git a/drivers/huaweimodem/voicecall.c b/drivers/huaweimodem/voicecall.c
index b417438..ff08124 100644
--- a/drivers/huaweimodem/voicecall.c
+++ b/drivers/huaweimodem/voicecall.c
@@ -57,7 +57,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 = id;
@@ -99,7 +99,7 @@ static void huawei_template(struct ofono_voicecall *vc, const char *cmd,
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
struct cb_data *cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (g_at_chat_send(vd->chat, cmd, none_prefix,
@@ -319,7 +319,7 @@ static void orig_notify(GAtResult *result, gpointer user_data)
ofono_info("Call origin: id %d type %d", call_id, call_type);
call = create_call(vc, call_type, 0, 2, NULL, 128, 2, call_id);
- if (!call) {
+ if (call == NULL) {
ofono_error("Unable to malloc, call tracking will fail!");
return;
}
@@ -472,7 +472,7 @@ static int huawei_voicecall_probe(struct ofono_voicecall *vc,
struct voicecall_data *vd;
vd = g_try_new0(struct voicecall_data, 1);
- if (!vd)
+ if (vd == NULL)
return -ENOMEM;
vd->chat = g_at_chat_clone(chat);
diff --git a/drivers/ifxmodem/audio-settings.c b/drivers/ifxmodem/audio-settings.c
index fd100aa..8273335 100644
--- a/drivers/ifxmodem/audio-settings.c
+++ b/drivers/ifxmodem/audio-settings.c
@@ -116,7 +116,7 @@ static int ifx_audio_settings_probe(struct ofono_audio_settings *as,
struct audio_settings_data *asd;
asd = g_try_new0(struct audio_settings_data, 1);
- if (!asd)
+ if (asd == NULL)
return -ENOMEM;
asd->chat = g_at_chat_clone(chat);
diff --git a/drivers/ifxmodem/gprs-context.c b/drivers/ifxmodem/gprs-context.c
index 2a2b8df..fcfe698 100644
--- a/drivers/ifxmodem/gprs-context.c
+++ b/drivers/ifxmodem/gprs-context.c
@@ -122,7 +122,7 @@ static void failed_setup(struct ofono_gprs_context *gc,
gcd->active_context = 0;
gcd->state = STATE_IDLE;
- if (!result) {
+ if (result == NULL) {
CALLBACK_WITH_FAILURE(gcd->up_cb, NULL, 0, NULL, NULL,
NULL, NULL, gcd->cb_data);
return;
@@ -154,7 +154,7 @@ static void session_cb(gboolean ok, GAtResult *result, gpointer user_data)
dns[2] = 0;
interface = setup_rawip(gc);
- if (!interface)
+ if (interface == NULL)
interface = "invalid";
CALLBACK_WITH_SUCCESS(gcd->up_cb, interface, TRUE, gcd->address,
@@ -446,11 +446,11 @@ static int ifx_gprs_context_probe(struct ofono_gprs_context *gc,
return -ENODEV;
}
- if (!g_at_chat_get_slave(chat))
+ if (g_at_chat_get_slave(chat) == NULL)
return -EINVAL;
gcd = g_try_new0(struct gprs_context_data, 1);
- if (!gcd)
+ if (gcd == NULL)
return -ENOMEM;
gcd->chat = g_at_chat_clone(chat);
diff --git a/drivers/ifxmodem/radio-settings.c b/drivers/ifxmodem/radio-settings.c
index 89e97e7..2ec94f1 100644
--- a/drivers/ifxmodem/radio-settings.c
+++ b/drivers/ifxmodem/radio-settings.c
@@ -173,7 +173,7 @@ static int ifx_radio_settings_probe(struct ofono_radio_settings *rs,
struct radio_settings_data *rsd;
rsd = g_try_new0(struct radio_settings_data, 1);
- if (!rsd)
+ if (rsd == NULL)
return -ENOMEM;
rsd->chat = g_at_chat_clone(chat);
diff --git a/drivers/ifxmodem/stk.c b/drivers/ifxmodem/stk.c
index c17a5ad..6494c4d 100644
--- a/drivers/ifxmodem/stk.c
+++ b/drivers/ifxmodem/stk.c
@@ -104,7 +104,7 @@ static void ifx_stk_envelope(struct ofono_stk *stk, int length,
DBG("");
- if (!cbd || !buf)
+ if (cbd == NULL || buf == NULL)
goto error;
len = sprintf(buf, "AT+SATE=\"");
@@ -150,7 +150,7 @@ static void ifx_stk_terminal_response(struct ofono_stk *stk, int length,
DBG("");
- if (!cbd || !buf)
+ if (cbd == NULL || buf == NULL)
goto error;
len = sprintf(buf, "AT+SATR=\"");
@@ -273,7 +273,7 @@ static int ifx_stk_probe(struct ofono_stk *stk, unsigned int vendor, void *data)
DBG("");
sd = g_try_new0(struct stk_data, 1);
- if (!sd)
+ if (sd == NULL)
return -ENOMEM;
sd->chat = g_at_chat_clone(chat);
diff --git a/drivers/ifxmodem/voicecall.c b/drivers/ifxmodem/voicecall.c
index 26cc7fe..4bb5681 100644
--- a/drivers/ifxmodem/voicecall.c
+++ b/drivers/ifxmodem/voicecall.c
@@ -94,7 +94,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);
@@ -287,7 +287,7 @@ static void atd_cb(gboolean ok, GAtResult *result, gpointer user_data)
/* Generate a voice call that was just dialed, we guess the ID */
call = create_call(vc, 0, 0, 2, num, type, validity);
- if (!call) {
+ if (call == NULL) {
ofono_error("Unable to malloc, call tracking will fail!");
return;
}
@@ -311,7 +311,7 @@ static void ifx_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;
@@ -359,7 +359,7 @@ static void ifx_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;
@@ -431,7 +431,7 @@ static void ifx_release_specific(struct ofono_voicecall *vc, int id,
struct release_id_req *req = g_try_new0(struct release_id_req, 1);
char buf[32];
- if (!req)
+ if (req == NULL)
goto error;
req->vc = vc;
@@ -518,12 +518,12 @@ static void ifx_send_dtmf(struct ofono_voicecall *vc, const char *dtmf,
int i;
char *buf;
- if (!cbd)
+ if (cbd == NULL)
goto error;
/* strlen("+VTS=T\;") = 7 + initial AT + null */
buf = g_try_new(char, len * 7 + 3);
- if (!buf)
+ if (buf == NULL)
goto error;
s = sprintf(buf, "AT+VTS=%c", dtmf[0]);
@@ -689,7 +689,7 @@ static void ccwa_notify(GAtResult *result, gpointer user_data)
call = create_call(vc, class_to_call_type(cls), 1, 5,
num, num_type, validity);
- if (!call) {
+ if (call == NULL) {
ofono_error("Unable to malloc. Call management is fubar");
return;
}
@@ -723,7 +723,7 @@ static int ifx_voicecall_probe(struct ofono_voicecall *vc, unsigned int vendor,
struct voicecall_data *vd;
vd = g_try_new0(struct voicecall_data, 1);
- if (!vd)
+ if (vd == NULL)
return -ENOMEM;
vd->chat = g_at_chat_clone(chat);
diff --git a/drivers/isimodem/audio-settings.c b/drivers/isimodem/audio-settings.c
index 80c5648..04774af 100644
--- a/drivers/isimodem/audio-settings.c
+++ b/drivers/isimodem/audio-settings.c
@@ -107,11 +107,11 @@ static int isi_audio_settings_probe(struct ofono_audio_settings *as,
struct audio_settings_data *asd =
g_try_new0(struct audio_settings_data, 1);
- if (!asd)
+ if (asd == NULL)
return -ENOMEM;
asd->client = g_isi_client_create(idx, PN_CALL);
- if (!asd->client) {
+ if (asd->client == NULL) {
g_free(asd);
return -ENOMEM;
}
@@ -128,7 +128,7 @@ static void isi_audio_settings_remove(struct ofono_audio_settings *as)
{
struct audio_settings_data *asd = ofono_audio_settings_get_data(as);
- if (!asd)
+ if (asd == NULL)
return;
ofono_audio_settings_set_data(as, NULL);
diff --git a/drivers/isimodem/call-barring.c b/drivers/isimodem/call-barring.c
index 7cdd218..5ec9b0c 100644
--- a/drivers/isimodem/call-barring.c
+++ b/drivers/isimodem/call-barring.c
@@ -128,7 +128,7 @@ static void isi_set(struct ofono_call_barring *barr, const char *lock,
DBG("lock code %s enable %d class %d password %s",
lock, enable, cls, passwd);
- if (!cbd || !bd)
+ if (cbd == NULL || bd == NULL)
goto error;
if (g_isi_request_make(bd->client, msg, sizeof(msg), SS_TIMEOUT,
@@ -275,7 +275,7 @@ static void isi_query(struct ofono_call_barring *barr, const char *lock,
DBG("barring query lock code %s", lock);
- if (!cbd || !bd)
+ if (cbd == NULL || bd == NULL)
goto error;
if (g_isi_request_make(bd->client, msg, sizeof(msg), SS_TIMEOUT,
@@ -346,7 +346,7 @@ static void isi_set_passwd(struct ofono_call_barring *barr, const char *lock,
DBG("lock code %s (%u) old password %s new password %s",
lock, ss_code, old_passwd, new_passwd);
- if (!cbd || !bd)
+ if (cbd == NULL || bd == NULL)
goto error;
if (g_isi_request_make(bd->client, msg, sizeof(msg), SS_TIMEOUT,
@@ -397,11 +397,11 @@ static int isi_call_barring_probe(struct ofono_call_barring *barr,
GIsiModem *idx = user;
struct barr_data *data = g_try_new0(struct barr_data, 1);
- if (!data)
+ if (data == NULL)
return -ENOMEM;
data->client = g_isi_client_create(idx, PN_SS);
- if (!data->client)
+ if (data->client == NULL)
return -ENOMEM;
ofono_call_barring_set_data(barr, data);
@@ -415,7 +415,7 @@ static void isi_call_barring_remove(struct ofono_call_barring *barr)
{
struct barr_data *data = ofono_call_barring_get_data(barr);
- if (!data)
+ if (data == NULL)
return;
ofono_call_barring_set_data(barr, NULL);
diff --git a/drivers/isimodem/call-forwarding.c b/drivers/isimodem/call-forwarding.c
index bb25ee7..a08524d 100644
--- a/drivers/isimodem/call-forwarding.c
+++ b/drivers/isimodem/call-forwarding.c
@@ -229,7 +229,7 @@ static void isi_registration(struct ofono_call_forwarding *cf,
DBG("forwarding type %d class %d", type, cls);
- if (!cbd || !fd || !number->number || strlen(number->number) > 28)
+ if (cbd == NULL || fd == NULL || !number->number || strlen(number->number) > 28)
goto error;
ss_code = forw_type_to_isi_code(type);
@@ -349,7 +349,7 @@ static void isi_erasure(struct ofono_call_forwarding *cf, int type, int cls,
DBG("forwarding type %d class %d", type, cls);
- if (!cbd || !fd)
+ if (cbd == NULL || fd == NULL)
goto error;
ss_code = forw_type_to_isi_code(type);
@@ -481,7 +481,7 @@ static void isi_query(struct ofono_call_forwarding *cf, int type, int cls,
DBG("forwarding type %d class %d", type, cls);
- if (!cbd || !fd || cls != 7)
+ if (cbd == NULL || fd == NULL || cls != 7)
goto error;
ss_code = forw_type_to_isi_code(type);
@@ -541,11 +541,11 @@ static int isi_call_forwarding_probe(struct ofono_call_forwarding *cf,
data = g_try_new0(struct forw_data, 1);
- if (!data)
+ if (data == NULL)
return -ENOMEM;
data->client = g_isi_client_create(idx, PN_SS);
- if (!data->client)
+ if (data->client == NULL)
return -ENOMEM;
ofono_call_forwarding_set_data(cf, data);
@@ -560,7 +560,7 @@ static void isi_call_forwarding_remove(struct ofono_call_forwarding *cf)
{
struct forw_data *data = ofono_call_forwarding_get_data(cf);
- if (!data)
+ if (data == NULL)
return;
ofono_call_forwarding_set_data(cf, NULL);
diff --git a/drivers/isimodem/call-meter.c b/drivers/isimodem/call-meter.c
index 336a077..2fc74c8 100644
--- a/drivers/isimodem/call-meter.c
+++ b/drivers/isimodem/call-meter.c
@@ -90,11 +90,11 @@ static int isi_call_meter_probe(struct ofono_call_meter *cm,
GIsiModem *idx = user;
struct call_meter_data *data = g_try_new0(struct call_meter_data, 1);
- if (!data)
+ if (data == NULL)
return -ENOMEM;
data->client = g_isi_client_create(idx, PN_SS);
- if (!data->client)
+ if (data->client == NULL)
return -ENOMEM;
ofono_call_meter_set_data(cm, data);
diff --git a/drivers/isimodem/call-settings.c b/drivers/isimodem/call-settings.c
index 23c1982..754dbcd 100644
--- a/drivers/isimodem/call-settings.c
+++ b/drivers/isimodem/call-settings.c
@@ -177,7 +177,7 @@ static void isi_cw_query(struct ofono_call_settings *cs, int cls,
DBG("waiting class %d", cls);
- if (!cbd || !sd)
+ if (cbd == NULL || sd == NULL)
goto error;
if (g_isi_request_make(sd->client, msg, sizeof(msg), SS_TIMEOUT,
@@ -268,7 +268,7 @@ static void isi_cw_set(struct ofono_call_settings *cs, int mode, int cls,
DBG("waiting mode %d class %d", mode, cls);
- if (!cbd || !sd)
+ if (cbd == NULL || sd == NULL)
goto error;
if (g_isi_request_make(sd->client, msg, sizeof(msg), SS_TIMEOUT,
@@ -321,12 +321,12 @@ static int isi_call_settings_probe(struct ofono_call_settings *cs,
data = g_try_new0(struct settings_data, 1);
- if (!data)
+ if (data == NULL)
return -ENOMEM;
data->client = g_isi_client_create(idx, PN_SS);
- if (!data->client)
+ if (data->client == NULL)
return -ENOMEM;
ofono_call_settings_set_data(cs, data);
@@ -341,7 +341,7 @@ static void isi_call_settings_remove(struct ofono_call_settings *cs)
{
struct settings_data *data = ofono_call_settings_get_data(cs);
- if (!data)
+ if (data == NULL)
return;
ofono_call_settings_set_data(cs, NULL);
diff --git a/drivers/isimodem/cbs.c b/drivers/isimodem/cbs.c
index 2a32720..6780743 100644
--- a/drivers/isimodem/cbs.c
+++ b/drivers/isimodem/cbs.c
@@ -136,11 +136,11 @@ static int isi_cbs_probe(struct ofono_cbs *cbs, unsigned int vendor,
0x00 /* Languages */
};
- if (!cd)
+ if (cd == NULL)
return -ENOMEM;
cd->client = g_isi_client_create(idx, PN_SMS);
- if (!cd->client)
+ if (cd->client == NULL)
return -ENOMEM;
ofono_cbs_set_data(cbs, cd);
@@ -149,8 +149,7 @@ static int isi_cbs_probe(struct ofono_cbs *cbs, unsigned int vendor,
if (debug && (strcmp(debug, "all") == 0 || strcmp(debug, "cbs") == 0))
g_isi_client_set_debug(cd->client, sms_debug, NULL);
- if (!g_isi_request_make(cd->client, msg, sizeof(msg), CBS_TIMEOUT,
- routing_resp_cb, cbs))
+ if (g_isi_request_make(cd->client, msg, sizeof(msg), CBS_TIMEOUT, routing_resp_cb, cbs) == NULL)
DBG("Failed to set CBS routing.");
return 0;
@@ -173,7 +172,7 @@ static void isi_cbs_remove(struct ofono_cbs *cbs)
0x00 /* Languages */
};
- if (!data)
+ if (data == NULL)
return;
if (data->client) {
diff --git a/drivers/isimodem/devinfo.c b/drivers/isimodem/devinfo.c
index f7960ff..7f94f9e 100644
--- a/drivers/isimodem/devinfo.c
+++ b/drivers/isimodem/devinfo.c
@@ -128,7 +128,7 @@ static void isi_query_manufacturer(struct ofono_devinfo *info,
INFO_PRODUCT_MANUFACTURER
};
- if (!cbd || !dev)
+ if (cbd == NULL || dev == NULL)
goto error;
if (g_isi_request_make(dev->client, msg, sizeof(msg),
@@ -152,7 +152,7 @@ static void isi_query_model(struct ofono_devinfo *info,
INFO_PRODUCT_NAME
};
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (g_isi_request_make(dev->client, msg, sizeof(msg),
@@ -177,7 +177,7 @@ static void isi_query_revision(struct ofono_devinfo *info,
0x00, 0x00, 0x00, 0x00
};
- if (!cbd || !dev)
+ if (cbd == NULL || dev == NULL)
goto error;
if (g_isi_request_make(dev->client, msg, sizeof(msg),
@@ -201,7 +201,7 @@ static void isi_query_serial(struct ofono_devinfo *info,
INFO_SN_IMEI_PLAIN
};
- if (!cbd || !dev)
+ if (cbd == NULL || dev == NULL)
goto error;
if (g_isi_request_make(dev->client, msg, sizeof(msg),
@@ -252,11 +252,11 @@ static int isi_devinfo_probe(struct ofono_devinfo *info, unsigned int vendor,
GIsiModem *idx = user;
struct devinfo_data *data = g_try_new0(struct devinfo_data, 1);
- if (!data)
+ if (data == NULL)
return -ENOMEM;
data->client = g_isi_client_create(idx, PN_PHONE_INFO);
- if (!data->client) {
+ if (data->client == NULL) {
g_free(data);
return -ENOMEM;
}
diff --git a/drivers/isimodem/gprs-context.c b/drivers/isimodem/gprs-context.c
index 88450b8..1cfbfee 100644
--- a/drivers/isimodem/gprs-context.c
+++ b/drivers/isimodem/gprs-context.c
@@ -85,7 +85,7 @@ struct context_data {
static void reset_context(struct context_data *cd)
{
- if (!cd)
+ if (cd == NULL)
return;
g_isi_remove_subscription(cd->client, PN_GPDS,
@@ -399,8 +399,7 @@ static void send_context_authenticate(GIsiClient *client, void *opaque)
{ cd->password, password_len },
};
- if (!g_isi_request_vmake(client, iov, 4, GPDS_TIMEOUT,
- context_auth_cb, cd))
+ if (g_isi_request_vmake(client, iov, 4, GPDS_TIMEOUT, context_auth_cb, cd) == NULL)
gprs_up_fail(cd);
}
@@ -495,8 +494,7 @@ static void create_pipe_cb(GIsiPipe *pipe)
GPDS_CONTEXT_ID_CREATE_REQ,
};
- if (!g_isi_request_make(cd->client, msg, sizeof(msg), GPDS_TIMEOUT,
- create_context_cb, cd))
+ if (g_isi_request_make(cd->client, msg, sizeof(msg), GPDS_TIMEOUT, create_context_cb, cd) == NULL)
gprs_up_fail(cd);
}
@@ -582,7 +580,7 @@ static void isi_gprs_deactivate_primary(struct ofono_gprs_context *gc,
0x00, /* GPDS context ID, added later */
};
- if (!cd)
+ if (cd == NULL)
return;
cd->down_cb = cb;
@@ -590,8 +588,7 @@ static void isi_gprs_deactivate_primary(struct ofono_gprs_context *gc,
msg[1] = cd->handle;
- if (!g_isi_request_make(cd->client, msg, sizeof(msg), GPDS_TIMEOUT,
- context_deactivate_cb, cd)) {
+ if (g_isi_request_make(cd->client, msg, sizeof(msg), GPDS_TIMEOUT, context_deactivate_cb, cd) == NULL) {
gprs_down_fail(cd);
return;
}
@@ -630,11 +627,11 @@ static int isi_gprs_context_probe(struct ofono_gprs_context *gc,
GIsiModem *idx = user;
struct context_data *cd = g_try_new0(struct context_data, 1);
- if (!cd)
+ if (cd == NULL)
return -ENOMEM;
cd->client = g_isi_client_create(idx, PN_GPDS);
- if (!cd->client) {
+ if (cd->client == NULL) {
g_free(cd);
return -ENOMEM;
}
@@ -652,7 +649,7 @@ static void isi_gprs_context_remove(struct ofono_gprs_context *gc)
{
struct context_data *cd = ofono_gprs_context_get_data(gc);
- if (!cd)
+ if (cd == NULL)
return;
ofono_gprs_context_set_data(gc, NULL);
diff --git a/drivers/isimodem/gprs.c b/drivers/isimodem/gprs.c
index 9cbe4f3..3c9facd 100644
--- a/drivers/isimodem/gprs.c
+++ b/drivers/isimodem/gprs.c
@@ -165,11 +165,11 @@ static int isi_gprs_probe(struct ofono_gprs *gprs,
GIsiModem *idx = user;
struct gprs_data *gd = g_try_new0(struct gprs_data, 1);
- if (!gd)
+ if (gd == NULL)
return -ENOMEM;
gd->client = g_isi_client_create(idx, PN_GPDS);
- if (!gd->client) {
+ if (gd->client == NULL) {
g_free(gd);
return -ENOMEM;
}
@@ -187,7 +187,7 @@ static void isi_gprs_remove(struct ofono_gprs *gprs)
{
struct gprs_data *data = ofono_gprs_get_data(gprs);
- if (!data)
+ if (data == NULL)
return;
ofono_gprs_set_data(gprs, NULL);
@@ -286,7 +286,7 @@ static void isi_gprs_set_attached(struct ofono_gprs *gprs, int attached,
GIsiRequest *req;
- if (!cbd || !gd)
+ if (cbd == NULL || gd == NULL)
goto error;
if (attached)
@@ -356,7 +356,7 @@ static void isi_gprs_attached_status(struct ofono_gprs *gprs,
GPDS_STATUS_REQ,
};
- if (!cbd || !gd)
+ if (cbd == NULL || gd == NULL)
goto error;
if (g_isi_send(gd->client, msg, sizeof(msg), GPDS_TIMEOUT,
diff --git a/drivers/isimodem/infoserver.c b/drivers/isimodem/infoserver.c
index 7f07da3..9665996 100644
--- a/drivers/isimodem/infoserver.c
+++ b/drivers/isimodem/infoserver.c
@@ -93,11 +93,11 @@ struct isi_infoserver *isi_infoserver_create(struct ofono_modem *modem,
struct isi_infoserver *self;
self = g_new0(struct isi_infoserver, 1);
- if (!self)
+ if (self == NULL)
return NULL;
self->server = g_isi_server_create(data, PN_EPOC_INFO, 0, 0);
- if (!self->server) {
+ if (self->server == NULL) {
g_free(self);
return NULL;
}
diff --git a/drivers/isimodem/network-registration.c b/drivers/isimodem/network-registration.c
index 1e7c892..d885aae 100644
--- a/drivers/isimodem/network-registration.c
+++ b/drivers/isimodem/network-registration.c
@@ -255,7 +255,7 @@ static void isi_registration_status(struct ofono_netreg *netreg,
NET_REG_STATUS_GET_REQ
};
- if (!cbd || !nd)
+ if (cbd == NULL || nd == NULL)
goto error;
if (g_isi_request_make(nd->client, msg, sizeof(msg),
@@ -360,7 +360,7 @@ static void isi_current_operator(struct ofono_netreg *netreg,
0x00 /* No sub-blocks */
};
- if (!cbd || !nd)
+ if (cbd == NULL || nd == NULL)
goto error;
if (g_isi_request_make(nd->client, msg, sizeof(msg),
@@ -482,7 +482,7 @@ static void isi_list_operators(struct ofono_netreg *netreg,
0x00
};
- if (!cbd || !net)
+ if (cbd == NULL || net == NULL)
goto error;
if (g_isi_request_make(net->client, msg, sizeof(msg),
@@ -548,7 +548,7 @@ static void isi_register_auto(struct ofono_netreg *netreg,
0x00 /* Index not used */
};
- if (!cbd || !net)
+ if (cbd == NULL || net == NULL)
goto error;
if (g_isi_request_make(net->client, msg, sizeof(msg),
@@ -621,7 +621,7 @@ static void isi_register_manual(struct ofono_netreg *netreg,
0x00, 0x00 /* Filler */
};
- if (!cbd || !nd)
+ if (cbd == NULL || nd == NULL)
goto error;
if (g_isi_request_make(nd->client, msg, sizeof(msg),
@@ -866,7 +866,7 @@ static void isi_strength(struct ofono_netreg *netreg,
NET_CURRENT_CELL_RSSI
};
- if (!cbd || !nd)
+ if (cbd == NULL || nd == NULL)
goto error;
if (g_isi_request_make(nd->client, msg, sizeof(msg),
@@ -901,9 +901,7 @@ static gboolean isi_netreg_register(gpointer user)
g_isi_subscribe(nd->client, NET_TIME_IND, time_ind_cb, netreg);
/* Bootstrap current RAT setting */
- if (!g_isi_request_make(nd->client, rat, sizeof(rat),
- NETWORK_TIMEOUT,
- rat_resp_cb, netreg))
+ if (g_isi_request_make(nd->client, rat, sizeof(rat), NETWORK_TIMEOUT, rat_resp_cb, netreg) == NULL)
DBG("Failed to bootstrap RAT");
ofono_netreg_register(netreg);
@@ -935,11 +933,11 @@ static int isi_netreg_probe(struct ofono_netreg *netreg, unsigned int vendor,
GIsiModem *idx = user;
struct netreg_data *nd = g_try_new0(struct netreg_data, 1);
- if (!nd)
+ if (nd == NULL)
return -ENOMEM;
nd->client = g_isi_client_create(idx, PN_NETWORK);
- if (!nd->client) {
+ if (nd->client == NULL) {
g_free(nd);
return -ENOMEM;
}
@@ -954,7 +952,7 @@ static void isi_netreg_remove(struct ofono_netreg *net)
{
struct netreg_data *data = ofono_netreg_get_data(net);
- if (!data)
+ if (data == NULL)
return;
ofono_netreg_set_data(net, NULL);
diff --git a/drivers/isimodem/phonebook.c b/drivers/isimodem/phonebook.c
index dc832c4..5ee4315 100644
--- a/drivers/isimodem/phonebook.c
+++ b/drivers/isimodem/phonebook.c
@@ -192,7 +192,7 @@ static void read_next_entry(GIsiClient *client, int location,
if (location < 0)
goto error;
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (g_isi_request_make(client, msg, sizeof(msg), SIM_TIMEOUT,
@@ -259,7 +259,7 @@ static void isi_export_entries(struct ofono_phonebook *pb, const char *storage,
0, 0 /* filler */
};
- if (!cbd || !pbd)
+ if (cbd == NULL || pbd == NULL)
goto error;
if (strcmp(storage, "SM"))
@@ -314,11 +314,11 @@ static int isi_phonebook_probe(struct ofono_phonebook *pb, unsigned int vendor,
GIsiModem *idx = user;
struct pb_data *data = g_try_new0(struct pb_data, 1);
- if (!data)
+ if (data == NULL)
return -ENOMEM;
data->client = g_isi_client_create(idx, PN_SIM);
- if (!data->client) {
+ if (data->client == NULL) {
g_free(data);
return -ENOMEM;
}
@@ -335,7 +335,7 @@ static void isi_phonebook_remove(struct ofono_phonebook *pb)
{
struct pb_data *data = ofono_phonebook_get_data(pb);
- if (!data)
+ if (data == NULL)
return;
ofono_phonebook_set_data(pb, NULL);
diff --git a/drivers/isimodem/radio-settings.c b/drivers/isimodem/radio-settings.c
index 558e032..a93cde2 100644
--- a/drivers/isimodem/radio-settings.c
+++ b/drivers/isimodem/radio-settings.c
@@ -159,7 +159,7 @@ static void isi_query_rat_mode(struct ofono_radio_settings *rs,
0x00 /* subblock count */
};
- if (!cbd || !rd)
+ if (cbd == NULL || rd == NULL)
goto error;
if (g_isi_request_make(rd->client, msg, sizeof(msg), GSS_TIMEOUT,
@@ -226,7 +226,7 @@ static void isi_set_rat_mode(struct ofono_radio_settings *rs,
0x00 /* filler */
};
- if (!cbd || !rd)
+ if (cbd == NULL || rd == NULL)
goto error;
if (isi_mode == -1)
@@ -363,11 +363,11 @@ static int isi_radio_settings_probe(struct ofono_radio_settings *rs,
GIsiModem *idx = user;
struct radio_data *rd = g_try_new0(struct radio_data, 1);
- if (!rd)
+ if (rd == NULL)
return -ENOMEM;
rd->client = g_isi_client_create(idx, PN_GSS);
- if (!rd->client) {
+ if (rd->client == NULL) {
g_free(rd);
return -ENOMEM;
}
@@ -384,7 +384,7 @@ static void isi_radio_settings_remove(struct ofono_radio_settings *rs)
{
struct radio_data *rd = ofono_radio_settings_get_data(rs);
- if (!rd)
+ if (rd == NULL)
return;
ofono_radio_settings_set_data(rs, NULL);
diff --git a/drivers/isimodem/sim.c b/drivers/isimodem/sim.c
index d03a07e..b79c52a 100644
--- a/drivers/isimodem/sim.c
+++ b/drivers/isimodem/sim.c
@@ -156,7 +156,7 @@ static gboolean isi_read_spn(struct ofono_sim *sim, struct isi_cb_data *cbd)
0
};
- if (!sd)
+ if (sd == NULL)
return FALSE;
return g_isi_request_make(sd->client, msg, sizeof(msg),
@@ -200,7 +200,7 @@ static gboolean isi_read_iccid(struct ofono_sim *sim, struct isi_cb_data *cbd)
struct sim_data *sd = ofono_sim_get_data(sim);
const unsigned char req[] = { SIM_READ_FIELD_REQ, ICC };
- if (!sd)
+ if (sd == NULL)
return FALSE;
return g_isi_request_make(sd->client, req, sizeof(req), SIM_TIMEOUT,
@@ -343,7 +343,7 @@ static void isi_read_imsi(struct ofono_sim *sim,
READ_IMSI
};
- if (!cbd || !sd)
+ if (cbd == NULL || sd == NULL)
goto error;
if (g_isi_request_make(sd->client, msg, sizeof(msg), SIM_TIMEOUT,
@@ -451,11 +451,11 @@ static int isi_sim_probe(struct ofono_sim *sim, unsigned int vendor,
struct sim_data *sd = g_try_new0(struct sim_data, 1);
const char *debug = getenv("OFONO_ISI_DEBUG");
- if (!sd)
+ if (sd == NULL)
return -ENOMEM;
sd->client = g_isi_client_create(idx, PN_SIM);
- if (!sd->client)
+ if (sd->client == NULL)
return -ENOMEM;
ofono_sim_set_data(sim, sd);
@@ -472,7 +472,7 @@ static void isi_sim_remove(struct ofono_sim *sim)
{
struct sim_data *data = ofono_sim_get_data(sim);
- if (!data)
+ if (data == NULL)
return;
ofono_sim_set_data(sim, NULL);
diff --git a/drivers/isimodem/sms.c b/drivers/isimodem/sms.c
index e2c2533..e5b97e1 100644
--- a/drivers/isimodem/sms.c
+++ b/drivers/isimodem/sms.c
@@ -156,7 +156,7 @@ static void isi_sca_query(struct ofono_sms *sms,
1, /* Location, default is 1 */
};
- if (!cbd || !sd)
+ if (cbd == NULL || sd == NULL)
goto error;
if (g_isi_send(sd->sim, msg, sizeof(msg), SIM_TIMEOUT,
@@ -214,7 +214,7 @@ static void isi_sca_set(struct ofono_sms *sms,
{ &sd->params, sizeof(sd->params) },
};
- if (!cbd || !sd)
+ if (cbd == NULL || sd == NULL)
goto error;
bcd = sd->params.sca;
@@ -350,7 +350,7 @@ static void isi_submit(struct ofono_sms *sms, unsigned char *pdu,
{ sca_sb, sca_sb_len },
};
- if (!cbd || !sd)
+ if (cbd == NULL || sd == NULL)
goto error;
if (use_sca) {
@@ -560,18 +560,18 @@ static int isi_sms_probe(struct ofono_sms *sms, unsigned int vendor,
0x00 /* Sub-sub-block count */
};
- if (!data)
+ if (data == NULL)
return -ENOMEM;
data->params.absent = 0xff;
data->params.alphalen = 1; /* Includes final UCS2-coded NUL */
data->client = g_isi_client_create(idx, PN_SMS);
- if (!data->client)
+ if (data->client == NULL)
return -ENOMEM;
data->sim = g_isi_client_create(idx, PN_SIM);
- if (!data->sim) {
+ if (data->sim == NULL) {
g_isi_client_destroy(data->client);
return -ENOMEM;
}
@@ -586,8 +586,7 @@ static int isi_sms_probe(struct ofono_sms *sms, unsigned int vendor,
g_isi_subscribe(data->client, SMS_MESSAGE_SEND_STATUS_IND,
send_status_ind_cb, sms);
- if (!g_isi_send(data->client, msg, sizeof(msg), SMS_TIMEOUT,
- routing_resp_cb, sms, NULL))
+ if (g_isi_send(data->client, msg, sizeof(msg), SMS_TIMEOUT, routing_resp_cb, sms, NULL) == NULL)
DBG("Failed to set SMS routing.");
return 0;
@@ -609,7 +608,7 @@ static void isi_sms_remove(struct ofono_sms *sms)
0x00 /* Sub-sub-block count */
};
- if (!data)
+ if (data == NULL)
return;
ofono_sms_set_data(sms, NULL);
diff --git a/drivers/isimodem/ssn.c b/drivers/isimodem/ssn.c
index 797ba9d..402a48a 100644
--- a/drivers/isimodem/ssn.c
+++ b/drivers/isimodem/ssn.c
@@ -51,11 +51,11 @@ static int isi_ssn_probe(struct ofono_ssn *ssn, unsigned int vendor,
GIsiModem *idx = user;
struct ssn_data *data = g_try_new0(struct ssn_data, 1);
- if (!data)
+ if (data == NULL)
return -ENOMEM;
data->client = g_isi_client_create(idx, PN_SS);
- if (!data->client)
+ if (data->client == NULL)
return -ENOMEM;
ofono_ssn_set_data(ssn, data);
@@ -67,7 +67,7 @@ static void isi_ssn_remove(struct ofono_ssn *ssn)
{
struct ssn_data *data = ofono_ssn_get_data(ssn);
- if (!data)
+ if (data == NULL)
return;
ofono_ssn_set_data(ssn, NULL);
diff --git a/drivers/isimodem/ussd.c b/drivers/isimodem/ussd.c
index 78ac9fe..a509a0a 100644
--- a/drivers/isimodem/ussd.c
+++ b/drivers/isimodem/ussd.c
@@ -181,7 +181,7 @@ static void isi_request(struct ofono_ussd *ussd, int dcs,
{ (uint8_t *)pdu, len }
};
- if (!cbd || !ud)
+ if (cbd == NULL || ud == NULL)
goto error;
if (g_isi_vsend(ud->client, iov, 2, SS_TIMEOUT,
@@ -205,7 +205,7 @@ static void isi_cancel(struct ofono_ussd *ussd,
0x00 /* subblock count */
};
- if (!cbd || !ud)
+ if (cbd == NULL || ud == NULL)
goto error;
if (g_isi_send(ud->client, msg, sizeof(msg), SS_TIMEOUT,
@@ -258,11 +258,11 @@ static int isi_ussd_probe(struct ofono_ussd *ussd, unsigned int vendor,
GIsiModem *idx = user;
struct ussd_data *ud = g_try_new0(struct ussd_data, 1);
- if (!ud)
+ if (ud == NULL)
return -ENOMEM;
ud->client = g_isi_client_create(idx, PN_SS);
- if (!ud->client)
+ if (ud->client == NULL)
return -ENOMEM;
ofono_ussd_set_data(ussd, ud);
@@ -275,7 +275,7 @@ static void isi_ussd_remove(struct ofono_ussd *ussd)
{
struct ussd_data *data = ofono_ussd_get_data(ussd);
- if (!data)
+ if (data == NULL)
return;
ofono_ussd_set_data(ussd, NULL);
diff --git a/drivers/isimodem/voicecall.c b/drivers/isimodem/voicecall.c
index 497a2ce..d250924 100644
--- a/drivers/isimodem/voicecall.c
+++ b/drivers/isimodem/voicecall.c
@@ -176,7 +176,7 @@ static gboolean isi_ctx_return(struct isi_call_req_context *irc,
enum ofono_error_type type,
int error)
{
- if (!irc)
+ if (irc == NULL)
return TRUE;
if (irc->cb) {
@@ -1252,14 +1252,14 @@ static int isi_voicecall_probe(struct ofono_voicecall *ovc,
struct isi_voicecall *ivc = g_try_new0(struct isi_voicecall, 1);
int id;
- if (!ivc)
+ if (ivc == NULL)
return -ENOMEM;
for (id = 0; id <= 7; id++)
ivc->calls[id].id = id;
ivc->client = g_isi_client_create(idx, PN_CALL);
- if (!ivc->client) {
+ if (ivc->client == NULL) {
g_free(ivc);
return -ENOMEM;
}
@@ -1302,9 +1302,7 @@ static gboolean isi_call_register(gpointer _ovc)
CALL_STATUS_IND, isi_call_status_ind_cb,
ovc);
- if (!isi_call_status_req(ovc, CALL_ID_ALL,
- CALL_STATUS_MODE_ADDR_AND_ORIGIN,
- NULL, NULL))
+ if (isi_call_status_req(ovc, CALL_ID_ALL, CALL_STATUS_MODE_ADDR_AND_ORIGIN, NULL, NULL) == NULL)
DBG("Failed to request call status");
ofono_voicecall_register(ovc);
@@ -1316,7 +1314,7 @@ static void isi_voicecall_remove(struct ofono_voicecall *call)
{
struct isi_voicecall *data = ofono_voicecall_get_data(call);
- if (!data)
+ if (data == NULL)
return;
ofono_voicecall_set_data(call, NULL);
diff --git a/drivers/mbmmodem/gprs-context.c b/drivers/mbmmodem/gprs-context.c
index 553b7fd..0a1ca2c 100644
--- a/drivers/mbmmodem/gprs-context.c
+++ b/drivers/mbmmodem/gprs-context.c
@@ -364,7 +364,7 @@ static void mbm_gprs_activate_primary(struct ofono_gprs_context *gc,
DBG("cid %u", ctx->cid);
- if (!cbd)
+ if (cbd == NULL)
goto error;
gcd->active_context = ctx->cid;
@@ -408,7 +408,7 @@ static void mbm_gprs_deactivate_primary(struct ofono_gprs_context *gc,
DBG("cid %u", cid);
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = gc;
@@ -471,7 +471,7 @@ static int mbm_gprs_context_probe(struct ofono_gprs_context *gc,
DBG("");
gcd = g_try_new0(struct gprs_context_data, 1);
- if (!gcd)
+ if (gcd == NULL)
return -ENOMEM;
gcd->chat = g_at_chat_clone(chat);
diff --git a/drivers/mbmmodem/stk.c b/drivers/mbmmodem/stk.c
index 87a2dd0..81c36db 100644
--- a/drivers/mbmmodem/stk.c
+++ b/drivers/mbmmodem/stk.c
@@ -88,7 +88,7 @@ static void mbm_stk_envelope(struct ofono_stk *stk, int length,
DBG("");
- if (!cbd || !buf)
+ if (cbd == NULL || buf == NULL)
goto error;
len = sprintf(buf, "AT*STKE=\"");
@@ -134,7 +134,7 @@ static void mbm_stk_terminal_response(struct ofono_stk *stk, int length,
DBG("");
- if (!cbd || !buf)
+ if (cbd == NULL || buf == NULL)
goto error;
len = sprintf(buf, "AT*STKR=\"");
@@ -236,7 +236,7 @@ static int mbm_stk_probe(struct ofono_stk *stk, unsigned int vendor, void *data)
DBG("");
sd = g_try_new0(struct stk_data, 1);
- if (!sd)
+ if (sd == NULL)
return -ENOMEM;
sd->chat = g_at_chat_clone(chat);
diff --git a/drivers/nwmodem/radio-settings.c b/drivers/nwmodem/radio-settings.c
index 2f5527e..36fab39 100644
--- a/drivers/nwmodem/radio-settings.c
+++ b/drivers/nwmodem/radio-settings.c
@@ -170,7 +170,7 @@ static int nw_radio_settings_probe(struct ofono_radio_settings *rs,
struct radio_settings_data *rsd;
rsd = g_try_new0(struct radio_settings_data, 1);
- if (!rsd)
+ if (rsd == NULL)
return -ENOMEM;
rsd->chat = g_at_chat_clone(chat);
diff --git a/drivers/stemodem/gprs-context.c b/drivers/stemodem/gprs-context.c
index 1675cd8..faa3124 100644
--- a/drivers/stemodem/gprs-context.c
+++ b/drivers/stemodem/gprs-context.c
@@ -158,7 +158,7 @@ static struct conn_info *conn_info_create(unsigned int device,
{
struct conn_info *connection = g_try_new0(struct conn_info, 1);
- if (!connection)
+ if (connection == NULL)
return NULL;
connection->cid = 0;
@@ -206,7 +206,7 @@ static void ste_eppsd_down_cb(gboolean ok, GAtResult *result,
GUINT_TO_POINTER(gcd->active_context),
conn_compare_by_cid);
- if (!l) {
+ if (l == NULL) {
DBG("Did not find data (used caif device) for"
"connection with cid; %d",
gcd->active_context);
@@ -247,7 +247,7 @@ static void ste_eppsd_up_cb(gboolean ok, GAtResult *result, gpointer user_data)
GUINT_TO_POINTER(gcd->active_context),
conn_compare_by_cid);
- if (!l) {
+ if (l == NULL) {
DBG("Did not find data (device and channel id)"
"for connection with cid; %d",
gcd->active_context);
@@ -344,7 +344,7 @@ static void ste_cgdcont_cb(gboolean ok, GAtResult *result, gpointer user_data)
l = g_slist_find_custom(g_caif_devices, GUINT_TO_POINTER(0),
conn_compare_by_cid);
- if (!l) {
+ if (l == NULL) {
DBG("at_cgdcont_cb, no more available devices");
goto error;
}
@@ -376,7 +376,7 @@ static void ste_gprs_activate_primary(struct ofono_gprs_context *gc,
char buf[AUTH_BUF_LENGTH];
int len;
- if (!cbd)
+ if (cbd == NULL)
goto error;
gcd->active_context = ctx->cid;
@@ -421,7 +421,7 @@ static void ste_gprs_deactivate_primary(struct ofono_gprs_context *gc,
char buf[64];
GSList *l;
- if (!cbd)
+ if (cbd == NULL)
goto error;
gcd->active_context = id;
@@ -430,7 +430,7 @@ static void ste_gprs_deactivate_primary(struct ofono_gprs_context *gc,
l = g_slist_find_custom(g_caif_devices, GUINT_TO_POINTER(id),
conn_compare_by_cid);
- if (!l) {
+ if (l == NULL) {
DBG("at_gprs_deactivate_primary, did not find"
"data (channel id) for connection with cid; %d", id);
goto error;
diff --git a/drivers/stemodem/radio-settings.c b/drivers/stemodem/radio-settings.c
index 5b16ec0..6377431 100644
--- a/drivers/stemodem/radio-settings.c
+++ b/drivers/stemodem/radio-settings.c
@@ -193,7 +193,7 @@ static int ste_radio_settings_probe(struct ofono_radio_settings *rs,
GAtChat *chat = data;
struct radio_settings_data *rsd;
rsd = g_try_new0(struct radio_settings_data, 1);
- if (!rsd)
+ if (rsd == NULL)
return -ENOMEM;
rsd->chat = chat;
diff --git a/drivers/stemodem/voicecall.c b/drivers/stemodem/voicecall.c
index b9d91d2..bf68f52 100644
--- a/drivers/stemodem/voicecall.c
+++ b/drivers/stemodem/voicecall.c
@@ -109,7 +109,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->type = type;
@@ -187,7 +187,7 @@ static void ste_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;
@@ -235,7 +235,7 @@ static void ste_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;
@@ -299,7 +299,7 @@ static void ste_release_specific(struct ofono_voicecall *vc, int id,
struct release_id_req *req = g_try_new0(struct release_id_req, 1);
char buf[32];
- if (!req)
+ if (req == NULL)
goto error;
req->vc = vc;
@@ -379,13 +379,13 @@ static void ste_send_dtmf(struct ofono_voicecall *vc, const char *dtmf,
int s;
char *buf;
- if (!cbd)
+ if (cbd == NULL)
goto error;
/* strlen("AT+VTS=) = 7 */
buf = g_try_new(char, len + 7);
- if (!buf)
+ if (buf == NULL)
goto error;
sprintf(buf, "AT+VTS=%s", dtmf);
@@ -506,7 +506,7 @@ static void ecav_notify(GAtResult *result, gpointer user_data)
new_call = create_call(vc, call_type, direction, status,
num, num_type, clip_validity);
- if (!new_call) {
+ if (new_call == NULL) {
ofono_error("Unable to malloc. "
"Call management is fubar");
return;
@@ -546,7 +546,7 @@ static int ste_voicecall_probe(struct ofono_voicecall *vc, unsigned int vendor,
struct voicecall_data *vd;
vd = g_try_new0(struct voicecall_data, 1);
- if (!vd)
+ if (vd == NULL)
return -ENOMEM;
vd->chat = g_at_chat_clone(chat);
--
1.7.3.2
^ permalink raw reply related [flat|nested] 20+ messages in thread* Re: [PATCH 2/9] drivers: explicitly compare pointers to NULL
2010-11-27 19:38 ` [PATCH 2/9] drivers: explicitly compare pointers to NULL Lucas De Marchi
@ 2010-11-29 20:48 ` Denis Kenzior
0 siblings, 0 replies; 20+ messages in thread
From: Denis Kenzior @ 2010-11-29 20:48 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 4042 bytes --]
On 11/27/2010 01:38 PM, Lucas De Marchi wrote:
> 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>
> ---
> drivers/atmodem/atutil.c | 2 +-
> drivers/atmodem/atutil.h | 2 +-
> drivers/atmodem/call-barring.c | 6 ++--
> drivers/atmodem/call-forwarding.c | 4 +-
> drivers/atmodem/call-meter.c | 14 ++++++------
> drivers/atmodem/call-settings.c | 14 ++++++------
> drivers/atmodem/call-volume.c | 4 +-
> drivers/atmodem/cbs.c | 6 ++--
> drivers/atmodem/devinfo.c | 8 +++---
> drivers/atmodem/gprs-context.c | 2 +-
> drivers/atmodem/gprs.c | 6 ++--
> drivers/atmodem/network-registration.c | 18 ++++++++--------
> drivers/atmodem/phonebook.c | 4 +-
> drivers/atmodem/sim-poll.c | 2 +-
> drivers/atmodem/sim.c | 32 +++++++++++++++---------------
> drivers/atmodem/sms.c | 12 +++++-----
> drivers/atmodem/stk.c | 4 +-
> drivers/atmodem/ussd.c | 6 ++--
> drivers/atmodem/voicecall.c | 24 +++++++++++-----------
> drivers/calypsomodem/stk.c | 6 ++--
> drivers/calypsomodem/voicecall.c | 6 ++--
> drivers/hfpmodem/call-volume.c | 4 +-
> drivers/hfpmodem/network-registration.c | 6 ++--
> drivers/hfpmodem/voicecall.c | 28 +++++++++++++-------------
> drivers/hsomodem/gprs-context.c | 4 +-
> drivers/hsomodem/radio-settings.c | 2 +-
> drivers/huaweimodem/audio-settings.c | 2 +-
> drivers/huaweimodem/gprs-context.c | 6 ++--
> drivers/huaweimodem/voicecall.c | 8 +++---
> drivers/ifxmodem/audio-settings.c | 2 +-
> drivers/ifxmodem/gprs-context.c | 8 +++---
> drivers/ifxmodem/radio-settings.c | 2 +-
> drivers/ifxmodem/stk.c | 6 ++--
> drivers/ifxmodem/voicecall.c | 18 ++++++++--------
> drivers/isimodem/audio-settings.c | 6 ++--
> drivers/isimodem/call-barring.c | 12 +++++-----
> drivers/isimodem/call-forwarding.c | 12 +++++-----
> drivers/isimodem/call-meter.c | 4 +-
> drivers/isimodem/call-settings.c | 10 ++++----
> drivers/isimodem/cbs.c | 9 +++----
> drivers/isimodem/devinfo.c | 12 +++++-----
> drivers/isimodem/gprs-context.c | 19 +++++++----------
> drivers/isimodem/gprs.c | 10 ++++----
> drivers/isimodem/infoserver.c | 4 +-
> drivers/isimodem/network-registration.c | 22 +++++++++-----------
> drivers/isimodem/phonebook.c | 10 ++++----
> drivers/isimodem/radio-settings.c | 10 ++++----
> drivers/isimodem/sim.c | 12 +++++-----
> drivers/isimodem/sms.c | 17 +++++++--------
> drivers/isimodem/ssn.c | 6 ++--
> drivers/isimodem/ussd.c | 10 ++++----
> drivers/isimodem/voicecall.c | 12 ++++------
> drivers/mbmmodem/gprs-context.c | 6 ++--
> drivers/mbmmodem/stk.c | 6 ++--
> drivers/nwmodem/radio-settings.c | 2 +-
> drivers/stemodem/gprs-context.c | 14 ++++++------
> drivers/stemodem/radio-settings.c | 2 +-
> drivers/stemodem/voicecall.c | 16 +++++++-------
> 58 files changed, 256 insertions(+), 265 deletions(-)
>
Patch has been applied. However, I had to amend the patch since it
introduced style issues (particularly lines over 80 characters). Is
there any way to preserve the max line width in the future? Otherwise
you might have to amend them by hand...
Regards,
-Denis
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 3/9] unit: explicitly compare pointers to NULL
2010-11-27 19:38 [PATCH 1/9] coding-style: add rule about checking NULL pointer Lucas De Marchi
2010-11-27 19:38 ` [PATCH 2/9] drivers: explicitly compare pointers to NULL Lucas De Marchi
@ 2010-11-27 19:38 ` Lucas De Marchi
2010-11-29 20:49 ` Denis Kenzior
2010-11-27 19:38 ` [PATCH 4/9] gisi: " Lucas De Marchi
` (6 subsequent siblings)
8 siblings, 1 reply; 20+ messages in thread
From: Lucas De Marchi @ 2010-11-27 19:38 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1608 bytes --]
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>
---
unit/test-caif.c | 2 +-
unit/test-mux.c | 2 +-
unit/test-simutil.c | 4 ++--
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/unit/test-caif.c b/unit/test-caif.c
index 51e29bc..2c63d4c 100644
--- a/unit/test-caif.c
+++ b/unit/test-caif.c
@@ -124,7 +124,7 @@ static void test_connect(gboolean use_socket)
g_io_channel_unref(io);
- if (!chat) {
+ if (chat == NULL) {
g_printerr("Chat creation failed\n");
return;
}
diff --git a/unit/test-mux.c b/unit/test-mux.c
index e80b47c..d0e2d32 100644
--- a/unit/test-mux.c
+++ b/unit/test-mux.c
@@ -201,7 +201,7 @@ static void test_mux(void)
g_io_channel_unref(io);
- if (!chat) {
+ if (chat == NULL) {
g_printerr("Chat creation failed\n");
return;
}
diff --git a/unit/test-simutil.c b/unit/test-simutil.c
index 7aa09b4..155cddd 100644
--- a/unit/test-simutil.c
+++ b/unit/test-simutil.c
@@ -372,7 +372,7 @@ static void test_eons()
sim_eons_optimize(eons_info);
op_info = sim_eons_lookup(eons_info, "246", "82");
- g_assert(!op_info);
+ g_assert(op_info == NULL);
op_info = sim_eons_lookup(eons_info, "246", "81");
g_assert(op_info);
@@ -391,7 +391,7 @@ static void test_ef_db()
g_assert(info);
info = sim_ef_db_lookup(0x6FB1);
- g_assert(!info);
+ g_assert(info == NULL);
info = sim_ef_db_lookup(0x2F05);
g_assert(info);
--
1.7.3.2
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH 4/9] gisi: explicitly compare pointers to NULL
2010-11-27 19:38 [PATCH 1/9] coding-style: add rule about checking NULL pointer Lucas De Marchi
2010-11-27 19:38 ` [PATCH 2/9] drivers: explicitly compare pointers to NULL Lucas De Marchi
2010-11-27 19:38 ` [PATCH 3/9] unit: " Lucas De Marchi
@ 2010-11-27 19:38 ` Lucas De Marchi
2010-11-29 20:49 ` Denis Kenzior
2010-11-27 19:38 ` [PATCH 5/9] examples: " Lucas De Marchi
` (5 subsequent siblings)
8 siblings, 1 reply; 20+ messages in thread
From: Lucas De Marchi @ 2010-11-27 19:38 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 7507 bytes --]
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>
---
gisi/client.c | 46 +++++++++++++++++++++++-----------------------
gisi/iter.c | 2 +-
gisi/server.c | 6 +++---
gisi/verify.c | 4 ++--
4 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/gisi/client.c b/gisi/client.c
index 8e41331..8c0cc72 100644
--- a/gisi/client.c
+++ b/gisi/client.c
@@ -133,7 +133,7 @@ GIsiClient *g_isi_client_create(GIsiModem *modem, uint8_t resource)
GIOChannel *channel;
client = g_try_new0(GIsiClient, 1);
- if (!client) {
+ if (client == NULL) {
errno = ENOMEM;
return NULL;
}
@@ -152,7 +152,7 @@ GIsiClient *g_isi_client_create(GIsiModem *modem, uint8_t resource)
client->inds.subs = NULL;
channel = phonet_new(modem, resource);
- if (!channel) {
+ if (channel == NULL) {
g_free(client);
return NULL;
}
@@ -173,7 +173,7 @@ GIsiClient *g_isi_client_create(GIsiModem *modem, uint8_t resource)
*/
void g_isi_version_set(GIsiClient *client, int major, int minor)
{
- if (!client)
+ if (client == NULL)
return;
client->version.major = major;
@@ -210,7 +210,7 @@ int g_isi_version_minor(GIsiClient *client)
*/
void g_isi_server_object_set(GIsiClient *client, uint16_t obj)
{
- if (!client)
+ if (client == NULL)
return;
client->server_obj = obj;
@@ -247,7 +247,7 @@ uint8_t g_isi_client_resource(GIsiClient *client)
void g_isi_client_set_debug(GIsiClient *client, GIsiDebugFunc func,
void *opaque)
{
- if (!client)
+ if (client == NULL)
return;
client->debug_func = func;
@@ -258,7 +258,7 @@ static void g_isi_cleanup_req(void *data)
{
GIsiRequest *req = data;
- if (!req)
+ if (req == NULL)
return;
/* Finalize any pending requests */
@@ -280,7 +280,7 @@ static void g_isi_cleanup_ind(void *data)
{
GIsiIndication *ind = data;
- if (!ind)
+ if (ind == NULL)
return;
g_free(ind);
@@ -292,7 +292,7 @@ static void g_isi_cleanup_ind(void *data)
*/
void g_isi_client_destroy(GIsiClient *client)
{
- if (!client)
+ if (client == NULL)
return;
tdestroy(client->reqs.pending, g_isi_cleanup_req);
@@ -458,7 +458,7 @@ GIsiRequest *g_isi_vsendto(GIsiClient *client,
GIsiRequest *req = NULL;
GIsiRequest **old;
- if (!client) {
+ if (client == NULL) {
errno = EINVAL;
return NULL;
}
@@ -467,7 +467,7 @@ GIsiRequest *g_isi_vsendto(GIsiClient *client,
if (cb) {
req = g_try_new0(GIsiRequest, 1);
- if (!req) {
+ if (req == NULL) {
errno = ENOMEM;
return NULL;
}
@@ -479,7 +479,7 @@ GIsiRequest *g_isi_vsendto(GIsiClient *client,
req->notify = notify;
old = tsearch(req, &client->reqs.pending, g_isi_cmp);
- if (!old) {
+ if (old == NULL) {
errno = ENOMEM;
goto error;
}
@@ -563,7 +563,7 @@ GIsiRequest *g_isi_vsend(GIsiClient *client,
.spn_family = AF_PHONET,
};
- if (!client) {
+ if (client == NULL) {
errno = EINVAL;
return NULL;
}
@@ -581,7 +581,7 @@ GIsiRequest *g_isi_vsend(GIsiClient *client,
*/
void g_isi_request_cancel(GIsiRequest *req)
{
- if (!req)
+ if (req == NULL)
return;
if (req->timeout > 0)
@@ -629,7 +629,7 @@ int g_isi_commit_subscriptions(GIsiClient *client)
0,
};
- if (!client)
+ if (client == NULL)
return -EINVAL;
if (!client->inds.source) {
@@ -637,7 +637,7 @@ int g_isi_commit_subscriptions(GIsiClient *client)
return 0;
channel = phonet_new(client->modem, PN_COMMGR);
- if (!channel)
+ if (channel == NULL)
return -errno;
client->inds.fd = g_io_channel_unix_get_fd(channel);
@@ -681,13 +681,13 @@ int g_isi_add_subscription(GIsiClient *client, uint8_t res, uint8_t type,
return -EINVAL;
ind = g_try_new0(GIsiIndication, 1);
- if (!ind)
+ if (ind == NULL)
return -ENOMEM;
ind->type = (res << 8) | type;
old = tsearch(ind, &client->inds.subs, g_isi_cmp);
- if (!old) {
+ if (old == NULL) {
g_free(ind);
return -ENOMEM;
}
@@ -724,7 +724,7 @@ int g_isi_subscribe(GIsiClient *client, uint8_t type,
{
int ret;
- if (!client)
+ if (client == NULL)
return -EINVAL;
ret = g_isi_add_subscription(client, client->resource, type, cb, data);
@@ -748,11 +748,11 @@ void g_isi_remove_subscription(GIsiClient *client, uint8_t res, uint8_t type)
GIsiIndication *ind;
unsigned int id = (res << 8) | type;
- if (!client)
+ if (client == NULL)
return;
ret = tfind(&id, &client->inds.subs, g_isi_cmp);
- if (!ret)
+ if (ret == NULL)
return;
ind = *(GIsiIndication **)ret;
@@ -770,7 +770,7 @@ void g_isi_remove_subscription(GIsiClient *client, uint8_t res, uint8_t type)
*/
void g_isi_unsubscribe(GIsiClient *client, uint8_t type)
{
- if (!client)
+ if (client == NULL)
return;
g_isi_remove_subscription(client, client->resource, type);
@@ -786,7 +786,7 @@ static void g_isi_dispatch_indication(GIsiClient *client, uint8_t res,
unsigned type = (res << 8) | msg[0];
ret = tfind(&type, &client->inds.subs, g_isi_cmp);
- if (!ret)
+ if (ret == NULL)
return;
ind = *(GIsiIndication **)ret;
@@ -804,7 +804,7 @@ static void g_isi_dispatch_response(GIsiClient *client, uint8_t res,
unsigned id = msg[0];
ret = tfind(&id, &client->reqs.pending, g_isi_cmp);
- if (!ret) {
+ if (ret == NULL) {
/* This could either be an unsolicited response, which
* we will ignore, or an incoming request, which we
* handle just like an incoming indication */
diff --git a/gisi/iter.c b/gisi/iter.c
index e5c2893..3eef8dd 100644
--- a/gisi/iter.c
+++ b/gisi/iter.c
@@ -72,7 +72,7 @@ void g_isi_sb_iter_init(GIsiSubBlockIter *iter, const void *restrict data,
gboolean g_isi_sb_iter_is_valid(const GIsiSubBlockIter *iter)
{
- if (!iter)
+ if (iter == NULL)
return FALSE;
if (iter->sub_blocks == 0)
diff --git a/gisi/server.c b/gisi/server.c
index 159bb2d..3d96e2d 100644
--- a/gisi/server.c
+++ b/gisi/server.c
@@ -125,7 +125,7 @@ uint8_t g_isi_server_resource(GIsiServer *server)
void g_isi_server_set_debug(GIsiServer *server, GIsiDebugFunc func,
void *opaque)
{
- if (!server)
+ if (server == NULL)
return;
server->debug_func = func;
@@ -138,7 +138,7 @@ void g_isi_server_set_debug(GIsiServer *server, GIsiDebugFunc func,
*/
void g_isi_server_destroy(GIsiServer *server)
{
- if (!server)
+ if (server == NULL)
return;
g_source_remove(server->source);
@@ -153,7 +153,7 @@ g_isi_server_add_name(GIsiServer *self)
{
uint16_t object = 0;
- if (!self)
+ if (self == NULL)
return;
if (ioctl(self->fd, SIOCPNGETOBJECT, &object) < 0) {
diff --git a/gisi/verify.c b/gisi/verify.c
index 05746fa..cb669f9 100644
--- a/gisi/verify.c
+++ b/gisi/verify.c
@@ -135,7 +135,7 @@ GIsiRequest *g_isi_verify(GIsiClient *client, GIsiVerifyFunc func,
data->resource = g_isi_client_resource(client);
req = send_version_query(client, verify_cb, data);
- if (!req)
+ if (req == NULL)
g_free(data);
return req;
@@ -159,7 +159,7 @@ GIsiRequest *g_isi_verify_resource(GIsiClient *client, uint8_t resource,
data->resource = resource;
req = send_version_query(client, verify_cb, data);
- if (!req)
+ if (req == NULL)
g_free(data);
return req;
--
1.7.3.2
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH 5/9] examples: explicitly compare pointers to NULL
2010-11-27 19:38 [PATCH 1/9] coding-style: add rule about checking NULL pointer Lucas De Marchi
` (2 preceding siblings ...)
2010-11-27 19:38 ` [PATCH 4/9] gisi: " Lucas De Marchi
@ 2010-11-27 19:38 ` Lucas De Marchi
2010-11-29 20:49 ` Denis Kenzior
2010-11-27 19:39 ` [PATCH 6/9] gatchat: " Lucas De Marchi
` (4 subsequent siblings)
8 siblings, 1 reply; 20+ messages in thread
From: Lucas De Marchi @ 2010-11-27 19:38 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 769 bytes --]
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>
---
examples/nettime.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/examples/nettime.c b/examples/nettime.c
index 60045be..3843ce2 100644
--- a/examples/nettime.c
+++ b/examples/nettime.c
@@ -50,7 +50,7 @@ static void example_nettime_remove(struct ofono_nettime_context *context)
static void example_nettime_info_received(struct ofono_nettime_context *context,
struct ofono_network_time *info)
{
- if (!info)
+ if (info == NULL)
return;
ofono_debug("Received a network time notification on modem: %p",
--
1.7.3.2
^ permalink raw reply related [flat|nested] 20+ messages in thread* [PATCH 6/9] gatchat: explicitly compare pointers to NULL
2010-11-27 19:38 [PATCH 1/9] coding-style: add rule about checking NULL pointer Lucas De Marchi
` (3 preceding siblings ...)
2010-11-27 19:38 ` [PATCH 5/9] examples: " Lucas De Marchi
@ 2010-11-27 19:39 ` Lucas De Marchi
2010-11-29 20:50 ` Denis Kenzior
2010-11-27 19:39 ` [PATCH 7/9] gdbus: " Lucas De Marchi
` (3 subsequent siblings)
8 siblings, 1 reply; 20+ messages in thread
From: Lucas De Marchi @ 2010-11-27 19:39 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 23100 bytes --]
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>
---
gatchat/gatchat.c | 46 +++++++++++++++++++++++-----------------------
gatchat/gathdlc.c | 8 ++++----
gatchat/gatio.c | 4 ++--
gatchat/gatmux.c | 6 +++---
gatchat/gatppp.c | 4 ++--
gatchat/gatresult.c | 44 ++++++++++++++++++++++----------------------
gatchat/gatserver.c | 16 ++++++++--------
gatchat/gatutil.c | 6 +++---
gatchat/gsmdial.c | 2 +-
gatchat/ppp_auth.c | 6 +++---
gatchat/ppp_cp.c | 4 ++--
gatchat/ppp_ipcp.c | 4 ++--
gatchat/ppp_lcp.c | 6 +++---
gatchat/ringbuffer.c | 14 +++++++-------
gatchat/test-qcdm.c | 6 +++---
gatchat/test-server.c | 18 +++++++++---------
16 files changed, 97 insertions(+), 97 deletions(-)
diff --git a/gatchat/gatchat.c b/gatchat/gatchat.c
index 218f592..a486f40 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;
}
@@ -803,7 +803,7 @@ static gboolean wakeup_no_response(gpointer user_data)
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();
@@ -855,7 +855,7 @@ static gboolean can_write_data(gpointer data)
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);
@@ -1006,7 +1006,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++;
@@ -1028,11 +1028,11 @@ static struct at_notify *at_notify_create(struct at_chat *chat,
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 +1055,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 +1124,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 +1165,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 +1206,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 +1226,14 @@ 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,
diff --git a/gatchat/gathdlc.c b/gatchat/gathdlc.c
index 37f014a..dd11043 100644
--- a/gatchat/gathdlc.c
+++ b/gatchat/gathdlc.c
@@ -256,7 +256,7 @@ GAtHDLC *g_at_hdlc_new(GIOChannel *channel)
GAtHDLC *g_at_hdlc_ref(GAtHDLC *hdlc)
{
- if (!hdlc)
+ if (hdlc == NULL)
return NULL;
g_atomic_int_inc(&hdlc->ref_count);
@@ -266,7 +266,7 @@ GAtHDLC *g_at_hdlc_ref(GAtHDLC *hdlc)
void g_at_hdlc_unref(GAtHDLC *hdlc)
{
- if (!hdlc)
+ if (hdlc == NULL)
return;
if (g_atomic_int_dec_and_test(&hdlc->ref_count) == FALSE)
@@ -291,7 +291,7 @@ void g_at_hdlc_unref(GAtHDLC *hdlc)
void g_at_hdlc_set_debug(GAtHDLC *hdlc, GAtDebugFunc func, gpointer user_data)
{
- if (!hdlc)
+ if (hdlc == NULL)
return;
hdlc->debugf = func;
@@ -301,7 +301,7 @@ void g_at_hdlc_set_debug(GAtHDLC *hdlc, GAtDebugFunc func, gpointer user_data)
void g_at_hdlc_set_receive(GAtHDLC *hdlc, GAtReceiveFunc func,
gpointer user_data)
{
- if (!hdlc)
+ if (hdlc == NULL)
return;
hdlc->receive_func = func;
diff --git a/gatchat/gatio.c b/gatchat/gatio.c
index a9faba5..b65be86 100644
--- a/gatchat/gatio.c
+++ b/gatchat/gatio.c
@@ -177,11 +177,11 @@ static GAtIO *create_io(GIOChannel *channel, GIOFlags flags)
{
GAtIO *io;
- if (!channel)
+ if (channel == NULL)
return NULL;
io = g_try_new0(GAtIO, 1);
- if (!io)
+ if (io == NULL)
return io;
io->ref_count = 1;
diff --git a/gatchat/gatmux.c b/gatchat/gatmux.c
index fb912e6..9aed987 100644
--- a/gatchat/gatmux.c
+++ b/gatchat/gatmux.c
@@ -414,7 +414,7 @@ static gboolean watch_dispatch(GSource *source, GSourceFunc callback,
GAtMuxWatch *watch = (GAtMuxWatch *) source;
GAtMuxChannel *channel = (GAtMuxChannel *) watch->channel;
- if (!func)
+ if (func == NULL)
return FALSE;
return func(watch->channel, channel->condition & watch->condition,
@@ -554,11 +554,11 @@ GAtMux *g_at_mux_new(GIOChannel *channel, const GAtMuxDriver *driver)
{
GAtMux *mux;
- if (!channel)
+ if (channel == NULL)
return NULL;
mux = g_try_new0(GAtMux, 1);
- if (!mux)
+ if (mux == NULL)
return NULL;
mux->ref_count = 1;
diff --git a/gatchat/gatppp.c b/gatchat/gatppp.c
index 5e875b8..87cb46b 100644
--- a/gatchat/gatppp.c
+++ b/gatchat/gatppp.c
@@ -78,7 +78,7 @@ struct _GAtPPP {
void ppp_debug(GAtPPP *ppp, const char *str)
{
- if (!ppp || !ppp->debugf)
+ if (ppp == NULL || !ppp->debugf)
return;
ppp->debugf(str, ppp->debug_data);
@@ -490,7 +490,7 @@ static GAtPPP *ppp_init_common(GAtHDLC *hdlc, gboolean is_server, guint32 ip)
GAtPPP *ppp;
ppp = g_try_malloc0(sizeof(GAtPPP));
- if (!ppp)
+ if (ppp == NULL)
return NULL;
ppp->hdlc = g_at_hdlc_ref(hdlc);
diff --git a/gatchat/gatresult.c b/gatchat/gatresult.c
index cd7ec71..8a6dfae 100644
--- a/gatchat/gatresult.c
+++ b/gatchat/gatresult.c
@@ -81,10 +81,10 @@ const char *g_at_result_iter_raw_line(GAtResultIter *iter)
{
const char *line;
- if (!iter)
+ if (iter == NULL)
return NULL;
- if (!iter->l)
+ if (iter->l == NULL)
return NULL;
line = iter->l->data;
@@ -113,10 +113,10 @@ gboolean g_at_result_iter_next_unquoted_string(GAtResultIter *iter,
unsigned int len;
char *line;
- if (!iter)
+ if (iter == NULL)
return FALSE;
- if (!iter->l)
+ if (iter->l == NULL)
return FALSE;
line = iter->l->data;
@@ -157,10 +157,10 @@ gboolean g_at_result_iter_next_string(GAtResultIter *iter, const char **str)
unsigned int len;
char *line;
- if (!iter)
+ if (iter == NULL)
return FALSE;
- if (!iter->l)
+ if (iter->l == NULL)
return FALSE;
line = iter->l->data;
@@ -209,10 +209,10 @@ gboolean g_at_result_iter_next_hexstring(GAtResultIter *iter,
char *line;
char *bufpos;
- if (!iter)
+ if (iter == NULL)
return FALSE;
- if (!iter->l)
+ if (iter->l == NULL)
return FALSE;
line = iter->l->data;
@@ -264,10 +264,10 @@ gboolean g_at_result_iter_next_number(GAtResultIter *iter, gint *number)
int value = 0;
char *line;
- if (!iter)
+ if (iter == NULL)
return FALSE;
- if (!iter->l)
+ if (iter->l == NULL)
return FALSE;
line = iter->l->data;
@@ -301,10 +301,10 @@ gboolean g_at_result_iter_next_range(GAtResultIter *iter, gint *min, gint *max)
int high = 0;
char *line;
- if (!iter)
+ if (iter == NULL)
return FALSE;
- if (!iter->l)
+ if (iter->l == NULL)
return FALSE;
line = iter->l->data;
@@ -391,10 +391,10 @@ gboolean g_at_result_iter_skip_next(GAtResultIter *iter)
unsigned int skipped_to;
char *line;
- if (!iter)
+ if (iter == NULL)
return FALSE;
- if (!iter->l)
+ if (iter->l == NULL)
return FALSE;
line = iter->l->data;
@@ -414,10 +414,10 @@ gboolean g_at_result_iter_open_list(GAtResultIter *iter)
char *line;
unsigned int len;
- if (!iter)
+ if (iter == NULL)
return FALSE;
- if (!iter->l)
+ if (iter->l == NULL)
return FALSE;
line = iter->l->data;
@@ -443,10 +443,10 @@ gboolean g_at_result_iter_close_list(GAtResultIter *iter)
char *line;
unsigned int len;
- if (!iter)
+ if (iter == NULL)
return FALSE;
- if (!iter->l)
+ if (iter->l == NULL)
return FALSE;
line = iter->l->data;
@@ -467,7 +467,7 @@ gboolean g_at_result_iter_close_list(GAtResultIter *iter)
const char *g_at_result_final_response(GAtResult *result)
{
- if (!result)
+ if (result == NULL)
return NULL;
return result->final_or_pdu;
@@ -475,7 +475,7 @@ const char *g_at_result_final_response(GAtResult *result)
const char *g_at_result_pdu(GAtResult *result)
{
- if (!result)
+ if (result == NULL)
return NULL;
return result->final_or_pdu;
@@ -483,10 +483,10 @@ const char *g_at_result_pdu(GAtResult *result)
gint g_at_result_num_response_lines(GAtResult *result)
{
- if (!result)
+ if (result == NULL)
return 0;
- if (!result->lines)
+ if (result->lines == NULL)
return 0;
return g_slist_length(result->lines);
diff --git a/gatchat/gatserver.c b/gatchat/gatserver.c
index 49e0de4..11eaac6 100644
--- a/gatchat/gatserver.c
+++ b/gatchat/gatserver.c
@@ -128,7 +128,7 @@ static struct ring_buffer *allocate_next(GAtServer *server)
{
struct ring_buffer *buf = ring_buffer_new(BUF_SIZE);
- if (!buf)
+ if (buf == NULL)
return NULL;
g_queue_push_tail(server->write_queue, buf);
@@ -812,7 +812,7 @@ static char *extract_line(GAtServer *p, struct ring_buffer *rbuf)
line_length -= 3;
line = g_try_new(char, line_length + 1);
- if (!line) {
+ if (line == NULL) {
ring_buffer_drain(rbuf, p->read_so_far);
return NULL;
}
@@ -1066,11 +1066,11 @@ GAtServer *g_at_server_new(GIOChannel *io)
{
GAtServer *server;
- if (!io)
+ if (io == NULL)
return NULL;
server = g_try_new0(GAtServer, 1);
- if (!server)
+ if (server == NULL)
return NULL;
server->ref_count = 1;
@@ -1089,7 +1089,7 @@ GAtServer *g_at_server_new(GIOChannel *io)
if (!server->write_queue)
goto error;
- if (!allocate_next(server))
+ if (allocate_next(server) == NULL)
goto error;
server->max_read_attempts = 3;
@@ -1207,7 +1207,7 @@ void g_at_server_unref(GAtServer *server)
gboolean g_at_server_shutdown(GAtServer *server)
{
- if (!server)
+ if (server == NULL)
return FALSE;
/* Don't trigger user disconnect on shutdown */
@@ -1259,7 +1259,7 @@ gboolean g_at_server_register(GAtServer *server, char *prefix,
return FALSE;
node = g_try_new0(struct at_command, 1);
- if (!node)
+ if (node == NULL)
return FALSE;
node->notify = notify;
@@ -1282,7 +1282,7 @@ gboolean g_at_server_unregister(GAtServer *server, const char *prefix)
return FALSE;
node = g_hash_table_lookup(server->command_list, prefix);
- if (!node)
+ if (node == NULL)
return FALSE;
g_hash_table_remove(server->command_list, prefix);
diff --git a/gatchat/gatutil.c b/gatchat/gatutil.c
index 827dc60..393d94c 100644
--- a/gatchat/gatutil.c
+++ b/gatchat/gatutil.c
@@ -42,7 +42,7 @@ void g_at_util_debug_chat(gboolean in, const char *str, gsize len,
gsize ctrlz_size = strlen(ctrlz);
gsize i;
- if (!debugf || !len)
+ if (debugf == NULL || !len)
return;
for (i = 0; i < len; i++) {
@@ -116,11 +116,11 @@ void g_at_util_debug_dump(gboolean in, const unsigned char *buf, gsize len,
GString *str;
gsize i;
- if (!debugf || !len)
+ if (debugf == NULL || !len)
return;
str = g_string_sized_new(1 + (len * 2));
- if (!str)
+ if (str == NULL)
return;
g_string_append_c(str, type);
diff --git a/gatchat/gsmdial.c b/gatchat/gsmdial.c
index 57d0d9e..22ff2ff 100644
--- a/gatchat/gsmdial.c
+++ b/gatchat/gsmdial.c
@@ -303,7 +303,7 @@ static void connect_cb(gboolean ok, GAtResult *result, gpointer user_data)
/* open ppp */
ppp = g_at_ppp_new_from_io(io);
- if (!ppp) {
+ if (ppp == NULL) {
g_print("Unable to create PPP object\n");
exit(1);
}
diff --git a/gatchat/ppp_auth.c b/gatchat/ppp_auth.c
index d26b764..fca873c 100644
--- a/gatchat/ppp_auth.c
+++ b/gatchat/ppp_auth.c
@@ -66,7 +66,7 @@ static void chap_process_challenge(struct ppp_chap *chap, const guint8 *packet)
/* create a checksum over id, secret, and challenge */
checksum = g_checksum_new(chap->method);
- if (!checksum)
+ if (checksum == NULL)
return;
g_checksum_update(checksum, &header->identifier, 1);
@@ -84,7 +84,7 @@ static void chap_process_challenge(struct ppp_chap *chap, const guint8 *packet)
digest_len = g_checksum_type_get_length(chap->method);
response_length = digest_len + sizeof(*header) + 1;
ppp_packet = ppp_packet_new(response_length, CHAP_PROTOCOL);
- if (!ppp_packet)
+ if (ppp_packet == NULL)
goto challenge_out;
response = (struct chap_header *) &ppp_packet->info;
@@ -144,7 +144,7 @@ struct ppp_chap *ppp_chap_new(GAtPPP *ppp, guint8 method)
return NULL;
chap = g_try_new0(struct ppp_chap, 1);
- if (!chap)
+ if (chap == NULL)
return NULL;
chap->ppp = ppp;
diff --git a/gatchat/ppp_cp.c b/gatchat/ppp_cp.c
index f6220d2..31ea05a 100644
--- a/gatchat/ppp_cp.c
+++ b/gatchat/ppp_cp.c
@@ -205,7 +205,7 @@ static struct pppcp_packet *pppcp_packet_new(struct pppcp_data *data,
guint16 packet_length = bufferlen + sizeof(*packet);
ppp_packet = ppp_packet_new(packet_length, data->driver->proto);
- if (!ppp_packet)
+ if (ppp_packet == NULL)
return NULL;
/* advance past protocol to add CP header information */
@@ -1002,7 +1002,7 @@ struct pppcp_data *pppcp_new(GAtPPP *ppp, const struct pppcp_proto *proto,
struct pppcp_data *data;
data = g_try_malloc0(sizeof(struct pppcp_data));
- if (!data)
+ if (data == NULL)
return NULL;
if (dormant)
diff --git a/gatchat/ppp_ipcp.c b/gatchat/ppp_ipcp.c
index 3aa9eec..3e4f73b 100644
--- a/gatchat/ppp_ipcp.c
+++ b/gatchat/ppp_ipcp.c
@@ -471,7 +471,7 @@ struct pppcp_data *ipcp_new(GAtPPP *ppp, gboolean is_server, guint32 ip)
struct pppcp_data *pppcp;
ipcp = g_try_new0(struct ipcp_data, 1);
- if (!ipcp)
+ if (ipcp == NULL)
return NULL;
/*
@@ -481,7 +481,7 @@ struct pppcp_data *ipcp_new(GAtPPP *ppp, gboolean is_server, guint32 ip)
* as rejects.
*/
pppcp = pppcp_new(ppp, &ipcp_proto, FALSE, MAX_IPCP_FAILURE);
- if (!pppcp) {
+ if (pppcp == NULL) {
g_printerr("Failed to allocate PPPCP struct\n");
g_free(ipcp);
return NULL;
diff --git a/gatchat/ppp_lcp.c b/gatchat/ppp_lcp.c
index 5838ebd..3a80a62 100644
--- a/gatchat/ppp_lcp.c
+++ b/gatchat/ppp_lcp.c
@@ -225,7 +225,7 @@ static enum rcr_result lcp_rcr(struct pppcp_data *pppcp,
*/
option = g_try_malloc0(5);
- if (!option)
+ if (option == NULL)
return RCR_REJECT;
option[0] = AUTH_PROTO;
@@ -310,11 +310,11 @@ struct pppcp_data *lcp_new(GAtPPP *ppp, gboolean is_server)
struct lcp_data *lcp;
lcp = g_try_new0(struct lcp_data, 1);
- if (!lcp)
+ if (lcp == NULL)
return NULL;
pppcp = pppcp_new(ppp, &lcp_proto, is_server, 0);
- if (!pppcp) {
+ if (pppcp == NULL) {
g_free(lcp);
return NULL;
}
diff --git a/gatchat/ringbuffer.c b/gatchat/ringbuffer.c
index 5e9b634..becd3f8 100644
--- a/gatchat/ringbuffer.c
+++ b/gatchat/ringbuffer.c
@@ -51,11 +51,11 @@ struct ring_buffer *ring_buffer_new(unsigned int size)
return NULL;
buffer = g_try_new(struct ring_buffer, 1);
- if (!buffer)
+ if (buffer == NULL)
return NULL;
buffer->buffer = g_try_new(unsigned char, real_size);
- if (!buffer->buffer) {
+ if (buffer->buffer == NULL) {
g_free(buffer);
return NULL;
}
@@ -164,7 +164,7 @@ unsigned char *ring_buffer_read_ptr(struct ring_buffer *buf,
int ring_buffer_len(struct ring_buffer *buf)
{
- if (!buf)
+ if (buf == NULL)
return -1;
return buf->in - buf->out;
@@ -172,7 +172,7 @@ int ring_buffer_len(struct ring_buffer *buf)
void ring_buffer_reset(struct ring_buffer *buf)
{
- if (!buf)
+ if (buf == NULL)
return;
buf->in = 0;
@@ -181,7 +181,7 @@ void ring_buffer_reset(struct ring_buffer *buf)
int ring_buffer_avail(struct ring_buffer *buf)
{
- if (!buf)
+ if (buf == NULL)
return -1;
return buf->size - buf->in + buf->out;
@@ -189,7 +189,7 @@ int ring_buffer_avail(struct ring_buffer *buf)
int ring_buffer_capacity(struct ring_buffer *buf)
{
- if (!buf)
+ if (buf == NULL)
return -1;
return buf->size;
@@ -197,7 +197,7 @@ int ring_buffer_capacity(struct ring_buffer *buf)
void ring_buffer_free(struct ring_buffer *buf)
{
- if (!buf)
+ if (buf == NULL)
return;
g_free(buf->buffer);
diff --git a/gatchat/test-qcdm.c b/gatchat/test-qcdm.c
index c8a3174..a15ea9c 100644
--- a/gatchat/test-qcdm.c
+++ b/gatchat/test-qcdm.c
@@ -161,13 +161,13 @@ int main(int argc, char **argv)
g_option_context_free(context);
- if (!option_device)
+ if (option_device == NULL)
option_device = g_strdup("/dev/ttyUSB1");
g_print("Device: %s\n", option_device);
channel = g_at_tty_open(option_device, NULL);
- if (!channel) {
+ if (channel == NULL) {
g_printerr("Failed to open QCDM device\n");
return 1;
}
@@ -178,7 +178,7 @@ int main(int argc, char **argv)
g_io_channel_unref(channel);
- if (!hdlc)
+ if (hdlc == NULL)
return 1;
if (option_debug == TRUE)
diff --git a/gatchat/test-server.c b/gatchat/test-server.c
index c405f41..cb451e9 100644
--- a/gatchat/test-server.c
+++ b/gatchat/test-server.c
@@ -793,7 +793,7 @@ static void dial_cb(GAtServerRequestType type, GAtResult *cmd, gpointer user)
goto error;
dial_str = g_at_result_iter_raw_line(&iter);
- if (!dial_str)
+ if (dial_str == NULL)
goto error;
g_print("dial call %s\n", dial_str);
@@ -861,7 +861,7 @@ static gboolean create_tty(const char *modem_path)
char pty_name[256];
GIOChannel *server_io;
- if (!modem_path)
+ if (modem_path == NULL)
return FALSE;
if (openpty(&master, &slave, pty_name, NULL, NULL) < 0)
@@ -874,7 +874,7 @@ static gboolean create_tty(const char *modem_path)
server_io = g_io_channel_unix_new(master);
server = g_at_server_new(server_io);
- if (!server) {
+ if (server == NULL) {
g_io_channel_shutdown(server_io, FALSE, NULL);
g_io_channel_unref(server_io);
@@ -907,7 +907,7 @@ static gboolean on_socket_connected(GIOChannel *chan, GIOCondition cond,
server = g_at_server_new(client_io);
g_io_channel_unref(client_io);
- if (!server)
+ if (server == NULL)
goto error;
add_handler(server);
@@ -946,7 +946,7 @@ static struct sock_server *socket_common(int sk, struct sockaddr *addr,
}
sock = g_try_new0(struct sock_server, 1);
- if (!sock)
+ if (sock == NULL)
return FALSE;
sock->server_sock = sk;
@@ -961,7 +961,7 @@ static gboolean create_tcp(const char *modem_path, int port)
struct sock_server *server;
GIOChannel *server_io;
- if (!modem_path)
+ if (modem_path == NULL)
return FALSE;
sk = socket(PF_INET, SOCK_STREAM, 0);
@@ -978,7 +978,7 @@ static gboolean create_tcp(const char *modem_path, int port)
addr.sin_port = htons(port);
server = socket_common(sk, (struct sockaddr *) &addr, modem_path);
- if (!server)
+ if (server == NULL)
return FALSE;
g_print("new tcp is created at tcp port %d\n", port);
@@ -1004,7 +1004,7 @@ static gboolean create_unix(const char *modem_path, const char *sock_path)
struct sock_server *server;
GIOChannel *server_io;
- if (!modem_path)
+ if (modem_path == NULL)
return FALSE;
sk = socket(AF_UNIX, SOCK_STREAM, 0);
@@ -1024,7 +1024,7 @@ static gboolean create_unix(const char *modem_path, const char *sock_path)
unlink(addr.sun_path);
server = socket_common(sk, (struct sockaddr *) &addr, modem_path);
- if (!server)
+ if (server == NULL)
return FALSE;
g_print("new unix socket is created at %s\n", sock_path);
--
1.7.3.2
^ permalink raw reply related [flat|nested] 20+ messages in thread* Re: [PATCH 6/9] gatchat: explicitly compare pointers to NULL
2010-11-27 19:39 ` [PATCH 6/9] gatchat: " Lucas De Marchi
@ 2010-11-29 20:50 ` Denis Kenzior
0 siblings, 0 replies; 20+ messages in thread
From: Denis Kenzior @ 2010-11-29 20:50 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1131 bytes --]
Hi Lucas,
On 11/27/2010 01:39 PM, Lucas De Marchi wrote:
> 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>
> ---
> gatchat/gatchat.c | 46 +++++++++++++++++++++++-----------------------
> gatchat/gathdlc.c | 8 ++++----
> gatchat/gatio.c | 4 ++--
> gatchat/gatmux.c | 6 +++---
> gatchat/gatppp.c | 4 ++--
> gatchat/gatresult.c | 44 ++++++++++++++++++++++----------------------
> gatchat/gatserver.c | 16 ++++++++--------
> gatchat/gatutil.c | 6 +++---
> gatchat/gsmdial.c | 2 +-
> gatchat/ppp_auth.c | 6 +++---
> gatchat/ppp_cp.c | 4 ++--
> gatchat/ppp_ipcp.c | 4 ++--
> gatchat/ppp_lcp.c | 6 +++---
> gatchat/ringbuffer.c | 14 +++++++-------
> gatchat/test-qcdm.c | 6 +++---
> gatchat/test-server.c | 18 +++++++++---------
> 16 files changed, 97 insertions(+), 97 deletions(-)
>
Patch has been applied, thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 7/9] gdbus: explicitly compare pointers to NULL
2010-11-27 19:38 [PATCH 1/9] coding-style: add rule about checking NULL pointer Lucas De Marchi
` (4 preceding siblings ...)
2010-11-27 19:39 ` [PATCH 6/9] gatchat: " Lucas De Marchi
@ 2010-11-27 19:39 ` Lucas De Marchi
2010-11-29 20:50 ` Denis Kenzior
2010-12-08 15:35 ` Marcel Holtmann
2010-11-27 19:39 ` [PATCH 8/9] plugins: " Lucas De Marchi
` (2 subsequent siblings)
8 siblings, 2 replies; 20+ messages in thread
From: Lucas De Marchi @ 2010-11-27 19:39 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 7031 bytes --]
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>
---
gdbus/object.c | 24 ++++++++++++------------
gdbus/polkit.c | 2 +-
gdbus/watch.c | 21 ++++++++++-----------
3 files changed, 23 insertions(+), 24 deletions(-)
diff --git a/gdbus/object.c b/gdbus/object.c
index cc3c5da..d881c58 100644
--- a/gdbus/object.c
+++ b/gdbus/object.c
@@ -201,12 +201,12 @@ static DBusMessage *introspect(DBusConnection *connection,
return NULL;
}
- if (!data->introspect)
+ if (data->introspect == NULL)
generate_introspection_xml(connection, data,
dbus_message_get_path(message));
reply = dbus_message_new_method_return(message);
- if (!reply)
+ if (reply == NULL)
return NULL;
dbus_message_append_args(reply, DBUS_TYPE_STRING, &data->introspect,
@@ -405,7 +405,7 @@ static struct interface_data *find_interface(GSList *interfaces,
{
GSList *list;
- if (!name)
+ if (name == NULL)
return NULL;
for (list = interfaces; list; list = list->next) {
@@ -428,7 +428,7 @@ static DBusHandlerResult generic_message(DBusConnection *connection,
interface = dbus_message_get_interface(message);
iface = find_interface(data->interfaces, interface);
- if (!iface)
+ if (iface == NULL)
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
for (method = iface->methods; method &&
@@ -464,7 +464,7 @@ static void invalidate_parent_data(DBusConnection *conn, const char *child_path)
parent_path = g_strdup(child_path);
slash = strrchr(parent_path, '/');
- if (!slash)
+ if (slash == NULL)
goto done;
if (slash == parent_path && parent_path[1] != '\0')
@@ -481,7 +481,7 @@ static void invalidate_parent_data(DBusConnection *conn, const char *child_path)
goto done;
}
- if (!data)
+ if (data == NULL)
goto done;
g_free(data->introspect);
@@ -554,7 +554,7 @@ static gboolean remove_interface(struct generic_data *data, const char *name)
struct interface_data *iface;
iface = find_interface(data->interfaces, name);
- if (!iface)
+ if (iface == NULL)
return FALSE;
data->interfaces = g_slist_remove(data->interfaces, iface);
@@ -601,14 +601,14 @@ static gboolean check_signal(DBusConnection *conn, const char *path,
*args = NULL;
if (!dbus_connection_get_object_path_data(conn, path,
- (void *) &data) || !data) {
+ (void *) &data) || data == NULL) {
error("dbus_connection_emit_signal: path %s isn't registered",
path);
return FALSE;
}
iface = find_interface(data->interfaces, interface);
- if (!iface) {
+ if (iface == NULL) {
error("dbus_connection_emit_signal: %s does not implement %s",
path, interface);
return FALSE;
@@ -621,7 +621,7 @@ static gboolean check_signal(DBusConnection *conn, const char *path,
}
}
- if (!*args) {
+ if (*args == NULL) {
error("No signal named %s on interface %s", name, interface);
return FALSE;
}
@@ -644,7 +644,7 @@ static dbus_bool_t emit_signal_valist(DBusConnection *conn,
return FALSE;
signal = dbus_message_new_signal(path, interface, name);
- if (!signal) {
+ if (signal == NULL) {
error("Unable to allocate new %s.%s signal", interface, name);
return FALSE;
}
@@ -702,7 +702,7 @@ gboolean g_dbus_unregister_interface(DBusConnection *connection,
{
struct generic_data *data = NULL;
- if (!path)
+ if (path == NULL)
return FALSE;
if (dbus_connection_get_object_path_data(connection, path,
diff --git a/gdbus/polkit.c b/gdbus/polkit.c
index ed876ca..aef5075 100644
--- a/gdbus/polkit.c
+++ b/gdbus/polkit.c
@@ -163,7 +163,7 @@ int polkit_check_authorization(DBusConnection *conn,
msg = dbus_message_new_method_call(AUTHORITY_DBUS, AUTHORITY_PATH,
AUTHORITY_INTF, "CheckAuthorization");
- if (!msg) {
+ if (msg == NULL) {
dbus_free(data);
return -ENOMEM;
}
diff --git a/gdbus/watch.c b/gdbus/watch.c
index c0dcc93..e7c203a 100644
--- a/gdbus/watch.c
+++ b/gdbus/watch.c
@@ -204,8 +204,7 @@ static struct filter_data *filter_data_get(DBusConnection *connection,
struct filter_data *data;
const char *name = NULL, *owner = NULL;
- if (!filter_data_find(connection, NULL, NULL, NULL, NULL, NULL,
- NULL)) {
+ if (filter_data_find(connection, NULL, NULL, NULL, NULL, NULL, NULL) == NULL) {
if (!dbus_connection_add_filter(connection,
message_filter, NULL, NULL)) {
error("dbus_connection_add_filter() failed");
@@ -382,7 +381,7 @@ static gboolean filter_data_remove_callback(struct filter_data *data,
/* Remove filter if there are no listeners left for the connection */
data = filter_data_find(connection, NULL, NULL, NULL, NULL, NULL,
NULL);
- if (!data)
+ if (data == NULL)
dbus_connection_remove_filter(connection, message_filter,
NULL);
@@ -480,7 +479,7 @@ static DBusHandlerResult service_filter(DBusConnection *connection,
/* Only auto remove if it is a bus name watch */
if (data->argument[0] == ':' &&
- (!cb->conn_func || !cb->disc_func)) {
+ (cb->conn_func == NULL || cb->disc_func == NULL)) {
filter_data_remove_callback(data, cb);
continue;
}
@@ -517,7 +516,7 @@ static DBusHandlerResult message_filter(DBusConnection *connection,
/* Sender is always bus name */
data = filter_data_find(connection, NULL, sender, path, iface, member,
arg);
- if (!data) {
+ if (data == NULL) {
error("Got %s.%s signal which has no listeners", iface, member);
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
@@ -543,7 +542,7 @@ static DBusHandlerResult message_filter(DBusConnection *connection,
/* Remove filter if there no listener left for the connection */
data = filter_data_find(connection, NULL, NULL, NULL, NULL, NULL,
NULL);
- if (!data)
+ if (data == NULL)
dbus_connection_remove_filter(connection, message_filter,
NULL);
@@ -658,18 +657,18 @@ guint g_dbus_add_service_watch(DBusConnection *connection, const char *name,
struct filter_data *data;
struct filter_callback *cb;
- if (!name)
+ if (name == NULL)
return 0;
data = filter_data_get(connection, service_filter, NULL, NULL,
DBUS_INTERFACE_DBUS, "NameOwnerChanged",
name);
- if (!data)
+ if (data == NULL)
return 0;
cb = filter_data_add_callback(data, connect, disconnect, NULL, NULL,
user_data);
- if (!cb)
+ if (cb == NULL)
return 0;
if (connect)
@@ -697,12 +696,12 @@ guint g_dbus_add_signal_watch(DBusConnection *connection,
data = filter_data_get(connection, signal_filter, sender, path,
interface, member, NULL);
- if (!data)
+ if (data == NULL)
return 0;
cb = filter_data_add_callback(data, NULL, NULL, function, destroy,
user_data);
- if (!cb)
+ if (cb == NULL)
return 0;
if (data->name != NULL && data->name_watch == 0)
--
1.7.3.2
^ permalink raw reply related [flat|nested] 20+ messages in thread* Re: [PATCH 7/9] gdbus: explicitly compare pointers to NULL
2010-11-27 19:39 ` [PATCH 7/9] gdbus: " Lucas De Marchi
@ 2010-11-29 20:50 ` Denis Kenzior
2010-12-08 15:35 ` Marcel Holtmann
1 sibling, 0 replies; 20+ messages in thread
From: Denis Kenzior @ 2010-11-29 20:50 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 552 bytes --]
Hi Lucas,
On 11/27/2010 01:39 PM, Lucas De Marchi wrote:
> 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>
> ---
> gdbus/object.c | 24 ++++++++++++------------
> gdbus/polkit.c | 2 +-
> gdbus/watch.c | 21 ++++++++++-----------
> 3 files changed, 23 insertions(+), 24 deletions(-)
>
I let Marcel apply this one since it touches multiple projects.
Regards,
-Denis
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 7/9] gdbus: explicitly compare pointers to NULL
2010-11-27 19:39 ` [PATCH 7/9] gdbus: " Lucas De Marchi
2010-11-29 20:50 ` Denis Kenzior
@ 2010-12-08 15:35 ` Marcel Holtmann
1 sibling, 0 replies; 20+ messages in thread
From: Marcel Holtmann @ 2010-12-08 15:35 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 481 bytes --]
Hi Lucas,
> 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>
> ---
> gdbus/object.c | 24 ++++++++++++------------
> gdbus/polkit.c | 2 +-
> gdbus/watch.c | 21 ++++++++++-----------
> 3 files changed, 23 insertions(+), 24 deletions(-)
patch has been applied to all projects.
Regards
Marcel
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 8/9] plugins: explicitly compare pointers to NULL
2010-11-27 19:38 [PATCH 1/9] coding-style: add rule about checking NULL pointer Lucas De Marchi
` (5 preceding siblings ...)
2010-11-27 19:39 ` [PATCH 7/9] gdbus: " Lucas De Marchi
@ 2010-11-27 19:39 ` Lucas De Marchi
2010-11-29 20:51 ` Denis Kenzior
2010-11-27 19:39 ` [PATCH 9/9] core: " Lucas De Marchi
2010-11-29 17:49 ` [PATCH 1/9] coding-style: add rule about checking NULL pointer Denis Kenzior
8 siblings, 1 reply; 20+ messages in thread
From: Lucas De Marchi @ 2010-11-27 19:39 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 30347 bytes --]
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>
---
plugins/bluetooth.c | 6 +++---
plugins/calypso.c | 4 ++--
plugins/hfp.c | 20 ++++++++++----------
plugins/hso.c | 12 ++++++------
plugins/huawei.c | 10 +++++-----
plugins/ifx.c | 24 ++++++++++++------------
plugins/isigen.c | 10 +++++-----
plugins/mbm.c | 12 ++++++------
plugins/n900.c | 6 +++---
plugins/nokia-gpio.c | 6 +++---
plugins/nokia.c | 10 +++++-----
plugins/novatel.c | 22 +++++++++++-----------
plugins/palmpre.c | 10 +++++-----
plugins/phonesim.c | 22 +++++++++++-----------
plugins/smart-messaging.c | 4 ++--
plugins/ste.c | 12 ++++++------
plugins/udev.c | 4 ++--
plugins/wavecom.c | 8 ++++----
plugins/zte.c | 12 ++++++------
19 files changed, 107 insertions(+), 107 deletions(-)
diff --git a/plugins/bluetooth.c b/plugins/bluetooth.c
index 8e79b2e..602c6da 100644
--- a/plugins/bluetooth.c
+++ b/plugins/bluetooth.c
@@ -77,7 +77,7 @@ int bluetooth_send_with_reply(const char *path, const char *interface,
msg = dbus_message_new_method_call(BLUEZ_SERVICE, path,
interface, method);
- if (!msg) {
+ if (msg == NULL) {
ofono_error("Unable to allocate new D-Bus %s message", method);
err = -ENOMEM;
goto fail;
@@ -271,7 +271,7 @@ static void device_properties_cb(DBusPendingCall *call, gpointer user_data)
if ((have_uuid & HFP_AG) && device_addr && adapter_addr) {
profile = g_hash_table_lookup(uuid_hash, HFP_AG_UUID);
- if (!profile || !profile->create)
+ if (profile == NULL || profile->create == NULL)
goto done;
profile->create(path, device_addr, adapter_addr, alias);
@@ -493,7 +493,7 @@ static void bluetooth_remove_all_modem(gpointer key, gpointer value,
static void bluetooth_disconnect(DBusConnection *connection, void *user_data)
{
- if (!uuid_hash)
+ if (uuid_hash == NULL)
return;
g_hash_table_foreach(uuid_hash, bluetooth_remove_all_modem, NULL);
diff --git a/plugins/calypso.c b/plugins/calypso.c
index f787c7b..0e29256 100644
--- a/plugins/calypso.c
+++ b/plugins/calypso.c
@@ -170,7 +170,7 @@ static void simind_notify(GAtResult *result, gpointer user_data)
struct calypso_data *data = ofono_modem_get_data(modem);
GAtResultIter iter;
- if (!data->sim)
+ if (data->sim == NULL)
return;
g_at_result_iter_init(&iter, result);
@@ -257,7 +257,7 @@ static void mux_setup(GAtMux *mux, gpointer user_data)
DBG("%p", mux);
- if (!mux) {
+ if (mux == NULL) {
ofono_modem_set_powered(modem, FALSE);
return;
}
diff --git a/plugins/hfp.c b/plugins/hfp.c
index 0a19dac..d8d30b0 100644
--- a/plugins/hfp.c
+++ b/plugins/hfp.c
@@ -76,7 +76,7 @@ static void clear_data(struct ofono_modem *modem)
{
struct hfp_data *data = ofono_modem_get_data(modem);
- if (!data->chat)
+ if (data->chat == NULL)
return;
g_at_chat_unref(data->chat);
@@ -323,7 +323,7 @@ static int service_level_connection(struct ofono_modem *modem, int fd)
char buf[64];
io = g_io_channel_unix_new(fd);
- if (!io) {
+ if (io == NULL) {
ofono_error("Service level connection failed: %s (%d)",
strerror(errno), errno);
return -EIO;
@@ -334,7 +334,7 @@ static int service_level_connection(struct ofono_modem *modem, int fd)
g_at_syntax_unref(syntax);
g_io_channel_unref(io);
- if (!chat)
+ if (chat == NULL)
return -ENOMEM;
g_at_chat_set_disconnect_function(chat, hfp_disconnected_cb, modem);
@@ -415,7 +415,7 @@ static int hfp_create_modem(const char *device, const char *dev_addr,
return -ENOMEM;
data = g_try_new0(struct hfp_data, 1);
- if (!data)
+ if (data == NULL)
goto free;
data->hf_features |= HF_FEATURE_3WAY;
@@ -465,11 +465,11 @@ static void hfp_set_alias(const char *device, const char *alias)
{
struct ofono_modem *modem;
- if (!device || !alias)
+ if (device == NULL || alias == NULL)
return;
modem = g_hash_table_lookup(modem_hash, device);
- if (!modem)
+ if (modem == NULL)
return;
ofono_modem_set_name(modem, alias);
@@ -485,7 +485,7 @@ static int hfp_register_ofono_handsfree(struct ofono_modem *modem)
msg = dbus_message_new_method_call(BLUEZ_SERVICE, data->handsfree_path,
BLUEZ_GATEWAY_INTERFACE, "RegisterAgent");
- if (!msg)
+ if (msg == NULL)
return -ENOMEM;
dbus_message_append_args(msg, DBUS_TYPE_OBJECT_PATH, &obj_path,
@@ -505,7 +505,7 @@ static int hfp_unregister_ofono_handsfree(struct ofono_modem *modem)
msg = dbus_message_new_method_call(BLUEZ_SERVICE, data->handsfree_path,
BLUEZ_GATEWAY_INTERFACE, "UnregisterAgent");
- if (!msg)
+ if (msg == NULL)
return -ENOMEM;
dbus_message_append_args(msg, DBUS_TYPE_OBJECT_PATH, &obj_path,
@@ -520,7 +520,7 @@ static int hfp_probe(struct ofono_modem *modem)
const char *obj_path = ofono_modem_get_path(modem);
struct hfp_data *data = ofono_modem_get_data(modem);
- if (!data)
+ if (data == NULL)
return -EINVAL;
g_dbus_register_interface(connection, obj_path, HFP_AGENT_INTERFACE,
@@ -573,7 +573,7 @@ static void hfp_connect_reply(DBusPendingCall *call, gpointer user_data)
msg = dbus_message_new_method_call(BLUEZ_SERVICE,
data->handsfree_path,
BLUEZ_GATEWAY_INTERFACE, "Disconnect");
- if (!msg)
+ if (msg == NULL)
ofono_error("Disconnect failed");
else
g_dbus_send_message(connection, msg);
diff --git a/plugins/hso.c b/plugins/hso.c
index 055c63b..e01ee87 100644
--- a/plugins/hso.c
+++ b/plugins/hso.c
@@ -63,7 +63,7 @@ static int hso_probe(struct ofono_modem *modem)
DBG("%p", modem);
data = g_try_new0(struct hso_data, 1);
- if (!data)
+ if (data == NULL)
return -ENOMEM;
ofono_modem_set_data(modem, data);
@@ -124,7 +124,7 @@ static GAtChat *create_port(const char *device)
GAtChat *chat;
channel = g_at_tty_open(device, NULL);
- if (!channel)
+ if (channel == NULL)
return NULL;
syntax = g_at_syntax_new_gsm_permissive();
@@ -132,7 +132,7 @@ static GAtChat *create_port(const char *device)
g_at_syntax_unref(syntax);
g_io_channel_unref(channel);
- if (!chat)
+ if (chat == NULL)
return NULL;
return chat;
@@ -149,7 +149,7 @@ static int hso_enable(struct ofono_modem *modem)
control = ofono_modem_get_string(modem, "ControlPort");
app = ofono_modem_get_string(modem, "ApplicationPort");
- if (!app || !control)
+ if (app == NULL || control == NULL)
return -EINVAL;
data->control = create_port(control);
@@ -201,7 +201,7 @@ static int hso_disable(struct ofono_modem *modem)
DBG("%p", modem);
- if (!data->control)
+ if (data->control == NULL)
return 0;
g_at_chat_cancel_all(data->control);
@@ -237,7 +237,7 @@ static void hso_set_online(struct ofono_modem *modem, ofono_bool_t online,
DBG("modem %p %s", modem, online ? "online" : "offline");
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (g_at_chat_send(chat, command, NULL, set_online_cb, cbd, g_free))
diff --git a/plugins/huawei.c b/plugins/huawei.c
index e40a0ac..25dfaca 100644
--- a/plugins/huawei.c
+++ b/plugins/huawei.c
@@ -93,7 +93,7 @@ static int huawei_probe(struct ofono_modem *modem)
DBG("%p", modem);
data = g_try_new0(struct huawei_data, 1);
- if (!data)
+ if (data == NULL)
return -ENOMEM;
ofono_modem_set_data(modem, data);
@@ -392,7 +392,7 @@ static GAtChat *create_port(const char *device)
GAtChat *chat;
channel = g_at_tty_open(device, NULL);
- if (!channel)
+ if (channel == NULL)
return NULL;
syntax = g_at_syntax_new_gsm_permissive();
@@ -400,7 +400,7 @@ static GAtChat *create_port(const char *device)
g_at_syntax_unref(syntax);
g_io_channel_unref(channel);
- if (!chat)
+ if (chat == NULL)
return NULL;
return chat;
@@ -533,7 +533,7 @@ static int huawei_disable(struct ofono_modem *modem)
data->modem = NULL;
}
- if (!data->pcui)
+ if (data->pcui == NULL)
return 0;
g_at_chat_cancel_all(data->pcui);
@@ -565,7 +565,7 @@ static void huawei_set_online(struct ofono_modem *modem, ofono_bool_t online,
DBG("modem %p %s", modem, online ? "online" : "offline");
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (g_at_chat_send(chat, command, NULL, set_online_cb, cbd, g_free))
diff --git a/plugins/ifx.c b/plugins/ifx.c
index 037273a..2f4c65b 100644
--- a/plugins/ifx.c
+++ b/plugins/ifx.c
@@ -115,7 +115,7 @@ static int ifx_probe(struct ofono_modem *modem)
DBG("%p", modem);
data = g_try_new0(struct ifx_data, 1);
- if (!data)
+ if (data == NULL)
return -ENOMEM;
data->mux_ldisc = -1;
@@ -145,7 +145,7 @@ static void xsim_notify(GAtResult *result, gpointer user_data)
GAtResultIter iter;
int state;
- if (!data->sim)
+ if (data->sim == NULL)
return;
g_at_result_iter_init(&iter, result);
@@ -197,7 +197,7 @@ static void shutdown_device(struct ifx_data *data)
}
for (i = 0; i < NUM_DLC; i++) {
- if (!data->dlcs[i])
+ if (data->dlcs[i] == NULL)
continue;
g_at_chat_unref(data->dlcs[i]);
@@ -239,7 +239,7 @@ static GAtChat *create_chat(GIOChannel *channel, struct ofono_modem *modem,
GAtSyntax *syntax;
GAtChat *chat;
- if (!channel)
+ if (channel == NULL)
return NULL;
syntax = g_at_syntax_new_gsmv1();
@@ -247,7 +247,7 @@ static GAtChat *create_chat(GIOChannel *channel, struct ofono_modem *modem,
g_at_syntax_unref(syntax);
g_io_channel_unref(channel);
- if (!chat)
+ if (chat == NULL)
return NULL;
if (getenv("OFONO_AT_DEBUG"))
@@ -408,7 +408,7 @@ static gboolean dlc_ready_check(gpointer user_data)
GIOChannel *channel = g_at_tty_open(dlc_nodes[i], NULL);
data->dlcs[i] = create_chat(channel, modem, dlc_prefixes[i]);
- if (!data->dlcs[i]) {
+ if (data->dlcs[i] == NULL) {
ofono_error("Failed to open %s", dlc_nodes[i]);
goto error;
}
@@ -445,7 +445,7 @@ static void setup_internal_mux(struct ofono_modem *modem)
g_io_channel_set_buffered(data->device, FALSE);
data->mux = g_at_mux_new_gsm0710_basic(data->device, data->frame_size);
- if (!data->mux)
+ if (data->mux == NULL)
goto error;
if (getenv("OFONO_MUX_DEBUG"))
@@ -457,7 +457,7 @@ static void setup_internal_mux(struct ofono_modem *modem)
GIOChannel *channel = g_at_mux_create_channel(data->mux);
data->dlcs[i] = create_chat(channel, modem, dlc_prefixes[i]);
- if (!data->dlcs[i]) {
+ if (data->dlcs[i] == NULL) {
ofono_error("Failed to create channel");
goto error;
}
@@ -580,14 +580,14 @@ static int ifx_enable(struct ofono_modem *modem)
}
data->device = g_at_tty_open(device, NULL);
- if (!data->device)
+ if (data->device == NULL)
return -EIO;
syntax = g_at_syntax_new_gsmv1();
chat = g_at_chat_new(data->device, syntax);
g_at_syntax_unref(syntax);
- if (!chat) {
+ if (chat == NULL) {
g_io_channel_unref(data->device);
return -EIO;
}
@@ -667,7 +667,7 @@ static void ifx_set_online(struct ofono_modem *modem, ofono_bool_t online,
DBG("%p %s", modem, online ? "online" : "offline");
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (g_at_chat_send(data->dlcs[AUX_DLC], command, NULL,
@@ -736,7 +736,7 @@ static void ifx_post_online(struct ofono_modem *modem)
gprs = ofono_gprs_create(modem, OFONO_VENDOR_IFX,
"atmodem", data->dlcs[NETREG_DLC]);
- if (!gprs)
+ if (gprs == NULL)
return;
if (data->mux_ldisc < 0) {
diff --git a/plugins/isigen.c b/plugins/isigen.c
index 3384e9f..028f1b2 100644
--- a/plugins/isigen.c
+++ b/plugins/isigen.c
@@ -282,7 +282,7 @@ static int isigen_probe(struct ofono_modem *modem)
}
link = g_pn_netlink_start(idx, phonet_status_cb, modem);
- if (!link) {
+ if (link == NULL) {
DBG("%s: %s", ifname, strerror(errno));
return -errno;
}
@@ -315,7 +315,7 @@ static void isigen_remove(struct ofono_modem *modem)
{
struct isi_data *isi = ofono_modem_get_data(modem);
- if (!isi)
+ if (isi == NULL)
return;
ofono_modem_set_data(modem, NULL);
@@ -370,7 +370,7 @@ static void isigen_online(struct ofono_modem *modem, ofono_bool_t online,
DBG("(%p) with %s", modem, isi->ifname);
- if (!cbd)
+ if (cbd == NULL)
goto error;
isi->online = online;
@@ -425,13 +425,13 @@ static void isigen_post_online(struct ofono_modem *modem)
ofono_radio_settings_create(isi->modem, 0, "isimodem", isi->idx);
gprs = ofono_gprs_create(isi->modem, 0, "isimodem", isi->idx);
- if (!gprs)
+ if (gprs == NULL)
return;
for (i = 0; i < ISI_DEFAULT_PDPS; i++) {
gc = ofono_gprs_context_create(isi->modem, 0,
"isimodem", isi->idx);
- if (!gc) {
+ if (gc == NULL) {
DBG("Failed to add context %d", i);
break;
}
diff --git a/plugins/mbm.c b/plugins/mbm.c
index 35b85ea..62e3ae1 100644
--- a/plugins/mbm.c
+++ b/plugins/mbm.c
@@ -77,7 +77,7 @@ static int mbm_probe(struct ofono_modem *modem)
DBG("%p", modem);
data = g_try_new0(struct mbm_data, 1);
- if (!data)
+ if (data == NULL)
return -ENOMEM;
ofono_modem_set_data(modem, data);
@@ -283,7 +283,7 @@ static GAtChat *create_port(const char *device)
GAtChat *chat;
channel = g_at_tty_open(device, NULL);
- if (!channel)
+ if (channel == NULL)
return NULL;
syntax = g_at_syntax_new_gsm_permissive();
@@ -291,7 +291,7 @@ static GAtChat *create_port(const char *device)
g_at_syntax_unref(syntax);
g_io_channel_unref(channel);
- if (!chat)
+ if (chat == NULL)
return NULL;
return chat;
@@ -430,7 +430,7 @@ static int mbm_disable(struct ofono_modem *modem)
data->reopen_source = 0;
}
- if (!data->modem_port)
+ if (data->modem_port == NULL)
return 0;
g_at_chat_cancel_all(data->modem_port);
@@ -462,7 +462,7 @@ static void mbm_set_online(struct ofono_modem *modem, ofono_bool_t online,
DBG("modem %p %s", modem, online ? "online" : "offline");
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (g_at_chat_send(chat, command, NULL, set_online_cb, cbd, g_free))
@@ -523,7 +523,7 @@ static void mbm_post_online(struct ofono_modem *modem)
data->gprs = ofono_gprs_create(modem, OFONO_VENDOR_MBM,
"atmodem", data->modem_port);
- if (!data->gprs)
+ if (data->gprs == NULL)
return;
gc = ofono_gprs_context_create(modem, 0,
diff --git a/plugins/n900.c b/plugins/n900.c
index a9e6b59..7619821 100644
--- a/plugins/n900.c
+++ b/plugins/n900.c
@@ -398,7 +398,7 @@ static int n900_probe(struct ofono_modem *modem)
DBG("(%p) with %s", modem, ifname);
idx = g_isi_modem_by_name(ifname);
- if (!idx) {
+ if (idx == NULL) {
DBG("Interface=%s: %s", ifname, strerror(errno));
return -errno;
}
@@ -409,7 +409,7 @@ static int n900_probe(struct ofono_modem *modem)
}
isi = g_new0(struct isi_data, 1);
- if (!isi) {
+ if (isi == NULL) {
gpio_remove(modem);
return -ENOMEM;
}
@@ -451,7 +451,7 @@ static void n900_set_online(struct ofono_modem *modem,
DBG("(%p) with %s", modem, isi->ifname);
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (isi->power_state != POWER_STATE_ON)
diff --git a/plugins/nokia-gpio.c b/plugins/nokia-gpio.c
index f3b9460..db0aa39 100644
--- a/plugins/nokia-gpio.c
+++ b/plugins/nokia-gpio.c
@@ -155,7 +155,7 @@ static int file_write(char const *filename, char const *output)
FILE *f;
f = fopen(filename, "r+");
- if (!f) {
+ if (f == NULL) {
DBG("%s: %s (%d)", filename, strerror(errno), errno);
return -1;
}
@@ -709,7 +709,7 @@ int gpio_probe(GIsiModem *idx, unsigned addr, gpio_finished_cb_t cb, void *data)
{
int error;
- if (!cb) {
+ if (cb == NULL) {
DBG("gpio: No callback given");
return -(errno = EFAULT);
}
@@ -754,7 +754,7 @@ int gpio_probe(GIsiModem *idx, unsigned addr, gpio_finished_cb_t cb, void *data)
self.rapu = RAPU_TYPE_2;
self.link = g_pn_netlink_start(idx, phonet_status_cb, NULL);
- if (!self.link) {
+ if (self.link == NULL) {
memset(&self, 0, sizeof self);
return -errno;
}
diff --git a/plugins/nokia.c b/plugins/nokia.c
index bb8e2f3..6f85794 100644
--- a/plugins/nokia.c
+++ b/plugins/nokia.c
@@ -62,7 +62,7 @@ static int nokia_probe(struct ofono_modem *modem)
DBG("%p", modem);
data = g_try_new0(struct nokia_data, 1);
- if (!data)
+ if (data == NULL)
return -ENOMEM;
ofono_modem_set_data(modem, data);
@@ -106,7 +106,7 @@ static GAtChat *open_device(struct ofono_modem *modem,
DBG("%s %s", key, device);
channel = g_at_tty_open(device, NULL);
- if (!channel)
+ if (channel == NULL)
return NULL;
syntax = g_at_syntax_new_gsm_permissive();
@@ -114,7 +114,7 @@ static GAtChat *open_device(struct ofono_modem *modem,
g_at_syntax_unref(syntax);
g_io_channel_unref(channel);
- if (!chat)
+ if (chat == NULL)
return NULL;
if (getenv("OFONO_AT_DEBUG"))
@@ -137,7 +137,7 @@ static void nokia_disconnect(gpointer user_data)
data->modem = NULL;
data->modem = open_device(modem, "Modem", "Modem: ");
- if (!data->modem)
+ if (data->modem == NULL)
return;
g_at_chat_set_disconnect_function(data->modem,
@@ -216,7 +216,7 @@ static int nokia_disable(struct ofono_modem *modem)
data->modem = NULL;
}
- if (!data->control)
+ if (data->control == NULL)
return 0;
g_at_chat_cancel_all(data->control);
diff --git a/plugins/novatel.c b/plugins/novatel.c
index 4a3802e..578cec1 100644
--- a/plugins/novatel.c
+++ b/plugins/novatel.c
@@ -66,7 +66,7 @@ static int novatel_probe(struct ofono_modem *modem)
DBG("%p", modem);
data = g_try_new0(struct novatel_data, 1);
- if (!data)
+ if (data == NULL)
return -ENOMEM;
ofono_modem_set_data(modem, data);
@@ -102,11 +102,11 @@ static GAtChat *open_device(struct ofono_modem *modem,
const char *device;
device = ofono_modem_get_string(modem, key);
- if (!device)
+ if (device == NULL)
return NULL;
channel = g_at_tty_open(device, NULL);
- if (!channel)
+ if (channel == NULL)
return NULL;
syntax = g_at_syntax_new_gsm_permissive();
@@ -114,7 +114,7 @@ static GAtChat *open_device(struct ofono_modem *modem,
g_at_syntax_unref(syntax);
g_io_channel_unref(channel);
- if (!chat)
+ if (chat == NULL)
return NULL;
if (getenv("OFONO_AT_DEBUG"))
@@ -146,7 +146,7 @@ static void nwdmat_action(gboolean ok, GAtResult *result, gpointer user_data)
data->dmat_mode = 1;
data->secondary = open_device(modem, "SecondaryDevice", "Control: ");
- if (!data->secondary)
+ if (data->secondary == NULL)
goto done;
g_at_chat_send(data->secondary, "ATE0 +CMEE=1", none_prefix,
@@ -208,7 +208,7 @@ static void novatel_disconnect(gpointer user_data)
data->primary = NULL;
data->primary = open_device(modem, "PrimaryDevice", "Modem: ");
- if (!data->primary)
+ if (data->primary == NULL)
return;
g_at_chat_set_disconnect_function(data->primary,
@@ -230,7 +230,7 @@ static int novatel_enable(struct ofono_modem *modem)
DBG("%p", modem);
data->primary = open_device(modem, "PrimaryDevice", "Modem: ");
- if (!data->primary)
+ if (data->primary == NULL)
return -EIO;
g_at_chat_set_disconnect_function(data->primary,
@@ -266,7 +266,7 @@ static int novatel_disable(struct ofono_modem *modem)
DBG("%p", modem);
- if (!data->primary)
+ if (data->primary == NULL)
return 0;
if (data->secondary) {
@@ -310,7 +310,7 @@ static void novatel_set_online(struct ofono_modem *modem, ofono_bool_t online,
DBG("modem %p %s", modem, online ? "online" : "offline");
- if (!cbd || !chat)
+ if (cbd == NULL || chat == NULL)
goto error;
if (g_at_chat_send(chat, command, NULL, set_online_cb, cbd, g_free))
@@ -329,7 +329,7 @@ static void novatel_pre_sim(struct ofono_modem *modem)
DBG("%p", modem);
- if (!data->secondary) {
+ if (data->secondary == NULL) {
ofono_devinfo_create(modem, 0, "atmodem", data->primary);
sim = ofono_sim_create(modem, OFONO_VENDOR_QUALCOMM_MSM,
"atmodem", data->primary);
@@ -349,7 +349,7 @@ static void novatel_post_online(struct ofono_modem *modem)
DBG("%p", modem);
- if (!data->secondary) {
+ if (data->secondary == NULL) {
ofono_netreg_create(modem, OFONO_VENDOR_NOVATEL, "atmodem",
data->primary);
diff --git a/plugins/palmpre.c b/plugins/palmpre.c
index 1714863..9555871 100644
--- a/plugins/palmpre.c
+++ b/plugins/palmpre.c
@@ -57,7 +57,7 @@ static int palmpre_probe(struct ofono_modem *modem)
DBG("%p", modem);
data = g_try_new0(struct palmpre_data, 1);
- if (!data)
+ if (data == NULL)
return -ENOMEM;
ofono_modem_set_data(modem, data);
@@ -104,11 +104,11 @@ static int palmpre_enable(struct ofono_modem *modem)
DBG("%p", modem);
device = ofono_modem_get_string(modem, "Device");
- if (!device)
+ if (device == NULL)
device = "/dev/modem0";
options = g_hash_table_new(g_str_hash, g_str_equal);
- if (!options)
+ if (options == NULL)
return -ENOMEM;
g_hash_table_insert(options, "Baud", "115200");
@@ -116,7 +116,7 @@ static int palmpre_enable(struct ofono_modem *modem)
io = g_at_tty_open(device, options);
g_hash_table_destroy(options);
- if (!io)
+ if (io == NULL)
return -EIO;
syntax = g_at_syntax_new_gsm_permissive();
@@ -124,7 +124,7 @@ static int palmpre_enable(struct ofono_modem *modem)
g_io_channel_unref(io);
g_at_syntax_unref(syntax);
- if (!data->chat)
+ if (data->chat == NULL)
return -ENOMEM;
if (getenv("OFONO_AT_DEBUG"))
diff --git a/plugins/phonesim.c b/plugins/phonesim.c
index d2faf42..0552b50 100644
--- a/plugins/phonesim.c
+++ b/plugins/phonesim.c
@@ -141,7 +141,7 @@ static void phonesim_deactivate_primary(struct ofono_gprs_context *gc,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[128];
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = gc;
@@ -165,7 +165,7 @@ static int phonesim_context_probe(struct ofono_gprs_context *gc,
struct gprs_context_data *gcd;
gcd = g_try_new0(struct gprs_context_data, 1);
- if (!gcd)
+ if (gcd == NULL)
return -ENOMEM;
gcd->chat = g_at_chat_clone(chat);
@@ -205,7 +205,7 @@ static int phonesim_probe(struct ofono_modem *modem)
DBG("%p", modem);
data = g_try_new0(struct phonesim_data, 1);
- if (!data)
+ if (data == NULL)
return -ENOMEM;
ofono_modem_set_data(modem, data);
@@ -265,7 +265,7 @@ static void mux_setup(GAtMux *mux, gpointer user_data)
DBG("%p", mux);
- if (!mux) {
+ if (mux == NULL) {
ofono_modem_set_powered(modem, FALSE);
return;
}
@@ -311,7 +311,7 @@ static int phonesim_enable(struct ofono_modem *modem)
DBG("%p", modem);
address = ofono_modem_get_string(modem, "Address");
- if (!address)
+ if (address == NULL)
return -EINVAL;
port = ofono_modem_get_integer(modem, "Port");
@@ -342,7 +342,7 @@ static int phonesim_enable(struct ofono_modem *modem)
}
io = g_io_channel_unix_new(sk);
- if (!io) {
+ if (io == NULL) {
close(sk);
return -ENOMEM;
}
@@ -357,7 +357,7 @@ static int phonesim_enable(struct ofono_modem *modem)
g_at_syntax_unref(syntax);
g_io_channel_unref(io);
- if (!data->chat)
+ if (data->chat == NULL)
return -ENOMEM;
if (getenv("OFONO_AT_DEBUG"))
@@ -538,18 +538,18 @@ static struct ofono_modem *create_modem(GKeyFile *keyfile, const char *group)
DBG("group %s", group);
modem = ofono_modem_create(group, "phonesim");
- if (!modem)
+ if (modem == NULL)
return NULL;
value = g_key_file_get_string(keyfile, group, "Address", NULL);
- if (!value)
+ if (value == NULL)
goto error;
ofono_modem_set_string(modem, "Address", value);
g_free(value);
value = g_key_file_get_string(keyfile, group, "Port", NULL);
- if (!value)
+ if (value == NULL)
goto error;
ofono_modem_set_integer(modem, "Port", atoi(value));
@@ -606,7 +606,7 @@ static void parse_config(const char *filename)
struct ofono_modem *modem;
modem = create_modem(keyfile, modems[i]);
- if (!modem)
+ if (modem == NULL)
continue;
modem_list = g_slist_prepend(modem_list, modem);
diff --git a/plugins/smart-messaging.c b/plugins/smart-messaging.c
index e943796..e7889f2 100644
--- a/plugins/smart-messaging.c
+++ b/plugins/smart-messaging.c
@@ -207,7 +207,7 @@ static DBusMessage *smart_messaging_send_vcard(DBusConnection *conn,
msg_list = sms_datagram_prepare(to, bytes, len, ref, use_16bit_ref,
0, VCARD_DST_PORT, TRUE, FALSE);
- if (!msg_list)
+ if (msg_list == NULL)
return __ofono_error_invalid_format(msg);
flags = OFONO_SMS_SUBMIT_FLAG_RETRY | OFONO_SMS_SUBMIT_FLAG_EXPOSE_DBUS;
@@ -250,7 +250,7 @@ static DBusMessage *smart_messaging_send_vcal(DBusConnection *conn,
msg_list = sms_datagram_prepare(to, bytes, len, ref, use_16bit_ref,
0, VCAL_DST_PORT, TRUE, FALSE);
- if (!msg_list)
+ if (msg_list == NULL)
return __ofono_error_invalid_format(msg);
flags = OFONO_SMS_SUBMIT_FLAG_RETRY | OFONO_SMS_SUBMIT_FLAG_EXPOSE_DBUS;
diff --git a/plugins/ste.c b/plugins/ste.c
index 508ad58..ecdc326 100644
--- a/plugins/ste.c
+++ b/plugins/ste.c
@@ -80,7 +80,7 @@ static int ste_probe(struct ofono_modem *modem)
DBG("%p", modem);
data = g_try_new0(struct ste_data, 1);
- if (!data)
+ if (data == NULL)
return -ENOMEM;
ofono_modem_set_data(modem, data);
@@ -173,7 +173,7 @@ static int ste_enable(struct ofono_modem *modem)
DBG("%p", modem);
device = ofono_modem_get_string(modem, "Device");
- if (!device) {
+ if (device == NULL) {
struct sockaddr_caif addr;
int err;
const char *interface;
@@ -221,7 +221,7 @@ static int ste_enable(struct ofono_modem *modem)
}
channel = g_io_channel_unix_new(fd);
- if (!channel) {
+ if (channel == NULL) {
close(fd);
return -EIO;
}
@@ -233,7 +233,7 @@ static int ste_enable(struct ofono_modem *modem)
g_at_syntax_unref(syntax);
g_io_channel_unref(channel);
- if (!data->chat)
+ if (data->chat == NULL)
return -ENOMEM;
if (getenv("OFONO_AT_DEBUG"))
@@ -266,7 +266,7 @@ static int ste_disable(struct ofono_modem *modem)
DBG("%p", modem);
- if (!data->chat)
+ if (data->chat == NULL)
return 0;
g_at_chat_cancel_all(data->chat);
@@ -298,7 +298,7 @@ static void ste_set_online(struct ofono_modem *modem, ofono_bool_t online,
DBG("modem %p %s", modem, online ? "online" : "offline");
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (g_at_chat_send(chat, command, NULL, set_online_cb, cbd, g_free))
diff --git a/plugins/udev.c b/plugins/udev.c
index 737a637..255755e 100644
--- a/plugins/udev.c
+++ b/plugins/udev.c
@@ -555,7 +555,7 @@ static void remove_modem(struct udev_device *udev_device)
DBG("%s", curpath);
devpath = g_hash_table_lookup(devpath_list, curpath);
- if (!devpath)
+ if (devpath == NULL)
return;
modem = find_modem(devpath);
@@ -681,7 +681,7 @@ static int udev_init(void)
{
devpath_list = g_hash_table_new_full(g_str_hash, g_str_equal,
g_free, g_free);
- if (!devpath_list) {
+ if (devpath_list == NULL) {
ofono_error("Failed to create udev path list");
return -ENOMEM;
}
diff --git a/plugins/wavecom.c b/plugins/wavecom.c
index 73fa502..cb55f85 100644
--- a/plugins/wavecom.c
+++ b/plugins/wavecom.c
@@ -78,12 +78,12 @@ static int wavecom_enable(struct ofono_modem *modem)
DBG("%p", modem);
device = ofono_modem_get_string(modem, "Device");
- if (!device)
+ if (device == NULL)
return -EINVAL;
options = g_hash_table_new(g_str_hash, g_str_equal);
- if (!options)
+ if (options == NULL)
return -ENOMEM;
g_hash_table_insert(options, "Baud", "115200");
@@ -95,7 +95,7 @@ static int wavecom_enable(struct ofono_modem *modem)
g_hash_table_destroy(options);
- if (!channel)
+ if (channel == NULL)
return -EIO;
/*
@@ -108,7 +108,7 @@ static int wavecom_enable(struct ofono_modem *modem)
g_at_syntax_unref(syntax);
g_io_channel_unref(channel);
- if (!chat)
+ if (chat == NULL)
return -ENOMEM;
if (getenv("OFONO_AT_DEBUG"))
diff --git a/plugins/zte.c b/plugins/zte.c
index 83602eb..82f322a 100644
--- a/plugins/zte.c
+++ b/plugins/zte.c
@@ -64,7 +64,7 @@ static int zte_probe(struct ofono_modem *modem)
DBG("%p", modem);
data = g_try_new0(struct zte_data, 1);
- if (!data)
+ if (data == NULL)
return -ENOMEM;
ofono_modem_set_data(modem, data);
@@ -108,7 +108,7 @@ static GAtChat *open_device(struct ofono_modem *modem,
DBG("%s %s", key, device);
channel = g_at_tty_open(device, NULL);
- if (!channel)
+ if (channel == NULL)
return NULL;
syntax = g_at_syntax_new_gsm_permissive();
@@ -116,7 +116,7 @@ static GAtChat *open_device(struct ofono_modem *modem,
g_at_syntax_unref(syntax);
g_io_channel_unref(channel);
- if (!chat)
+ if (chat == NULL)
return NULL;
if (getenv("OFONO_AT_DEBUG"))
@@ -138,7 +138,7 @@ static void zte_disconnect(gpointer user_data)
data->modem = NULL;
data->modem = open_device(modem, "Modem", "Modem: ");
- if (!data->modem)
+ if (data->modem == NULL)
return;
g_at_chat_set_disconnect_function(data->modem,
@@ -218,7 +218,7 @@ static int zte_disable(struct ofono_modem *modem)
data->modem = NULL;
}
- if (!data->aux)
+ if (data->aux == NULL)
return 0;
g_at_chat_cancel_all(data->aux);
@@ -250,7 +250,7 @@ static void zte_set_online(struct ofono_modem *modem, ofono_bool_t online,
DBG("modem %p %s", modem, online ? "online" : "offline");
- if (!cbd || !chat)
+ if (cbd == NULL || chat == NULL)
goto error;
if (g_at_chat_send(chat, command, NULL, set_online_cb, cbd, g_free))
--
1.7.3.2
^ permalink raw reply related [flat|nested] 20+ messages in thread* Re: [PATCH 8/9] plugins: explicitly compare pointers to NULL
2010-11-27 19:39 ` [PATCH 8/9] plugins: " Lucas De Marchi
@ 2010-11-29 20:51 ` Denis Kenzior
0 siblings, 0 replies; 20+ messages in thread
From: Denis Kenzior @ 2010-11-29 20:51 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1327 bytes --]
Hi Lucas,
On 11/27/2010 01:39 PM, Lucas De Marchi wrote:
> 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>
> ---
> plugins/bluetooth.c | 6 +++---
> plugins/calypso.c | 4 ++--
> plugins/hfp.c | 20 ++++++++++----------
> plugins/hso.c | 12 ++++++------
> plugins/huawei.c | 10 +++++-----
> plugins/ifx.c | 24 ++++++++++++------------
> plugins/isigen.c | 10 +++++-----
> plugins/mbm.c | 12 ++++++------
> plugins/n900.c | 6 +++---
> plugins/nokia-gpio.c | 6 +++---
> plugins/nokia.c | 10 +++++-----
> plugins/novatel.c | 22 +++++++++++-----------
> plugins/palmpre.c | 10 +++++-----
> plugins/phonesim.c | 22 +++++++++++-----------
> plugins/smart-messaging.c | 4 ++--
> plugins/ste.c | 12 ++++++------
> plugins/udev.c | 4 ++--
> plugins/wavecom.c | 8 ++++----
> plugins/zte.c | 12 ++++++------
> 19 files changed, 107 insertions(+), 107 deletions(-)
Patch has been applied, thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 9/9] core: explicitly compare pointers to NULL
2010-11-27 19:38 [PATCH 1/9] coding-style: add rule about checking NULL pointer Lucas De Marchi
` (6 preceding siblings ...)
2010-11-27 19:39 ` [PATCH 8/9] plugins: " Lucas De Marchi
@ 2010-11-27 19:39 ` Lucas De Marchi
2010-11-29 20:52 ` Denis Kenzior
2010-11-29 17:49 ` [PATCH 1/9] coding-style: add rule about checking NULL pointer Denis Kenzior
8 siblings, 1 reply; 20+ messages in thread
From: Lucas De Marchi @ 2010-11-27 19:39 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 83407 bytes --]
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>
---
src/audio-settings.c | 12 ++++----
src/call-barring.c | 18 ++++++------
src/call-forwarding.c | 20 +++++++-------
src/call-meter.c | 26 +++++++++---------
src/call-settings.c | 26 +++++++++---------
src/call-volume.c | 6 ++--
src/cbs.c | 16 +++++-----
src/common.c | 2 +-
src/dbus.c | 8 +++---
src/gprs.c | 28 ++++++++++----------
src/history.c | 2 +-
src/main.c | 2 +-
src/message-waiting.c | 4 +-
src/modem.c | 14 +++++-----
src/nettime.c | 2 +-
src/network.c | 28 ++++++++++----------
src/phonebook.c | 10 +++---
src/plugin.c | 2 +-
src/radio-settings.c | 20 +++++++-------
src/sim.c | 16 +++++-----
src/simfs.c | 28 ++++++++++----------
src/simutil.c | 16 +++++-----
src/sms.c | 40 ++++++++++++++--------------
src/smsagent.c | 12 ++++----
src/smsutil.c | 34 ++++++++++++------------
src/stk.c | 62 +++++++++++++++++++++---------------------
src/stkagent.c | 2 +-
src/stkutil.c | 4 +-
src/ussd.c | 46 ++++++++++++++++----------------
src/util.c | 14 +++++-----
src/voicecall.c | 70 ++++++++++++++++++++++++------------------------
31 files changed, 295 insertions(+), 295 deletions(-)
diff --git a/src/audio-settings.c b/src/audio-settings.c
index ed3e7d1..5d59020 100644
--- a/src/audio-settings.c
+++ b/src/audio-settings.c
@@ -73,7 +73,7 @@ void ofono_audio_settings_mode_notify(struct ofono_audio_settings *as,
g_free(as->mode);
as->mode = g_strdup(mode);
- if (!as->mode)
+ if (as->mode == NULL)
return;
ofono_dbus_signal_property_changed(conn, path,
@@ -89,7 +89,7 @@ static DBusMessage *audio_get_properties_reply(DBusMessage *msg,
DBusMessageIter dict;
reply = dbus_message_new_method_return(msg);
- if (!reply)
+ if (reply == NULL)
return NULL;
dbus_message_iter_init_append(reply, &iter);
@@ -132,7 +132,7 @@ int ofono_audio_settings_driver_register(const struct ofono_audio_settings_drive
{
DBG("driver: %p, name: %s", d, d->name);
- if (!d->probe)
+ if (d->probe == NULL)
return -EINVAL;
g_drivers = g_slist_prepend(g_drivers, (void *) d);
@@ -164,7 +164,7 @@ static void audio_settings_remove(struct ofono_atom *atom)
DBG("atom: %p", atom);
- if (!as)
+ if (as == NULL)
return;
if (as->driver && as->driver->remove)
@@ -182,11 +182,11 @@ struct ofono_audio_settings *ofono_audio_settings_create(struct ofono_modem *mod
struct ofono_audio_settings *as;
GSList *l;
- if (!driver)
+ if (driver == NULL)
return NULL;
as = g_try_new0(struct ofono_audio_settings, 1);
- if (!as)
+ if (as == NULL)
return NULL;
as->atom = __ofono_modem_add_atom(modem, OFONO_ATOM_TYPE_AUDIO_SETTINGS,
diff --git a/src/call-barring.c b/src/call-barring.c
index db32c0c..bb15530 100644
--- a/src/call-barring.c
+++ b/src/call-barring.c
@@ -385,7 +385,7 @@ static gboolean cb_ss_control(int type, const char *sc,
type, sc, sia, sib, sic, dn);
fac = cb_ss_service_to_fac(sc);
- if (!fac)
+ if (fac == NULL)
return FALSE;
cb_set_query_bounds(cb, fac, type == SS_CONTROL_TYPE_QUERY);
@@ -419,7 +419,7 @@ static gboolean cb_ss_control(int type, const char *sc,
break;
}
- if (!operation) {
+ if (operation == NULL) {
reply = __ofono_error_not_implemented(msg);
g_dbus_send_message(conn, reply);
@@ -521,7 +521,7 @@ static gboolean cb_ss_passwd(const char *sc,
else
fac = cb_ss_service_to_fac(sc);
- if (!fac)
+ if (fac == NULL)
return FALSE;
if (!is_valid_pin(old, PIN_TYPE_NET) || !is_valid_pin(new, PIN_TYPE_NET))
@@ -618,7 +618,7 @@ static void cb_get_properties_reply(struct ofono_call_barring *cb, int mask)
ofono_error("Generating a get_properties reply with no cache");
reply = dbus_message_new_method_return(cb->pending);
- if (!reply)
+ if (reply == NULL)
return;
dbus_message_iter_init_append(reply, &iter);
@@ -678,7 +678,7 @@ static DBusMessage *cb_get_properties(DBusConnection *conn, DBusMessage *msg,
if (__ofono_call_barring_is_busy(cb) || __ofono_ussd_is_busy(cb->ussd))
return __ofono_error_busy(msg);
- if (!cb->driver->query)
+ if (cb->driver->query == NULL)
return __ofono_error_not_implemented(msg);
cb->pending = dbus_message_ref(msg);
@@ -866,7 +866,7 @@ static DBusMessage *cb_set_property(DBusConnection *conn, DBusMessage *msg,
return __ofono_error_invalid_format(msg);
}
- if (!cb->driver->set)
+ if (cb->driver->set == NULL)
return __ofono_error_not_implemented(msg);
cb_set_query_bounds(cb, cb_locks[lock].fac, FALSE);
@@ -899,7 +899,7 @@ static DBusMessage *cb_disable_all(DBusConnection *conn, DBusMessage *msg,
struct ofono_call_barring *cb = data;
const char *passwd;
- if (!cb->driver->set)
+ if (cb->driver->set == NULL)
return __ofono_error_not_implemented(msg);
if (__ofono_call_barring_is_busy(cb) || __ofono_ussd_is_busy(cb->ussd))
@@ -946,7 +946,7 @@ static DBusMessage *cb_set_passwd(DBusConnection *conn, DBusMessage *msg,
const char *old_passwd;
const char *new_passwd;
- if (!cb->driver->set_passwd)
+ if (cb->driver->set_passwd == NULL)
return __ofono_error_not_implemented(msg);
if (__ofono_call_barring_is_busy(cb) || __ofono_ussd_is_busy(cb->ussd))
@@ -1013,7 +1013,7 @@ static void call_barring_outgoing_enabled_notify(int idx, void *userdata)
signal = dbus_message_new_signal(path, OFONO_CALL_BARRING_INTERFACE,
"OutgoingBarringInEffect");
- if (!signal) {
+ if (signal == NULL) {
ofono_error("Unable to allocate new %s.OutgoingBarringInEffect"
" signal", OFONO_CALL_BARRING_INTERFACE);
return;
diff --git a/src/call-forwarding.c b/src/call-forwarding.c
index ce03c40..76aef73 100644
--- a/src/call-forwarding.c
+++ b/src/call-forwarding.c
@@ -113,7 +113,7 @@ static int cf_find_timeout(GSList *cf_list, int cls)
l = g_slist_find_custom(cf_list, GINT_TO_POINTER(cls),
cf_condition_find_with_cls);
- if (!l)
+ if (l == NULL)
return DEFAULT_NO_REPLY_TIMEOUT;
c = l->data;
@@ -158,7 +158,7 @@ static GSList *cf_cond_list_create(int total,
continue;
cond = g_try_new0(struct ofono_call_forwarding_condition, 1);
- if (!cond)
+ if (cond == NULL)
continue;
memcpy(cond, &list[i],
@@ -352,7 +352,7 @@ static void property_append_cf_conditions(DBusMessageIter *dict,
while (l && (cf = l->data) && (cf->cls < i))
l = l->next;
- if (!l || cf->cls != i) {
+ if (l == NULL || cf->cls != i) {
property_append_cf_condition(dict, i, postfix, "",
DEFAULT_NO_REPLY_TIMEOUT);
continue;
@@ -375,7 +375,7 @@ static DBusMessage *cf_get_properties_reply(DBusMessage *msg,
reply = dbus_message_new_method_return(msg);
- if (!reply)
+ if (reply == NULL)
return NULL;
dbus_message_iter_init_append(reply, &iter);
@@ -436,7 +436,7 @@ static DBusMessage *cf_get_properties(DBusConnection *conn, DBusMessage *msg,
if (cf->flags & CALL_FORWARDING_FLAG_CACHED)
return cf_get_properties_reply(msg, cf);
- if (!cf->driver->query)
+ if (cf->driver->query == NULL)
return __ofono_error_not_implemented(msg);
if (__ofono_call_forwarding_is_busy(cf) ||
@@ -634,7 +634,7 @@ static DBusMessage *cf_set_property(DBusConnection *conn, DBusMessage *msg,
GINT_TO_POINTER(cls),
cf_condition_find_with_cls);
- if (!l)
+ if (l == NULL)
return __ofono_error_failed(msg);
c = l->data;
@@ -713,7 +713,7 @@ static DBusMessage *cf_disable_all(DBusConnection *conn, DBusMessage *msg,
const char *strtype;
int type;
- if (!cf->driver->erasure)
+ if (cf->driver->erasure == NULL)
return __ofono_error_not_implemented(msg);
if (__ofono_call_forwarding_is_busy(cf) ||
@@ -905,7 +905,7 @@ static gboolean cf_ss_control(int type, const char *sc,
void *operation = NULL;
/* Before we do anything, make sure we're actually initialized */
- if (!cf)
+ if (cf == NULL)
return FALSE;
if (__ofono_call_forwarding_is_busy(cf)) {
@@ -1007,7 +1007,7 @@ static gboolean cf_ss_control(int type, const char *sc,
break;
}
- if (!operation) {
+ if (operation == NULL) {
reply = __ofono_error_not_implemented(msg);
g_dbus_send_message(conn, reply);
@@ -1016,7 +1016,7 @@ static gboolean cf_ss_control(int type, const char *sc,
cf->ss_req = g_try_new0(struct cf_ss_request, 1);
- if (!cf->ss_req) {
+ if (cf->ss_req == NULL) {
reply = __ofono_error_failed(msg);
g_dbus_send_message(conn, reply);
diff --git a/src/call-meter.c b/src/call-meter.c
index 568fe40..ac3ae6b 100644
--- a/src/call-meter.c
+++ b/src/call-meter.c
@@ -163,7 +163,7 @@ static void cm_get_properties_reply(struct ofono_call_meter *cm)
const char *currency = cm->currency;
reply = dbus_message_new_method_return(cm->pending);
- if (!reply)
+ if (reply == NULL)
return;
dbus_message_iter_init_append(reply, &iter);
@@ -204,7 +204,7 @@ static void query_call_meter_callback(const struct ofono_error *error, int value
static void query_call_meter(struct ofono_call_meter *cm)
{
- if (!cm->driver->call_meter_query) {
+ if (cm->driver->call_meter_query == NULL) {
if (cm->pending)
cm_get_properties_reply(cm);
@@ -227,7 +227,7 @@ static void query_acm_callback(const struct ofono_error *error, int value,
static void query_acm(struct ofono_call_meter *cm)
{
- if (!cm->driver->acm_query) {
+ if (cm->driver->acm_query == NULL) {
query_call_meter(cm);
return;
}
@@ -250,7 +250,7 @@ static void query_acm_max_callback(const struct ofono_error *error, int value,
static void query_acm_max(struct ofono_call_meter *cm)
{
- if (!cm->driver->acm_max_query) {
+ if (cm->driver->acm_max_query == NULL) {
cm->flags |= CALL_METER_FLAG_CACHED;
query_acm(cm);
@@ -276,7 +276,7 @@ static void query_puct_callback(const struct ofono_error *error,
static void query_puct(struct ofono_call_meter *cm)
{
- if (!cm->driver->puct_query)
+ if (cm->driver->puct_query == NULL)
query_acm_max(cm);
else
cm->driver->puct_query(cm, query_puct_callback, cm);
@@ -312,7 +312,7 @@ static void set_acm_max_query_callback(const struct ofono_error *error, int valu
struct ofono_call_meter *cm = data;
DBusMessage *reply;
- if (!cm->pending)
+ if (cm->pending == NULL)
return;
if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
@@ -353,7 +353,7 @@ static DBusMessage *prop_set_acm_max(DBusMessage *msg,
{
dbus_uint32_t value;
- if (!cm->driver->acm_max_set)
+ if (cm->driver->acm_max_set == NULL)
return __ofono_error_not_implemented(msg);
dbus_message_iter_get_basic(dbus_value, &value);
@@ -372,7 +372,7 @@ static void set_puct_query_callback(const struct ofono_error *error,
struct ofono_call_meter *cm = data;
DBusMessage *reply;
- if (!cm->pending)
+ if (cm->pending == NULL)
return;
if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
@@ -421,7 +421,7 @@ static void set_puct_initial_query_callback(const struct ofono_error *error,
const char *name;
const char *pin2;
- if (!cm->pending)
+ if (cm->pending == NULL)
return;
if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
@@ -456,7 +456,7 @@ static DBusMessage *prop_set_ppu(DBusMessage *msg, struct ofono_call_meter *cm,
{
double ppu;
- if (!cm->driver->puct_set || !cm->driver->puct_query)
+ if (cm->driver->puct_set == NULL || cm->driver->puct_query == NULL)
return __ofono_error_not_implemented(msg);
dbus_message_iter_get_basic(var, &ppu);
@@ -480,7 +480,7 @@ static DBusMessage *prop_set_cur(DBusMessage *msg, struct ofono_call_meter *cm,
{
const char *value;
- if (!cm->driver->puct_set || !cm->driver->puct_query)
+ if (cm->driver->puct_set == NULL || cm->driver->puct_query == NULL)
return __ofono_error_not_implemented(msg);
dbus_message_iter_get_basic(var, &value);
@@ -570,7 +570,7 @@ static void reset_acm_query_callback(const struct ofono_error *error, int value,
struct ofono_call_meter *cm = data;
DBusMessage *reply;
- if (!cm->pending)
+ if (cm->pending == NULL)
return;
if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
@@ -610,7 +610,7 @@ static DBusMessage *cm_acm_reset(DBusConnection *conn, DBusMessage *msg,
struct ofono_call_meter *cm = data;
const char *pin2;
- if (!cm->driver->acm_reset)
+ if (cm->driver->acm_reset == NULL)
return __ofono_error_not_implemented(msg);
if (cm->pending)
diff --git a/src/call-settings.c b/src/call-settings.c
index c656833..5586e56 100644
--- a/src/call-settings.c
+++ b/src/call-settings.c
@@ -412,7 +412,7 @@ static gboolean cw_ss_control(int type,
int cls = BEARER_CLASS_SS_DEFAULT;
DBusMessage *reply;
- if (!cs)
+ if (cs == NULL)
return FALSE;
if (strcmp(sc, "43"))
@@ -426,8 +426,8 @@ static gboolean cw_ss_control(int type,
if (strlen(sib) || strlen(sib) || strlen(dn))
goto bad_format;
- if ((type == SS_CONTROL_TYPE_QUERY && !cs->driver->cw_query) ||
- (type != SS_CONTROL_TYPE_QUERY && !cs->driver->cw_set)) {
+ if ((type == SS_CONTROL_TYPE_QUERY && cs->driver->cw_query == NULL) ||
+ (type != SS_CONTROL_TYPE_QUERY && cs->driver->cw_set == NULL)) {
reply = __ofono_error_not_implemented(msg);
goto error;
}
@@ -574,7 +574,7 @@ static gboolean clip_colp_colr_ss(int type,
void (*query_op)(struct ofono_call_settings *cs,
ofono_call_settings_status_cb_t cb, void *data);
- if (!cs)
+ if (cs == NULL)
return FALSE;
if (__ofono_call_settings_is_busy(cs)) {
@@ -605,7 +605,7 @@ static gboolean clip_colp_colr_ss(int type,
return TRUE;
}
- if (!query_op) {
+ if (query_op == NULL) {
DBusMessage *reply = __ofono_error_not_implemented(msg);
g_dbus_send_message(conn, reply);
@@ -694,7 +694,7 @@ static gboolean clir_ss_control(int type,
struct ofono_call_settings *cs = data;
DBusConnection *conn = ofono_dbus_get_connection();
- if (!cs)
+ if (cs == NULL)
return FALSE;
if (strcmp(sc, "31"))
@@ -726,7 +726,7 @@ static gboolean clir_ss_control(int type,
return TRUE;
}
- if (type != SS_CONTROL_TYPE_QUERY && !cs->driver->clir_set) {
+ if (type != SS_CONTROL_TYPE_QUERY && cs->driver->clir_set == NULL) {
DBusMessage *reply = __ofono_error_not_implemented(msg);
g_dbus_send_message(conn, reply);
@@ -800,7 +800,7 @@ static DBusMessage *generate_get_properties_reply(struct ofono_call_settings *cs
reply = dbus_message_new_method_return(msg);
- if (!reply)
+ if (reply == NULL)
return NULL;
dbus_message_iter_init_append(reply, &iter);
@@ -859,7 +859,7 @@ out:
static void query_clir(struct ofono_call_settings *cs)
{
- if (!cs->driver->clir_query) {
+ if (cs->driver->clir_query == NULL) {
if (cs->pending) {
DBusMessage *reply =
generate_get_properties_reply(cs,
@@ -886,7 +886,7 @@ static void cs_clip_callback(const struct ofono_error *error,
static void query_clip(struct ofono_call_settings *cs)
{
- if (!cs->driver->clip_query) {
+ if (cs->driver->clip_query == NULL) {
query_clir(cs);
return;
}
@@ -907,7 +907,7 @@ static void cs_colp_callback(const struct ofono_error *error,
static void query_colp(struct ofono_call_settings *cs)
{
- if (!cs->driver->colp_query) {
+ if (cs->driver->colp_query == NULL) {
query_clip(cs);
return;
}
@@ -928,7 +928,7 @@ static void cs_colr_callback(const struct ofono_error *error,
static void query_colr(struct ofono_call_settings *cs)
{
- if (!cs->driver->colr_query) {
+ if (cs->driver->colr_query == NULL) {
query_colp(cs);
return;
}
@@ -949,7 +949,7 @@ static void cs_cw_callback(const struct ofono_error *error, int status,
static void query_cw(struct ofono_call_settings *cs)
{
- if (!cs->driver->cw_query) {
+ if (cs->driver->cw_query == NULL) {
query_colr(cs);
return;
}
diff --git a/src/call-volume.c b/src/call-volume.c
index 6f692f3..1e12d81 100644
--- a/src/call-volume.c
+++ b/src/call-volume.c
@@ -236,7 +236,7 @@ static DBusMessage *cv_set_property(DBusConnection *conn, DBusMessage *msg,
if (g_str_equal(property, "SpeakerVolume") == TRUE) {
unsigned char percent;
- if (!cv->driver->speaker_volume)
+ if (cv->driver->speaker_volume == NULL)
return __ofono_error_not_implemented(msg);
if (dbus_message_iter_get_arg_type(&var) != DBUS_TYPE_BYTE)
@@ -258,7 +258,7 @@ static DBusMessage *cv_set_property(DBusConnection *conn, DBusMessage *msg,
} else if (g_str_equal(property, "MicrophoneVolume") == TRUE) {
unsigned char percent;
- if (!cv->driver->microphone_volume)
+ if (cv->driver->microphone_volume == NULL)
return __ofono_error_not_implemented(msg);
if (dbus_message_iter_get_arg_type(&var) != DBUS_TYPE_BYTE)
@@ -280,7 +280,7 @@ static DBusMessage *cv_set_property(DBusConnection *conn, DBusMessage *msg,
} else if (g_str_equal(property, "Muted") == TRUE) {
dbus_bool_t muted;
- if (!cv->driver->mute)
+ if (cv->driver->mute == NULL)
return __ofono_error_not_implemented(msg);
if (dbus_message_iter_get_arg_type(&var) != DBUS_TYPE_BOOLEAN)
diff --git a/src/cbs.c b/src/cbs.c
index 50e78c2..9c1abd0 100644
--- a/src/cbs.c
+++ b/src/cbs.c
@@ -132,7 +132,7 @@ static void cbs_dispatch_emergency(struct ofono_cbs *cbs, const char *message,
signal = dbus_message_new_signal(path, OFONO_CELL_BROADCAST_INTERFACE,
"EmergencyBroadcast");
- if (!signal)
+ if (signal == NULL)
return;
dbus_message_iter_init_append(signal, &iter);
@@ -195,7 +195,7 @@ void ofono_cbs_notify(struct ofono_cbs *cbs, const unsigned char *pdu,
struct ofono_atom *sim_atom;
sim_atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_SIM);
- if (!sim_atom)
+ if (sim_atom == NULL)
return;
if (!__ofono_sim_service_available(
@@ -290,7 +290,7 @@ static DBusMessage *cbs_get_properties(DBusConnection *conn,
reply = dbus_message_new_method_return(msg);
- if (!reply)
+ if (reply == NULL)
return NULL;
dbus_message_iter_init_append(reply, &iter);
@@ -386,7 +386,7 @@ static DBusMessage *cbs_set_topics(struct ofono_cbs *cbs, const char *value,
if (topics == NULL && value[0] != '\0')
return __ofono_error_invalid_format(msg);
- if (!cbs->driver->set_topics)
+ if (cbs->driver->set_topics == NULL)
return __ofono_error_not_implemented(msg);
cbs->new_topics = topics;
@@ -416,7 +416,7 @@ static void cbs_set_powered_cb(const struct ofono_error *error, void *data)
if (error->type != OFONO_ERROR_TYPE_NO_ERROR) {
ofono_error("Setting Cell Broadcast topics failed");
- if (!cbs->pending)
+ if (cbs->pending == NULL)
return;
__ofono_dbus_pending_reply(&cbs->pending,
@@ -438,7 +438,7 @@ static void cbs_set_powered_cb(const struct ofono_error *error, void *data)
DBUS_TYPE_BOOLEAN,
&cbs->powered);
- if (!cbs->pending)
+ if (cbs->pending == NULL)
return;
reply = dbus_message_new_method_return(cbs->pending);
@@ -455,7 +455,7 @@ static DBusMessage *cbs_set_powered(struct ofono_cbs *cbs, gboolean value,
if (cbs->powered == value)
goto reply;
- if (!cbs->driver->set_topics || !cbs->driver->clear_topics)
+ if (cbs->driver->set_topics == NULL || cbs->driver->clear_topics == NULL)
goto done;
if (msg)
@@ -951,7 +951,7 @@ static void cbs_location_changed(int status, int lac, int ci, int tech,
DBG("%d, %d, %d, %d, %s%s", status, lac, ci, tech, mcc, mnc);
- if (!mcc || !mnc) {
+ if (mcc == NULL || mnc == NULL) {
if (cbs->mcc[0] == '\0' && cbs->mnc[0] == '\0')
return;
diff --git a/src/common.c b/src/common.c
index f32153c..5154b8d 100644
--- a/src/common.c
+++ b/src/common.c
@@ -516,7 +516,7 @@ gboolean parse_ss_control_string(char *str, int *ss_type,
/* Must have at least one other '#' */
c = strrchr(str+cur, '#');
- if (!c)
+ if (c == NULL)
goto out;
*dn = c+1;
diff --git a/src/dbus.c b/src/dbus.c
index ad29241..2feb2a1 100644
--- a/src/dbus.c
+++ b/src/dbus.c
@@ -176,7 +176,7 @@ int ofono_dbus_signal_property_changed(DBusConnection *conn,
signal = dbus_message_new_signal(path, interface, "PropertyChanged");
- if (!signal) {
+ if (signal == NULL) {
ofono_error("Unable to allocate new %s.PropertyChanged signal",
interface);
return -1;
@@ -203,7 +203,7 @@ int ofono_dbus_signal_array_property_changed(DBusConnection *conn,
signal = dbus_message_new_signal(path, interface, "PropertyChanged");
- if (!signal) {
+ if (signal == NULL) {
ofono_error("Unable to allocate new %s.PropertyChanged signal",
interface);
return -1;
@@ -230,7 +230,7 @@ int ofono_dbus_signal_dict_property_changed(DBusConnection *conn,
signal = dbus_message_new_signal(path, interface, "PropertyChanged");
- if (!signal) {
+ if (signal == NULL) {
ofono_error("Unable to allocate new %s.PropertyChanged signal",
interface);
return -1;
@@ -426,7 +426,7 @@ void __ofono_dbus_cleanup(void)
{
DBusConnection *conn = ofono_dbus_get_connection();
- if (!conn || !dbus_connection_get_is_connected(conn))
+ if (conn == NULL || !dbus_connection_get_is_connected(conn))
return;
dbus_gsm_set_connection(NULL);
diff --git a/src/gprs.c b/src/gprs.c
index 7e42a99..610f3b2 100644
--- a/src/gprs.c
+++ b/src/gprs.c
@@ -336,7 +336,7 @@ static void pri_context_signal_settings(struct pri_context *ctx)
OFONO_CONNECTION_CONTEXT_INTERFACE,
"PropertyChanged");
- if (!signal)
+ if (signal == NULL)
return;
dbus_message_iter_init_append(signal, &iter);
@@ -400,7 +400,7 @@ static void pri_ifupdown(const char *interface, ofono_bool_t active)
struct ifreq ifr;
int sk;
- if (!interface)
+ if (interface == NULL)
return;
sk = socket(PF_INET, SOCK_DGRAM, 0);
@@ -436,7 +436,7 @@ static void pri_setaddr(const char *interface, const char *address)
struct sockaddr_in addr;
int sk;
- if (!interface)
+ if (interface == NULL)
return;
sk = socket(PF_INET, SOCK_DGRAM, 0);
@@ -459,7 +459,7 @@ static void pri_setaddr(const char *interface, const char *address)
goto done;
}
- if (!address)
+ if (address == NULL)
goto done;
memset(&addr, 0, sizeof(addr));
@@ -480,7 +480,7 @@ static void pri_setproxy(const char *interface, const char *proxy)
struct sockaddr_in addr;
int sk;
- if (!interface)
+ if (interface == NULL)
return;
sk = socket(PF_INET, SOCK_DGRAM, 0);
@@ -550,7 +550,7 @@ static void pri_update_context_settings(struct pri_context *ctx,
context_settings_free(ctx->settings);
ctx->settings = g_try_new0(struct context_settings, 1);
- if (!ctx->settings)
+ if (ctx->settings == NULL)
return;
ctx->settings->type = ctx->type;
@@ -633,7 +633,7 @@ static DBusMessage *pri_get_properties(DBusConnection *conn,
DBusMessageIter dict;
reply = dbus_message_new_method_return(msg);
- if (!reply)
+ if (reply == NULL)
return NULL;
dbus_message_iter_init_append(reply, &iter);
@@ -1147,12 +1147,12 @@ static struct pri_context *pri_context_create(struct ofono_gprs *gprs,
{
struct pri_context *context = g_try_new0(struct pri_context, 1);
- if (!context)
+ if (context == NULL)
return NULL;
- if (!name) {
+ if (name == NULL) {
name = gprs_context_default_name(type);
- if (!name)
+ if (name == NULL)
return NULL;
}
@@ -1419,7 +1419,7 @@ static DBusMessage *gprs_get_properties(DBusConnection *conn,
dbus_bool_t value;
reply = dbus_message_new_method_return(msg);
- if (!reply)
+ if (reply == NULL)
return NULL;
dbus_message_iter_init_append(reply, &iter);
@@ -1497,7 +1497,7 @@ static DBusMessage *gprs_set_property(DBusConnection *conn,
gprs_netreg_update(gprs);
} else if (!strcmp(property, "Powered")) {
- if (!gprs->driver->set_attached)
+ if (gprs->driver->set_attached == NULL)
return __ofono_error_not_implemented(msg);
if (dbus_message_iter_get_arg_type(&var) != DBUS_TYPE_BOOLEAN)
@@ -1563,7 +1563,7 @@ static struct pri_context *add_context(struct ofono_gprs *gprs,
return NULL;
context = pri_context_create(gprs, name, type);
- if (!context) {
+ if (context == NULL) {
ofono_error("Unable to allocate context struct");
return NULL;
}
@@ -1709,7 +1709,7 @@ static DBusMessage *gprs_remove_context(DBusConnection *conn,
return __ofono_error_invalid_format(msg);
ctx = gprs_context_by_path(gprs, path);
- if (!ctx)
+ if (ctx == NULL)
return __ofono_error_not_found(msg);
if (ctx->active) {
diff --git a/src/history.c b/src/history.c
index 7d3c927..e745820 100644
--- a/src/history.c
+++ b/src/history.c
@@ -106,7 +106,7 @@ void __ofono_history_probe_drivers(struct ofono_modem *modem)
context = history_context_create(modem, driver);
- if (!context)
+ if (context == NULL)
continue;
__ofono_modem_add_atom(modem, OFONO_ATOM_TYPE_HISTORY,
diff --git a/src/main.c b/src/main.c
index eca008e..87fb0ab 100644
--- a/src/main.c
+++ b/src/main.c
@@ -214,7 +214,7 @@ int main(int argc, char **argv)
dbus_error_init(&error);
conn = g_dbus_setup_bus(DBUS_BUS_SYSTEM, OFONO_SERVICE, &error);
- if (!conn) {
+ if (conn == NULL) {
if (dbus_error_is_set(&error) == TRUE) {
ofono_error("Unable to hop onto D-Bus: %s",
error.message);
diff --git a/src/message-waiting.c b/src/message-waiting.c
index 97a238c..d8bfe34 100644
--- a/src/message-waiting.c
+++ b/src/message-waiting.c
@@ -119,7 +119,7 @@ static DBusMessage *mw_get_properties(DBusConnection *conn,
const char *number;
reply = dbus_message_new_method_return(msg);
- if (!reply)
+ if (reply == NULL)
return NULL;
dbus_message_iter_init_append(reply, &iter);
@@ -395,7 +395,7 @@ static void update_indicator_and_emit(struct ofono_message_waiting *mw,
indication = info->indication;
count = info->message_count;
- if (!mw_message_waiting_property_name[mailbox])
+ if (mw_message_waiting_property_name[mailbox] == NULL)
return;
ofono_dbus_signal_property_changed(conn, path,
diff --git a/src/modem.c b/src/modem.c
index f032d93..52e647b 100644
--- a/src/modem.c
+++ b/src/modem.c
@@ -532,7 +532,7 @@ static DBusMessage *set_property_online(struct ofono_modem *modem,
if (modem->pending != NULL)
return __ofono_error_busy(msg);
- if (!driver->set_online)
+ if (driver->set_online == NULL)
return __ofono_error_not_implemented(msg);
if (modem->modem_state < MODEM_STATE_OFFLINE)
@@ -628,7 +628,7 @@ static DBusMessage *modem_get_properties(DBusConnection *conn,
DBusMessageIter dict;
reply = dbus_message_new_method_return(msg);
- if (!reply)
+ if (reply == NULL)
return NULL;
dbus_message_iter_init_append(reply, &iter);
@@ -947,7 +947,7 @@ void ofono_modem_remove_interface(struct ofono_modem *modem,
found = g_slist_find_custom(modem->interface_list, interface,
(GCompareFunc) strcmp);
- if (!found) {
+ if (found == NULL) {
ofono_error("Interface %s not found on the interface_list",
interface);
return;
@@ -994,7 +994,7 @@ static void query_serial_cb(const struct ofono_error *error,
static void query_serial(struct ofono_devinfo *info)
{
- if (!info->driver->query_serial)
+ if (info->driver->query_serial == NULL)
return;
info->driver->query_serial(info, query_serial_cb, info);
@@ -1023,7 +1023,7 @@ out:
static void query_revision(struct ofono_devinfo *info)
{
- if (!info->driver->query_revision) {
+ if (info->driver->query_revision == NULL) {
query_serial(info);
return;
}
@@ -1054,7 +1054,7 @@ out:
static void query_model(struct ofono_devinfo *info)
{
- if (!info->driver->query_model) {
+ if (info->driver->query_model == NULL) {
/* If model is not supported, don't bother querying revision */
query_serial(info);
}
@@ -1088,7 +1088,7 @@ static gboolean query_manufacturer(gpointer user)
{
struct ofono_devinfo *info = user;
- if (!info->driver->query_manufacturer) {
+ if (info->driver->query_manufacturer == NULL) {
query_model(info);
return FALSE;
}
diff --git a/src/nettime.c b/src/nettime.c
index 904deee..3821c16 100644
--- a/src/nettime.c
+++ b/src/nettime.c
@@ -78,7 +78,7 @@ void __ofono_nettime_probe_drivers(struct ofono_modem *modem)
context = nettime_context_create(modem, driver);
- if (!context)
+ if (context == NULL)
continue;
__ofono_modem_add_atom(modem, OFONO_ATOM_TYPE_NETTIME,
diff --git a/src/network.c b/src/network.c
index 83014bb..e391bc3 100644
--- a/src/network.c
+++ b/src/network.c
@@ -194,7 +194,7 @@ static void register_callback(const struct ofono_error *error, void *data)
DBusConnection *conn = ofono_dbus_get_connection();
DBusMessage *reply;
- if (!netreg->pending)
+ if (netreg->pending == NULL)
goto out;
if (error->type == OFONO_ERROR_TYPE_NO_ERROR)
@@ -352,7 +352,7 @@ static char *get_operator_display_name(struct ofono_netreg *netreg)
* together there are four cases to consider.
*/
- if (!opd) {
+ if (opd == NULL) {
g_strlcpy(name, "", len);
return name;
}
@@ -371,7 +371,7 @@ static char *get_operator_display_name(struct ofono_netreg *netreg)
if (opd->eons_info && opd->eons_info->longname)
plmn = opd->eons_info->longname;
- if (!netreg->spname || strlen(netreg->spname) == 0) {
+ if (netreg->spname == NULL || strlen(netreg->spname) == 0) {
g_strlcpy(name, plmn, len);
return name;
}
@@ -458,7 +458,7 @@ static void set_network_operator_eons_info(struct network_operator_data *opd,
const char *oldinfo;
const char *newinfo;
- if (!old_eons_info && !eons_info)
+ if (old_eons_info == NULL && eons_info == NULL)
return;
path = network_operator_build_path(netreg, opd->mcc, opd->mnc);
@@ -566,7 +566,7 @@ static DBusMessage *network_operator_get_properties(DBusConnection *conn,
DBusMessageIter iter;
DBusMessageIter dict;
reply = dbus_message_new_method_return(msg);
- if (!reply)
+ if (reply == NULL)
return NULL;
dbus_message_iter_init_append(reply, &iter);
@@ -671,7 +671,7 @@ static GSList *compress_operator_list(const struct ofono_network_operator *list,
o = g_slist_find_custom(oplist, &list[i],
network_operator_compare);
- if (!o) {
+ if (o == NULL) {
opd = network_operator_create(&list[i]);
oplist = g_slist_prepend(oplist, opd);
} else if (o && list[i].tech != -1) {
@@ -760,7 +760,7 @@ static DBusMessage *network_get_properties(DBusConnection *conn,
const char *mode = registration_mode_to_string(netreg->mode);
reply = dbus_message_new_method_return(msg);
- if (!reply)
+ if (reply == NULL)
return NULL;
dbus_message_iter_init_append(reply, &iter);
@@ -1217,7 +1217,7 @@ static void current_operator_callback(const struct ofono_error *error,
return;
}
- if (!netreg->current_operator && !current)
+ if (netreg->current_operator == NULL && current == NULL)
return;
/* We got a new network operator, reset the previous one's status */
@@ -1299,7 +1299,7 @@ emit:
void ofono_netreg_status_notify(struct ofono_netreg *netreg, int status,
int lac, int ci, int tech)
{
- if (!netreg)
+ if (netreg == NULL)
return;
if (netreg->status != status)
@@ -1339,7 +1339,7 @@ void ofono_netreg_time_notify(struct ofono_netreg *netreg,
{
struct ofono_modem *modem = __ofono_atom_get_modem(netreg->atom);
- if (!info)
+ if (info == NULL)
return;
__ofono_nettime_info_received(modem, info);
@@ -1465,7 +1465,7 @@ static void sim_pnn_read_cb(int ok, int length, int record,
total = length / record_length;
- if (!netreg->eons)
+ if (netreg->eons == NULL)
netreg->eons = sim_eons_new(total);
sim_eons_add_pnn_record(netreg->eons, record, data, record_length);
@@ -1498,7 +1498,7 @@ static void sim_spdi_read_cb(int ok, int length, int record,
netreg->spdi = sim_spdi_new(data, length);
- if (!current)
+ if (current == NULL)
return;
if (netreg->status == NETWORK_REGISTRATION_STATUS_ROAMING) {
@@ -1550,7 +1550,7 @@ static void sim_spn_read_cb(int ok, int length, int record,
*/
spn = sim_string_to_utf8(data + 1, length - 1);
- if (!spn) {
+ if (spn == NULL) {
ofono_error("EFspn read successfully, but couldn't parse");
return;
}
@@ -1773,7 +1773,7 @@ static void netreg_load_settings(struct ofono_netreg *netreg)
imsi = ofono_sim_get_imsi(netreg->sim);
- if (!imsi)
+ if (imsi == NULL)
return;
netreg->settings = storage_open(imsi, SETTINGS_STORE);
diff --git a/src/phonebook.c b/src/phonebook.c
index cae2b14..0e9c894 100644
--- a/src/phonebook.c
+++ b/src/phonebook.c
@@ -155,7 +155,7 @@ static void vcard_printf_number(GString *vcards, const char *number, int type,
char *pref = "", *intl = "", *category_string = "";
char buf[128];
- if (!number || !strlen(number) || !type)
+ if (number == NULL || !strlen(number) || !type)
return;
switch (category) {
@@ -278,7 +278,7 @@ static DBusMessage *generate_export_entries_reply(struct ofono_phonebook *pb,
reply = dbus_message_new_method_return(msg);
- if (!reply)
+ if (reply == NULL)
return NULL;
dbus_message_iter_init_append(reply, &iter);
@@ -292,7 +292,7 @@ static gboolean need_merge(const char *text)
int len;
char c;
- if (!text)
+ if (text == NULL)
return FALSE;
len = strlen(text);
@@ -375,7 +375,7 @@ void ofono_phonebook_entry(struct ofono_phonebook *phonebook, int index,
break;
}
- if (!l) {
+ if (l == NULL) {
person = g_new0(struct phonebook_person, 1);
phonebook->merge_list =
g_slist_prepend(phonebook->merge_list, person);
@@ -445,7 +445,7 @@ static void export_phonebook(struct ofono_phonebook *phonebook)
reply = generate_export_entries_reply(phonebook, phonebook->pending);
- if (!reply) {
+ if (reply == NULL) {
dbus_message_unref(phonebook->pending);
return;
}
diff --git a/src/plugin.c b/src/plugin.c
index 7c0652b..25e9a5a 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -88,7 +88,7 @@ static gboolean check_plugin(struct ofono_plugin_desc *desc,
for (; *patterns; patterns++)
if (g_pattern_match_simple(*patterns, desc->name))
break;
- if (!*patterns) {
+ if (*patterns == NULL) {
ofono_info("Ignoring %s", desc->description);
return FALSE;
}
diff --git a/src/radio-settings.c b/src/radio-settings.c
index 5794221..ff6934b 100644
--- a/src/radio-settings.c
+++ b/src/radio-settings.c
@@ -96,7 +96,7 @@ static DBusMessage *radio_get_properties_reply(DBusMessage *msg,
const char *mode = radio_access_mode_to_string(rs->mode);
reply = dbus_message_new_method_return(msg);
- if (!reply)
+ if (reply == NULL)
return NULL;
dbus_message_iter_init_append(reply, &iter);
@@ -233,7 +233,7 @@ static void radio_fast_dormancy_query_callback(const struct ofono_error *error,
static void radio_query_fast_dormancy(struct ofono_radio_settings *rs)
{
- if (!rs->driver->query_fast_dormancy) {
+ if (rs->driver->query_fast_dormancy == NULL) {
radio_send_properties_reply(rs);
return;
}
@@ -270,7 +270,7 @@ static DBusMessage *radio_get_properties(DBusConnection *conn,
if (rs->flags & RADIO_SETTINGS_FLAG_CACHED)
return radio_get_properties_reply(msg, rs);
- if (!rs->driver->query_rat_mode)
+ if (rs->driver->query_rat_mode == NULL)
return __ofono_error_not_implemented(msg);
if (rs->pending)
@@ -311,7 +311,7 @@ static DBusMessage *radio_set_property(DBusConnection *conn, DBusMessage *msg,
const char *value;
enum ofono_radio_access_mode mode;
- if (!rs->driver->set_rat_mode)
+ if (rs->driver->set_rat_mode == NULL)
return __ofono_error_not_implemented(msg);
if (dbus_message_iter_get_arg_type(&var) != DBUS_TYPE_STRING)
@@ -334,7 +334,7 @@ static DBusMessage *radio_set_property(DBusConnection *conn, DBusMessage *msg,
dbus_bool_t value;
int target;
- if (!rs->driver->set_fast_dormancy)
+ if (rs->driver->set_fast_dormancy == NULL)
return __ofono_error_not_implemented(msg);
if (dbus_message_iter_get_arg_type(&var) != DBUS_TYPE_BOOLEAN)
@@ -374,7 +374,7 @@ int ofono_radio_settings_driver_register(const struct ofono_radio_settings_drive
{
DBG("driver: %p, name: %s", d, d->name);
- if (!d || !d->probe)
+ if (d == NULL || d->probe == NULL)
return -EINVAL;
g_drivers = g_slist_prepend(g_drivers, (void *) d);
@@ -386,7 +386,7 @@ void ofono_radio_settings_driver_unregister(const struct ofono_radio_settings_dr
{
DBG("driver: %p, name: %s", d, d->name);
- if (!d)
+ if (d == NULL)
return;
g_drivers = g_slist_remove(g_drivers, (void *) d);
@@ -409,7 +409,7 @@ static void radio_settings_remove(struct ofono_atom *atom)
DBG("atom: %p", atom);
- if (!rs)
+ if (rs == NULL)
return;
if (rs->driver && rs->driver->remove)
@@ -426,11 +426,11 @@ struct ofono_radio_settings *ofono_radio_settings_create(struct ofono_modem *mod
struct ofono_radio_settings *rs;
GSList *l;
- if (!driver)
+ if (driver == NULL)
return NULL;
rs = g_try_new0(struct ofono_radio_settings, 1);
- if (!rs)
+ if (rs == NULL)
return NULL;
rs->mode = -1;
diff --git a/src/sim.c b/src/sim.c
index bc7859c..860f179 100644
--- a/src/sim.c
+++ b/src/sim.c
@@ -292,7 +292,7 @@ static DBusMessage *sim_get_properties(DBusConnection *conn,
dbus_bool_t bdn;
reply = dbus_message_new_method_return(msg);
- if (!reply)
+ if (reply == NULL)
return NULL;
dbus_message_iter_init_append(reply, &iter);
@@ -582,7 +582,7 @@ static DBusMessage *sim_lock_or_unlock(struct ofono_sim *sim, int lock,
const char *typestr;
const char *pin;
- if (!sim->driver->lock)
+ if (sim->driver->lock == NULL)
return __ofono_error_not_implemented(msg);
if (sim->pending)
@@ -653,7 +653,7 @@ static DBusMessage *sim_change_pin(DBusConnection *conn, DBusMessage *msg,
const char *old;
const char *new;
- if (!sim->driver->change_passwd)
+ if (sim->driver->change_passwd == NULL)
return __ofono_error_not_implemented(msg);
if (sim->pending)
@@ -709,7 +709,7 @@ static DBusMessage *sim_enter_pin(DBusConnection *conn, DBusMessage *msg,
enum ofono_sim_password_type type;
const char *pin;
- if (!sim->driver->send_passwd)
+ if (sim->driver->send_passwd == NULL)
return __ofono_error_not_implemented(msg);
if (sim->pending)
@@ -918,7 +918,7 @@ static DBusMessage *sim_reset_pin(DBusConnection *conn, DBusMessage *msg,
const char *puk;
const char *pin;
- if (!sim->driver->reset_passwd)
+ if (sim->driver->reset_passwd == NULL)
return __ofono_error_not_implemented(msg);
if (sim->pending)
@@ -976,7 +976,7 @@ static gboolean numbers_list_equal(GSList *a, GSList *b)
struct ofono_phone_number *num_a, *num_b;
while (a || b) {
- if (!a || !b)
+ if (a == NULL || b == NULL)
return FALSE;
num_a = a->data;
@@ -1242,7 +1242,7 @@ static void sim_imsi_cb(const struct ofono_error *error, const char *imsi,
static void sim_retrieve_imsi(struct ofono_sim *sim)
{
- if (!sim->driver->read_imsi) {
+ if (sim->driver->read_imsi == NULL) {
ofono_error("IMSI retrieval not implemented,"
" only emergency calls will be available");
return;
@@ -1592,7 +1592,7 @@ checkdone:
static void sim_pin_check(struct ofono_sim *sim)
{
- if (!sim->driver->query_passwd_state) {
+ if (sim->driver->query_passwd_state == NULL) {
sim_initialize_after_pin(sim);
return;
}
diff --git a/src/simfs.c b/src/simfs.c
index 5f459ab..8e52f7b 100644
--- a/src/simfs.c
+++ b/src/simfs.c
@@ -408,7 +408,7 @@ static gboolean sim_fs_op_read_record(gpointer user)
switch (op->structure) {
case OFONO_SIM_FILE_STRUCTURE_FIXED:
- if (!driver->read_file_linear) {
+ if (driver->read_file_linear == NULL) {
sim_fs_op_error(fs);
return FALSE;
}
@@ -418,7 +418,7 @@ static gboolean sim_fs_op_read_record(gpointer user)
sim_fs_op_retrieve_cb, fs);
break;
case OFONO_SIM_FILE_STRUCTURE_CYCLIC:
- if (!driver->read_file_cyclic) {
+ if (driver->read_file_cyclic == NULL) {
sim_fs_op_error(fs);
return FALSE;
}
@@ -626,7 +626,7 @@ static gboolean sim_fs_op_next(gpointer user_data)
fs->op_source = 0;
- if (!fs->op_q)
+ if (fs->op_q == NULL)
return FALSE;
op = g_queue_peek_head(fs->op_q);
@@ -671,16 +671,16 @@ int sim_fs_read_info(struct sim_fs *fs, int id,
{
struct sim_fs_op *op;
- if (!cb)
+ if (cb == NULL)
return -EINVAL;
- if (!fs->driver)
+ if (fs->driver == NULL)
return -EINVAL;
- if (!fs->driver->read_file_info)
+ if (fs->driver->read_file_info == NULL)
return -ENOSYS;
- if (!fs->op_q)
+ if (fs->op_q == NULL)
fs->op_q = g_queue_new();
op = g_try_new0(struct sim_fs_op, 1);
@@ -709,16 +709,16 @@ int sim_fs_read(struct sim_fs *fs, int id,
{
struct sim_fs_op *op;
- if (!cb)
+ if (cb == NULL)
return -EINVAL;
- if (!fs->driver)
+ if (fs->driver == NULL)
return -EINVAL;
- if (!fs->driver->read_file_info)
+ if (fs->driver->read_file_info == NULL)
return -ENOSYS;
- if (!fs->op_q)
+ if (fs->op_q == NULL)
fs->op_q = g_queue_new();
op = g_try_new0(struct sim_fs_op, 1);
@@ -749,10 +749,10 @@ int sim_fs_write(struct sim_fs *fs, int id, ofono_sim_file_write_cb_t cb,
struct sim_fs_op *op;
gconstpointer fn = NULL;
- if (!cb)
+ if (cb == NULL)
return -EINVAL;
- if (!fs->driver)
+ if (fs->driver == NULL)
return -EINVAL;
switch (structure) {
@@ -772,7 +772,7 @@ int sim_fs_write(struct sim_fs *fs, int id, ofono_sim_file_write_cb_t cb,
if (fn == NULL)
return -ENOSYS;
- if (!fs->op_q)
+ if (fs->op_q == NULL)
fs->op_q = g_queue_new();
op = g_try_new0(struct sim_fs_op, 1);
diff --git a/src/simutil.c b/src/simutil.c
index 58ea81d..b9a8bbb 100644
--- a/src/simutil.c
+++ b/src/simutil.c
@@ -939,7 +939,7 @@ struct sim_spdi *sim_spdi_new(const guint8 *tlv, int length)
plmn_list = ber_tlv_find_by_tag(plmn_list_tlv, 0x80, tlv_length,
&list_length);
- if (!plmn_list)
+ if (plmn_list == NULL)
return NULL;
spdi = g_new0(struct sim_spdi, 1);
@@ -963,7 +963,7 @@ gboolean sim_spdi_lookup(struct sim_spdi *spdi,
{
struct spdi_operator spdi_op;
- if (!spdi)
+ if (spdi == NULL)
return FALSE;
g_strlcpy(spdi_op.mcc, mcc, sizeof(spdi_op.mcc));
@@ -1011,7 +1011,7 @@ void sim_eons_add_pnn_record(struct sim_eons *eons, int record,
name = ber_tlv_find_by_tag(tlv, 0x43, length, &namelength);
- if (!name || !namelength)
+ if (name == NULL || !namelength)
return;
oper->longname = sim_network_name_parse(name, namelength,
@@ -1119,7 +1119,7 @@ static const struct sim_eons_operator_info *
break;
}
- if (!l)
+ if (l == NULL)
return NULL;
opl = l->data;
@@ -1316,7 +1316,7 @@ gboolean sim_parse_3g_get_response(const unsigned char *data, int len,
*/
tlv = ber_tlv_find_by_tag(fcp, 0x80, fcp_length, &tlv_length);
- if (!tlv || tlv_length < 2)
+ if (tlv == NULL || tlv_length < 2)
return FALSE;
flen = tlv[0];
@@ -1325,14 +1325,14 @@ gboolean sim_parse_3g_get_response(const unsigned char *data, int len,
tlv = ber_tlv_find_by_tag(fcp, 0x83, fcp_length, &tlv_length);
- if (!tlv || tlv_length != 2)
+ if (tlv == NULL || tlv_length != 2)
return FALSE;
id = (tlv[0] << 8) | tlv[1];
tlv = ber_tlv_find_by_tag(fcp, 0x82, fcp_length, &tlv_length);
- if (!tlv || (tlv_length != 2 && tlv_length != 5))
+ if (tlv == NULL || (tlv_length != 2 && tlv_length != 5))
return FALSE;
if (tlv[1] != 0x21)
@@ -1381,7 +1381,7 @@ gboolean sim_parse_3g_get_response(const unsigned char *data, int len,
acc[2] = 0x44;
- if (!info)
+ if (info == NULL)
acc[0] = 0x11;
else
acc[0] = (info->perm_read << 4) | info->perm_update;
diff --git a/src/sms.c b/src/sms.c
index 12988c8..17e6640 100644
--- a/src/sms.c
+++ b/src/sms.c
@@ -191,11 +191,11 @@ static unsigned int add_sms_handler(struct ofono_watchlist *watchlist,
{
struct sms_handler *handler;
- if (!notify)
+ if (notify == NULL)
return 0;
handler = g_try_new0(struct sms_handler, 1);
- if (!handler)
+ if (handler == NULL)
return 0;
handler->dst = dst;
@@ -212,7 +212,7 @@ unsigned int __ofono_sms_text_watch_add(struct ofono_sms *sms,
ofono_sms_text_notify_cb_t cb,
void *data, ofono_destroy_func destroy)
{
- if (!sms)
+ if (sms == NULL)
return 0;
DBG("%p", sms);
@@ -223,7 +223,7 @@ unsigned int __ofono_sms_text_watch_add(struct ofono_sms *sms,
gboolean __ofono_sms_text_watch_remove(struct ofono_sms *sms,
unsigned int id)
{
- if (!sms)
+ if (sms == NULL)
return FALSE;
DBG("%p", sms);
@@ -236,7 +236,7 @@ unsigned int __ofono_sms_datagram_watch_add(struct ofono_sms *sms,
int dst, int src, void *data,
ofono_destroy_func destroy)
{
- if (!sms)
+ if (sms == NULL)
return 0;
DBG("%p: dst %d, src %d", sms, dst, src);
@@ -248,7 +248,7 @@ unsigned int __ofono_sms_datagram_watch_add(struct ofono_sms *sms,
gboolean __ofono_sms_datagram_watch_remove(struct ofono_sms *sms,
unsigned int id)
{
- if (!sms)
+ if (sms == NULL)
return FALSE;
DBG("%p", sms);
@@ -266,7 +266,7 @@ static DBusMessage *message_get_properties(DBusConnection *conn,
reply = dbus_message_new_method_return(msg);
- if (!reply)
+ if (reply == NULL)
return NULL;
dbus_message_iter_init_append(reply, &iter);
@@ -330,7 +330,7 @@ static gboolean message_dbus_register(struct ofono_sms *sms, struct message *m)
DBusConnection *conn = ofono_dbus_get_connection();
const char *path;
- if (!m)
+ if (m == NULL)
return FALSE;
path = __ofono_sms_message_path_from_uuid(sms, &m->uuid);
@@ -487,7 +487,7 @@ static DBusMessage *generate_get_properties_reply(struct ofono_sms *sms,
reply = dbus_message_new_method_return(msg);
- if (!reply)
+ if (reply == NULL)
return NULL;
dbus_message_iter_init_append(reply, &iter);
@@ -541,7 +541,7 @@ static DBusMessage *sms_get_properties(DBusConnection *conn,
if (sms->pending)
return __ofono_error_busy(msg);
- if (!sms->driver->sca_query)
+ if (sms->driver->sca_query == NULL)
return __ofono_error_not_implemented(msg);
if (sms->flags & MESSAGE_MANAGER_FLAG_CACHED)
@@ -832,7 +832,7 @@ static gboolean tx_next(gpointer user_data)
sms->tx_source = 0;
- if (!entry)
+ if (entry == NULL)
return FALSE;
if (g_queue_get_length(sms->txq) > 1
@@ -991,7 +991,7 @@ static DBusMessage *sms_send_message(DBusConnection *conn, DBusMessage *msg,
msg_list = sms_text_prepare(to, text, sms->ref, use_16bit_ref,
sms->use_delivery_reports);
- if (!msg_list)
+ if (msg_list == NULL)
return __ofono_error_invalid_format(msg);
flags = OFONO_SMS_SUBMIT_FLAG_RECORD_HISTORY;
@@ -1175,7 +1175,7 @@ static void dispatch_text_message(struct ofono_sms *sms,
struct sms_handler *h;
GSList *l;
- if (!message)
+ if (message == NULL)
return;
if (cls == SMS_CLASS_0)
@@ -1186,7 +1186,7 @@ static void dispatch_text_message(struct ofono_sms *sms,
signal = dbus_message_new_signal(path, OFONO_MESSAGE_MANAGER_INTERFACE,
signal_name);
- if (!signal)
+ if (signal == NULL)
return;
dbus_message_iter_init_append(signal, &iter);
@@ -1325,7 +1325,7 @@ static void sms_dispatch(struct ofono_sms *sms, GSList *sms_list)
buf = sms_decode_datagram(sms_list, &len);
- if (!buf)
+ if (buf == NULL)
return;
dispatch_app_datagram(sms, &uuid, dstport, srcport, buf, len,
@@ -1335,7 +1335,7 @@ static void sms_dispatch(struct ofono_sms *sms, GSList *sms_list)
} else {
char *message = sms_decode_text(sms_list);
- if (!message)
+ if (message == NULL)
return;
dispatch_text_message(sms, &uuid, message, cls,
@@ -1357,7 +1357,7 @@ static void handle_deliver(struct ofono_sms *sms, const struct sms *incoming)
if (sms_extract_concatenation(incoming, &ref, &max, &seq)) {
GSList *sms_list;
- if (!sms->assembly)
+ if (sms->assembly == NULL)
return;
sms_list = sms_assembly_add_fragment(sms->assembly,
@@ -1365,7 +1365,7 @@ static void handle_deliver(struct ofono_sms *sms, const struct sms *incoming)
&incoming->deliver.oaddr,
ref, max, seq);
- if (!sms_list)
+ if (sms_list == NULL)
return;
sms_dispatch(sms, sms_list);
@@ -1489,7 +1489,7 @@ void ofono_sms_deliver_notify(struct ofono_sms *sms, unsigned char *pdu,
sim_atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_SIM);
- if (!sim_atom)
+ if (sim_atom == NULL)
return;
if (!__ofono_sim_service_available(
@@ -1500,7 +1500,7 @@ void ofono_sms_deliver_notify(struct ofono_sms *sms, unsigned char *pdu,
stk_atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_STK);
- if (!stk_atom)
+ if (stk_atom == NULL)
return;
__ofono_sms_sim_download(__ofono_atom_get_data(stk_atom),
diff --git a/src/smsagent.c b/src/smsagent.c
index bb0a3ab..9d6f21d 100644
--- a/src/smsagent.c
+++ b/src/smsagent.c
@@ -63,7 +63,7 @@ static struct sms_agent_request *sms_agent_request_new(struct sms_agent *agent,
struct sms_agent_request *req;
req = g_try_new0(struct sms_agent_request, 1);
- if (!req)
+ if (req == NULL)
return NULL;
req->agent = agent;
@@ -99,7 +99,7 @@ static void sms_agent_send_noreply(struct sms_agent *agent, const char *method)
message = dbus_message_new_method_call(agent->service, agent->path,
agent->interface, method);
- if (!message)
+ if (message == NULL)
return;
dbus_message_set_no_reply(message, TRUE);
@@ -130,7 +130,7 @@ struct sms_agent *sms_agent_new(const char *interface,
struct sms_agent *agent = g_try_new0(struct sms_agent, 1);
DBusConnection *conn = ofono_dbus_get_connection();
- if (!agent)
+ if (agent == NULL)
return NULL;
agent->interface = g_strdup(interface);
@@ -164,7 +164,7 @@ void sms_agent_free(struct sms_agent *agent)
{
DBusConnection *conn = ofono_dbus_get_connection();
- if (!agent)
+ if (agent == NULL)
return;
if (agent->disconnect_watch) {
@@ -266,12 +266,12 @@ int sms_agent_dispatch_datagram(struct sms_agent *agent, const char *method,
const char *str = buf;
req = sms_agent_request_new(agent, cb, user_data, destroy);
- if (!req)
+ if (req == NULL)
return -ENOMEM;
req->msg = dbus_message_new_method_call(agent->service, agent->path,
agent->interface, method);
- if (!req->msg) {
+ if (req->msg == NULL) {
sms_agent_request_free(req);
return -ENOMEM;
}
diff --git a/src/smsutil.c b/src/smsutil.c
index e6dbf5f..41169d9 100644
--- a/src/smsutil.c
+++ b/src/smsutil.c
@@ -526,7 +526,7 @@ gboolean sms_encode_address_field(const struct sms_address *in, gboolean sc,
gsm = convert_utf8_to_gsm(in->address, len, NULL, &written, 0);
- if (!gsm)
+ if (gsm == NULL)
return FALSE;
r = pack_7bit_own_buf(gsm, written, 0, FALSE, &packed, 0, p);
@@ -641,14 +641,14 @@ gboolean sms_decode_address_field(const unsigned char *pdu, int len,
*offset = *offset + (addr_len + 1) / 2;
- if (!res)
+ if (res == NULL)
return FALSE;
utf8 = convert_gsm_to_utf8(res, written, NULL, NULL, 0);
g_free(res);
- if (!utf8)
+ if (utf8 == NULL)
return FALSE;
if (strlen(utf8) > 20) {
@@ -1504,7 +1504,7 @@ gboolean sms_decode(const unsigned char *pdu, int len, gboolean outgoing,
unsigned char type;
int offset = 0;
- if (!out)
+ if (out == NULL)
return FALSE;
if (len == 0)
@@ -1617,7 +1617,7 @@ const guint8 *sms_extract_common(const struct sms *sms, gboolean *out_udhi,
break;
};
- if (!ud)
+ if (ud == NULL)
return NULL;
if (out_udhi)
@@ -1683,7 +1683,7 @@ gboolean sms_udh_iter_init(const struct sms *sms, struct sms_udh_iter *iter)
hdr = sms_extract_common(sms, &udhi, &dcs, &udl, &max_ud_len);
- if (!hdr)
+ if (hdr == NULL)
return FALSE;
if (!udhi)
@@ -2123,7 +2123,7 @@ unsigned char *sms_decode_datagram(GSList *sms_list, long *out_len)
ud = sms_extract_common(sms, NULL, NULL, &udl, NULL);
- if (!ud)
+ if (ud == NULL)
return NULL;
/*
@@ -2142,7 +2142,7 @@ unsigned char *sms_decode_datagram(GSList *sms_list, long *out_len)
buf = g_try_new(unsigned char, len);
- if (!buf)
+ if (buf == NULL)
return NULL;
len = 0;
@@ -2417,7 +2417,7 @@ static gboolean sms_assembly_store(struct sms_assembly *assembly,
int len;
DECLARE_SMS_ADDR_STR(straddr);
- if (!assembly->imsi)
+ if (assembly->imsi == NULL)
return FALSE;
if (sms_address_to_hex_string(&node->addr, straddr) == FALSE)
@@ -2440,7 +2440,7 @@ static void sms_assembly_backup_free(struct sms_assembly *assembly,
int seq;
DECLARE_SMS_ADDR_STR(straddr);
- if (!assembly->imsi)
+ if (assembly->imsi == NULL)
return;
if (sms_address_to_hex_string(&node->addr, straddr) == FALSE)
@@ -2800,7 +2800,7 @@ static gboolean sr_assembly_add_fragment_backup(const char *imsi,
DECLARE_SMS_ADDR_STR(straddr);
char msgid_str[SMS_MSGID_LEN * 2 + 1];
- if (!imsi)
+ if (imsi == NULL)
return FALSE;
if (sms_address_to_hex_string(addr, straddr) == FALSE)
@@ -2826,7 +2826,7 @@ static gboolean sr_assembly_remove_fragment_backup(const char *imsi,
DECLARE_SMS_ADDR_STR(straddr);
char msgid_str[SMS_MSGID_LEN * 2 + 1];
- if (!imsi)
+ if (imsi == NULL)
return FALSE;
if (sms_address_to_hex_string(addr, straddr) == FALSE)
@@ -3297,7 +3297,7 @@ GSList *sms_text_prepare(const char *to, const char *utf8, guint16 ref,
/* UDHI, UDL, UD and DCS actually depend on what we have in the text */
gsm_encoded = convert_utf8_to_gsm(utf8, -1, NULL, &written, 0);
- if (!gsm_encoded) {
+ if (gsm_encoded == NULL) {
gsize converted;
ucs2_encoded = g_convert(utf8, -1, "UCS-2BE//TRANSLIT", "UTF-8",
@@ -3305,7 +3305,7 @@ GSList *sms_text_prepare(const char *to, const char *utf8, guint16 ref,
written = converted;
}
- if (!gsm_encoded && !ucs2_encoded)
+ if (gsm_encoded == NULL && ucs2_encoded == NULL)
return NULL;
if (gsm_encoded)
@@ -4370,7 +4370,7 @@ static gint cbs_topic_compare(gconstpointer a, gconstpointer b)
gboolean cbs_topic_in_range(unsigned int topic, GSList *ranges)
{
- if (!ranges)
+ if (ranges == NULL)
return FALSE;
return g_slist_find_custom(ranges, GUINT_TO_POINTER(topic),
@@ -4427,11 +4427,11 @@ gboolean ussd_encode(const char *str, long *items_written, unsigned char *pdu)
long written;
long num_packed;
- if (!pdu)
+ if (pdu == NULL)
return FALSE;
converted = convert_utf8_to_gsm(str, -1, NULL, &written, 0);
- if (!converted || written > 182) {
+ if (converted == NULL || written > 182) {
g_free(converted);
return FALSE;
}
diff --git a/src/stk.c b/src/stk.c
index 88b162c..a4abb7d 100644
--- a/src/stk.c
+++ b/src/stk.c
@@ -116,7 +116,7 @@ static int stk_respond(struct ofono_stk *stk, struct stk_response *rsp,
rsp->qualifier = stk->pending_cmd->qualifier;
tlv = stk_pdu_from_response(rsp, &tlv_len);
- if (!tlv)
+ if (tlv == NULL)
return -EINVAL;
stk_command_free(stk->pending_cmd);
@@ -208,7 +208,7 @@ static int stk_send_envelope(struct ofono_stk *stk, struct stk_envelope *e,
e->dst = STK_DEVICE_IDENTITY_TYPE_UICC;
tlv = stk_pdu_from_envelope(e, &tlv_len);
- if (!tlv)
+ if (tlv == NULL)
return -EINVAL;
op = g_new0(struct envelope_op, 1);
@@ -342,7 +342,7 @@ static struct stk_menu *stk_menu_create(const char *title,
ret->title = dbus_apply_text_attributes(title ? title : "",
title_attr);
- if (!ret->title)
+ if (ret->title == NULL)
ret->title = g_strdup(title ? title : "");
memcpy(&ret->icon, icon, sizeof(ret->icon));
@@ -366,7 +366,7 @@ static struct stk_menu *stk_menu_create(const char *title,
text = dbus_apply_text_attributes(item->text, &attr);
}
- if (!text)
+ if (text == NULL)
text = strdup(item->text);
ret->items[i].text = text;
@@ -451,7 +451,7 @@ static void emit_menu_changed(struct ofono_stk *stk)
signal = dbus_message_new_signal(path, OFONO_STK_INTERFACE,
"PropertyChanged");
- if (!signal) {
+ if (signal == NULL) {
ofono_error("Unable to allocate new %s.PropertyChanged signal",
OFONO_SIM_APP_INTERFACE);
@@ -510,7 +510,7 @@ static DBusMessage *stk_get_properties(DBusConnection *conn,
unsigned char icon;
reply = dbus_message_new_method_return(msg);
- if (!reply)
+ if (reply == NULL)
return NULL;
dbus_message_iter_init_append(reply, &iter);
@@ -632,13 +632,13 @@ static DBusMessage *stk_register_agent(DBusConnection *conn,
stk->default_agent = stk_agent_new(agent_path,
dbus_message_get_sender(msg),
FALSE);
- if (!stk->default_agent)
+ if (stk->default_agent == NULL)
return __ofono_error_failed(msg);
stk_agent_set_removed_notify(stk->default_agent,
default_agent_notify, stk);
- if (!stk->session_agent)
+ if (stk->session_agent == NULL)
stk->current_agent = stk->default_agent;
return dbus_message_new_method_return(msg);
@@ -656,7 +656,7 @@ static DBusMessage *stk_unregister_agent(DBusConnection *conn,
DBUS_TYPE_INVALID) == FALSE)
return __ofono_error_invalid_args(msg);
- if (!stk->default_agent)
+ if (stk->default_agent == NULL)
return __ofono_error_failed(msg);
if (!stk_agent_matches(stk->default_agent, agent_path, agent_bus))
@@ -698,7 +698,7 @@ static void menu_selection_envelope_cb(struct ofono_stk *stk, gboolean ok,
stk->session_agent = stk_agent_new(agent_path,
dbus_message_get_sender(stk->pending),
TRUE);
- if (!stk->session_agent) {
+ if (stk->session_agent == NULL) {
reply = __ofono_error_failed(stk->pending);
goto out;
@@ -729,7 +729,7 @@ static DBusMessage *stk_select_item(DBusConnection *conn,
if (stk->pending || stk->session_agent)
return __ofono_error_busy(msg);
- if (!menu)
+ if (menu == NULL)
return __ofono_error_not_supported(msg);
if (dbus_message_get_args(msg, NULL,
@@ -838,7 +838,7 @@ static gboolean handle_command_send_sms(const struct stk_command *cmd,
sms_atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_SMS);
- if (!sms_atom || !__ofono_atom_get_registered(sms_atom)) {
+ if (sms_atom == NULL || !__ofono_atom_get_registered(sms_atom)) {
rsp->result.type = STK_RESULT_TYPE_NOT_CAPABLE;
return TRUE;
}
@@ -879,7 +879,7 @@ static gboolean handle_command_set_idle_text(const struct stk_command *cmd,
cmd->setup_idle_mode_text.text,
&cmd->setup_idle_mode_text.text_attr);
- if (!idle_mode_text) {
+ if (idle_mode_text == NULL) {
rsp->result.type = STK_RESULT_TYPE_DATA_NOT_UNDERSTOOD;
return TRUE;
}
@@ -1168,7 +1168,7 @@ static gboolean handle_command_select_item(const struct stk_command *cmd,
{
stk->select_item_menu = stk_menu_create_from_select_item(cmd);
- if (!stk->select_item_menu) {
+ if (stk->select_item_menu == NULL) {
rsp->result.type = STK_RESULT_TYPE_DATA_NOT_UNDERSTOOD;
return TRUE;
@@ -1268,7 +1268,7 @@ static gboolean handle_command_display_text(const struct stk_command *cmd,
char *text = dbus_apply_text_attributes(dt->text, &dt->text_attr);
int err;
- if (!text) {
+ if (text == NULL) {
rsp->result.type = STK_RESULT_TYPE_DATA_NOT_UNDERSTOOD;
return TRUE;
}
@@ -1430,7 +1430,7 @@ static gboolean handle_command_get_inkey(const struct stk_command *cmd,
*/
int err;
- if (!text) {
+ if (text == NULL) {
rsp->result.type = STK_RESULT_TYPE_DATA_NOT_UNDERSTOOD;
return TRUE;
}
@@ -1523,7 +1523,7 @@ static gboolean handle_command_get_input(const struct stk_command *cmd,
gboolean hidden = (qualifier & (1 << 2)) != 0;
int err;
- if (!text) {
+ if (text == NULL) {
rsp->result.type = STK_RESULT_TYPE_DATA_NOT_UNDERSTOOD;
return TRUE;
}
@@ -1567,7 +1567,7 @@ static void call_setup_connected(struct ofono_call *call, void *data)
static struct ofono_error error = { .type = OFONO_ERROR_TYPE_FAILURE };
static unsigned char facility_rejected_result[] = { 0x9d };
- if (!call || call->status == CALL_STATUS_DISCONNECTED) {
+ if (call == NULL || call->status == CALL_STATUS_DISCONNECTED) {
memset(&rsp, 0, sizeof(rsp));
rsp.result.type = STK_RESULT_TYPE_NETWORK_UNAVAILABLE;
@@ -1593,7 +1593,7 @@ static void call_setup_cancel(struct ofono_stk *stk)
vc_atom = __ofono_modem_find_atom(__ofono_atom_get_modem(stk->atom),
OFONO_ATOM_TYPE_VOICECALL);
- if (!vc_atom)
+ if (vc_atom == NULL)
return;
vc = __ofono_atom_get_data(vc_atom);
@@ -1641,7 +1641,7 @@ static void confirm_call_cb(enum stk_agent_result result, gboolean confirm,
if (vc_atom)
vc = __ofono_atom_get_data(vc_atom);
- if (!vc) {
+ if (vc == NULL) {
send_simple_response(stk, STK_RESULT_TYPE_NOT_CAPABLE);
return;
}
@@ -1649,7 +1649,7 @@ static void confirm_call_cb(enum stk_agent_result result, gboolean confirm,
if (sc->alpha_id_call_setup) {
alpha_id = dbus_apply_text_attributes(sc->alpha_id_call_setup,
&sc->text_attr_call_setup);
- if (!alpha_id) {
+ if (alpha_id == NULL) {
send_simple_response(stk,
STK_RESULT_TYPE_DATA_NOT_UNDERSTOOD);
return;
@@ -1728,7 +1728,7 @@ static gboolean handle_command_set_up_call(const struct stk_command *cmd,
if (vc_atom)
vc = __ofono_atom_get_data(vc_atom);
- if (!vc) {
+ if (vc == NULL) {
rsp->result.type = STK_RESULT_TYPE_NOT_CAPABLE;
return TRUE;
}
@@ -1743,7 +1743,7 @@ static gboolean handle_command_set_up_call(const struct stk_command *cmd,
if (sc->alpha_id_usr_cfm) {
alpha_id = dbus_apply_text_attributes(sc->alpha_id_usr_cfm,
&sc->text_attr_usr_cfm);
- if (!alpha_id) {
+ if (alpha_id == NULL) {
rsp->result.type = STK_RESULT_TYPE_DATA_NOT_UNDERSTOOD;
return TRUE;
}
@@ -1776,7 +1776,7 @@ static void send_ussd_cancel(struct ofono_stk *stk)
atom = __ofono_modem_find_atom(__ofono_atom_get_modem(stk->atom),
OFONO_ATOM_TYPE_USSD);
- if (!atom)
+ if (atom == NULL)
return;
ussd = __ofono_atom_get_data(atom);
@@ -1891,7 +1891,7 @@ static gboolean handle_command_send_ussd(const struct stk_command *cmd,
}
atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_USSD);
- if (!atom || !__ofono_atom_get_registered(atom)) {
+ if (atom == NULL || !__ofono_atom_get_registered(atom)) {
rsp->result.type = STK_RESULT_TYPE_NOT_CAPABLE;
return TRUE;
}
@@ -2062,7 +2062,7 @@ static gboolean handle_command_send_dtmf(const struct stk_command *cmd,
if (vc_atom)
vc = __ofono_atom_get_data(vc_atom);
- if (!vc) {
+ if (vc == NULL) {
rsp->result.type = STK_RESULT_TYPE_NOT_CAPABLE;
return TRUE;
}
@@ -2070,7 +2070,7 @@ static gboolean handle_command_send_dtmf(const struct stk_command *cmd,
/* Convert the DTMF string to phone number format */
for (pos = 0; cmd->send_dtmf.dtmf[pos] != '\0'; pos++) {
digit = strchr(dtmf_from, cmd->send_dtmf.dtmf[pos]);
- if (!digit) {
+ if (digit == NULL) {
rsp->result.type = STK_RESULT_TYPE_DATA_NOT_UNDERSTOOD;
return TRUE;
}
@@ -2205,7 +2205,7 @@ static gboolean handle_command_play_tone(const struct stk_command *cmd,
int err;
if (pt->tone > sizeof(tone_infos) / sizeof(*tone_infos) ||
- !tone_infos[pt->tone].name) {
+ tone_infos[pt->tone].name == NULL) {
rsp->result.type = STK_RESULT_TYPE_DATA_NOT_UNDERSTOOD;
return TRUE;
@@ -2213,7 +2213,7 @@ static gboolean handle_command_play_tone(const struct stk_command *cmd,
text = dbus_apply_text_attributes(pt->alpha_id ? pt->alpha_id : "",
&pt->text_attr);
- if (!text) {
+ if (text == NULL) {
rsp->result.type = STK_RESULT_TYPE_DATA_NOT_UNDERSTOOD;
return TRUE;
@@ -2299,7 +2299,7 @@ void ofono_stk_proactive_command_notify(struct ofono_stk *stk,
stk_proactive_command_cancel(stk);
stk->pending_cmd = stk_command_new_from_pdu(pdu, length);
- if (!stk->pending_cmd) {
+ if (stk->pending_cmd == NULL) {
ofono_error("Can't parse proactive command");
/*
@@ -2472,7 +2472,7 @@ void ofono_stk_proactive_command_handled_notify(struct ofono_stk *stk,
cmd = stk_command_new_from_pdu(pdu, length);
- if (!cmd || cmd->status != STK_PARSE_RESULT_OK) {
+ if (cmd == NULL || cmd->status != STK_PARSE_RESULT_OK) {
ofono_error("Can't parse proactive command");
if (cmd)
diff --git a/src/stkagent.c b/src/stkagent.c
index 5cf83e4..8315040 100644
--- a/src/stkagent.c
+++ b/src/stkagent.c
@@ -218,7 +218,7 @@ struct stk_agent *stk_agent_new(const char *path, const char *sender,
struct stk_agent *agent = g_try_new0(struct stk_agent, 1);
DBusConnection *conn = ofono_dbus_get_connection();
- if (!agent)
+ if (agent == NULL)
return NULL;
agent->path = g_strdup(path);
diff --git a/src/stkutil.c b/src/stkutil.c
index 9f3d505..a211462 100644
--- a/src/stkutil.c
+++ b/src/stkutil.c
@@ -2337,7 +2337,7 @@ static enum stk_command_parse_result parse_dataobj(
}
}
- if (!l2) {
+ if (l2 == NULL) {
if (comprehension_tlv_get_cr(iter) == TRUE)
parse_error = TRUE;
@@ -4145,7 +4145,7 @@ static gboolean build_dataobj_text(struct stk_tlv_builder *tlv,
unsigned char tag = STK_DATA_OBJECT_TYPE_TEXT;
gboolean ret;
- if (!text->text && !text->yesno)
+ if (text->text == NULL && !text->yesno)
return TRUE;
if (stk_tlv_builder_open_container(tlv, cr, tag, TRUE) != TRUE)
diff --git a/src/ussd.c b/src/ussd.c
index c4de177..6f3e38f 100644
--- a/src/ussd.c
+++ b/src/ussd.c
@@ -76,7 +76,7 @@ struct ssc_entry {
gboolean __ofono_ussd_is_busy(struct ofono_ussd *ussd)
{
- if (!ussd)
+ if (ussd == NULL)
return FALSE;
if (ussd->pending || ussd->state != USSD_STATE_IDLE || ussd->req)
@@ -92,7 +92,7 @@ static struct ssc_entry *ssc_entry_create(const char *sc, void *cb, void *data,
r = g_try_new0(struct ssc_entry, 1);
- if (!r)
+ if (r == NULL)
return r;
r->service = g_strdup(sc);
@@ -125,12 +125,12 @@ gboolean __ofono_ussd_ssc_register(struct ofono_ussd *ussd, const char *sc,
{
struct ssc_entry *entry;
- if (!ussd)
+ if (ussd == NULL)
return FALSE;
entry = ssc_entry_create(sc, cb, data, destroy);
- if (!entry)
+ if (entry == NULL)
return FALSE;
ussd->ss_control_list = g_slist_prepend(ussd->ss_control_list, entry);
@@ -142,13 +142,13 @@ void __ofono_ussd_ssc_unregister(struct ofono_ussd *ussd, const char *sc)
{
GSList *l;
- if (!ussd)
+ if (ussd == NULL)
return;
l = g_slist_find_custom(ussd->ss_control_list, sc,
ssc_entry_find_by_service);
- if (!l)
+ if (l == NULL)
return;
ssc_entry_destroy(l->data);
@@ -161,12 +161,12 @@ gboolean __ofono_ussd_passwd_register(struct ofono_ussd *ussd, const char *sc,
{
struct ssc_entry *entry;
- if (!ussd)
+ if (ussd == NULL)
return FALSE;
entry = ssc_entry_create(sc, cb, data, destroy);
- if (!entry)
+ if (entry == NULL)
return FALSE;
ussd->ss_passwd_list = g_slist_prepend(ussd->ss_passwd_list, entry);
@@ -178,13 +178,13 @@ void __ofono_ussd_passwd_unregister(struct ofono_ussd *ussd, const char *sc)
{
GSList *l;
- if (!ussd)
+ if (ussd == NULL)
return;
l = g_slist_find_custom(ussd->ss_passwd_list, sc,
ssc_entry_find_by_service);
- if (!l)
+ if (l == NULL)
return;
ssc_entry_destroy(l->data);
@@ -420,7 +420,7 @@ void ofono_ussd_notify(struct ofono_ussd *ussd, int status, int dcs,
if (status == OFONO_USSD_STATUS_NOT_SUPPORTED) {
ussd_change_state(ussd, USSD_STATE_IDLE);
- if (!ussd->pending)
+ if (ussd->pending == NULL)
return;
reply = __ofono_error_not_supported(ussd->pending);
@@ -430,7 +430,7 @@ void ofono_ussd_notify(struct ofono_ussd *ussd, int status, int dcs,
if (status == OFONO_USSD_STATUS_TIMED_OUT) {
ussd_change_state(ussd, USSD_STATE_IDLE);
- if (!ussd->pending)
+ if (ussd->pending == NULL)
return;
reply = __ofono_error_timed_out(ussd->pending);
@@ -447,7 +447,7 @@ void ofono_ussd_notify(struct ofono_ussd *ussd, int status, int dcs,
reply = dbus_message_new_method_return(ussd->pending);
- if (!str)
+ if (str == NULL)
str = "";
dbus_message_iter_init_append(reply, &iter);
@@ -471,7 +471,7 @@ void ofono_ussd_notify(struct ofono_ussd *ussd, int status, int dcs,
} else if (ussd->state == USSD_STATE_RESPONSE_SENT) {
reply = dbus_message_new_method_return(ussd->pending);
- if (!str)
+ if (str == NULL)
str = "";
dbus_message_append_args(reply, DBUS_TYPE_STRING, &str,
@@ -494,7 +494,7 @@ void ofono_ussd_notify(struct ofono_ussd *ussd, int status, int dcs,
signal_name = "NotificationReceived";
}
- if (!str)
+ if (str == NULL)
str = "";
g_dbus_emit_signal(conn, path,
@@ -534,7 +534,7 @@ static void ussd_callback(const struct ofono_error *error, void *data)
return;
}
- if (!ussd->pending)
+ if (ussd->pending == NULL)
return;
reply = __ofono_error_failed(ussd->pending);
@@ -583,7 +583,7 @@ static DBusMessage *ussd_initiate(DBusConnection *conn, DBusMessage *msg,
if (!ussd_encode(str, &num_packed, buf))
return __ofono_error_invalid_format(msg);
- if (!ussd->driver->request)
+ if (ussd->driver->request == NULL)
return __ofono_error_not_implemented(msg);
DBG("OK, running USSD request");
@@ -609,7 +609,7 @@ static void ussd_response_callback(const struct ofono_error *error, void *data)
return;
}
- if (!ussd->pending)
+ if (ussd->pending == NULL)
return;
reply = __ofono_error_failed(ussd->pending);
@@ -641,7 +641,7 @@ static DBusMessage *ussd_respond(DBusConnection *conn, DBusMessage *msg,
if (!ussd_encode(str, &num_packed, buf))
return __ofono_error_invalid_format(msg);
- if (!ussd->driver->request)
+ if (ussd->driver->request == NULL)
return __ofono_error_not_implemented(msg);
ussd->pending = dbus_message_ref(msg);
@@ -696,7 +696,7 @@ static DBusMessage *ussd_cancel(DBusConnection *conn, DBusMessage *msg,
if (ussd->cancel)
return __ofono_error_busy(msg);
- if (!ussd->driver->cancel)
+ if (ussd->driver->cancel == NULL)
return __ofono_error_not_implemented(msg);
ussd->cancel = dbus_message_ref(msg);
@@ -716,7 +716,7 @@ static DBusMessage *ussd_get_properties(DBusConnection *conn,
const char *value;
reply = dbus_message_new_method_return(msg);
- if (!reply)
+ if (reply == NULL)
return NULL;
dbus_message_iter_init_append(reply, &iter);
@@ -893,7 +893,7 @@ int __ofono_ussd_initiate(struct ofono_ussd *ussd, int dcs,
{
struct ussd_request *req;
- if (!ussd->driver->request)
+ if (ussd->driver->request == NULL)
return -ENOSYS;
if (__ofono_ussd_is_busy(ussd))
@@ -915,7 +915,7 @@ int __ofono_ussd_initiate(struct ofono_ussd *ussd, int dcs,
void __ofono_ussd_initiate_cancel(struct ofono_ussd *ussd)
{
- if (!ussd->req || !ussd->req->cb)
+ if (ussd->req == NULL || ussd->req->cb == NULL)
return;
ussd->req->cb = NULL;
diff --git a/src/util.c b/src/util.c
index 4421c3d..fa732b4 100644
--- a/src/util.c
+++ b/src/util.c
@@ -590,7 +590,7 @@ char *convert_gsm_to_utf8_with_lang(const unsigned char *text, long len,
res = g_try_malloc(res_length + 1);
- if (!res)
+ if (res == NULL)
goto error;
out = res;
@@ -694,7 +694,7 @@ unsigned char *convert_utf8_to_gsm_with_lang(const char *text, long len,
res = g_try_malloc(res_len + (terminator ? 1 : 0));
- if (!res)
+ if (res == NULL)
goto err_out;
in = text;
@@ -1060,7 +1060,7 @@ unsigned char *pack_7bit(const unsigned char *in, long len, int byte_offset,
long total_bits;
unsigned char *buf;
- if (len == 0 || !items_written)
+ if (len == 0 || items_written == NULL)
return NULL;
if (len < 0) {
@@ -1198,7 +1198,7 @@ char *sim_string_to_utf8(const unsigned char *buffer, int length)
utf8 = g_try_malloc(res_len + 1);
- if (!utf8)
+ if (utf8 == NULL)
return NULL;
i = offset;
@@ -1248,14 +1248,14 @@ unsigned char *utf8_to_sim_string(const char *utf,
ucs2 = (guint8 *) g_convert(utf, -1, "UCS-2BE//TRANSLIT", "UTF-8",
NULL, &converted, NULL);
- if (!ucs2)
+ if (ucs2 == NULL)
return NULL;
if (max_length != -1 && (int) converted + 1 > max_length)
converted = (max_length - 1) & ~1;
result = g_try_malloc(converted + 1);
- if (!result) {
+ if (result == NULL) {
g_free(ucs2);
return NULL;
}
@@ -1329,7 +1329,7 @@ unsigned char *convert_ucs2_to_gsm_with_lang(const unsigned char *text,
}
res = g_try_malloc(res_len + (terminator ? 1 : 0));
- if (!res)
+ if (res == NULL)
goto err_out;
in = text;
diff --git a/src/voicecall.c b/src/voicecall.c
index a91f14f..2e0b4ea 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -370,7 +370,7 @@ static DBusMessage *voicecall_get_properties(DBusConnection *conn,
reply = dbus_message_new_method_return(msg);
- if (!reply)
+ if (reply == NULL)
return NULL;
dbus_message_iter_init_append(reply, &iter);
@@ -398,7 +398,7 @@ static DBusMessage *voicecall_deflect(DBusConnection *conn,
call->status != CALL_STATUS_WAITING)
return __ofono_error_failed(msg);
- if (!vc->driver->deflect)
+ if (vc->driver->deflect == NULL)
return __ofono_error_not_implemented(msg);
if (vc->pending)
@@ -423,10 +423,10 @@ static DBusMessage *voicecall_deflect(DBusConnection *conn,
static void dial_request_user_cancel(struct ofono_voicecall *vc,
struct voicecall *call)
{
- if (!vc->dial_req)
+ if (vc->dial_req == NULL)
return;
- if (!call || call == vc->dial_req->call)
+ if (call == NULL || call == vc->dial_req->call)
dial_request_finish(vc);
}
@@ -533,7 +533,7 @@ static DBusMessage *voicecall_answer(DBusConnection *conn,
if (call->status != CALL_STATUS_INCOMING)
return __ofono_error_failed(msg);
- if (!vc->driver->answer)
+ if (vc->driver->answer == NULL)
return __ofono_error_not_implemented(msg);
if (vc->pending)
@@ -570,7 +570,7 @@ static struct voicecall *voicecall_create(struct ofono_voicecall *vc,
v = g_try_new0(struct voicecall, 1);
- if (!v)
+ if (v == NULL)
return NULL;
v->call = call;
@@ -729,7 +729,7 @@ static gboolean voicecall_dbus_register(struct voicecall *v)
DBusConnection *conn = ofono_dbus_get_connection();
const char *path;
- if (!v)
+ if (v == NULL)
return FALSE;
path = voicecall_build_path(v->vc, v->call);
@@ -879,10 +879,10 @@ static void voicecalls_multiparty_changed(GSList *old, GSList *new)
nc = n ? n->data : NULL;
oc = o ? o->data : NULL;
- if (oc && (!nc || (nc->call->id > oc->call->id))) {
+ if (oc && (nc == NULL || (nc->call->id > oc->call->id))) {
voicecall_emit_multiparty(oc, FALSE);
o = o->next;
- } else if (nc && (!oc || (nc->call->id < oc->call->id))) {
+ } else if (nc && (oc == NULL || (nc->call->id < oc->call->id))) {
voicecall_emit_multiparty(nc, TRUE);
n = n->next;
} else {
@@ -957,7 +957,7 @@ static void voicecalls_release_next(struct ofono_voicecall *vc)
{
struct voicecall *call;
- if (!vc->release_list)
+ if (vc->release_list == NULL)
return;
call = vc->release_list->data;
@@ -998,7 +998,7 @@ static DBusMessage *manager_get_properties(DBusConnection *conn,
reply = dbus_message_new_method_return(msg);
- if (!reply)
+ if (reply == NULL)
return NULL;
dbus_message_iter_init_append(reply, &iter);
@@ -1047,7 +1047,7 @@ static struct ofono_call *synthesize_outgoing_call(struct ofono_voicecall *vc,
call = g_try_new0(struct ofono_call, 1);
- if (!call)
+ if (call == NULL)
return call;
call->id = __ofono_modem_callid_next(modem);
@@ -1102,11 +1102,11 @@ static struct voicecall *dial_handle_result(struct ofono_voicecall *vc,
}
call = synthesize_outgoing_call(vc, number);
- if (!call)
+ if (call == NULL)
return NULL;
v = voicecall_create(vc, call);
- if (!v)
+ if (v == NULL)
return NULL;
v->detect_time = time(NULL);
@@ -1178,7 +1178,7 @@ static DBusMessage *manager_dial(DBusConnection *conn,
if (clir_string_to_clir(clirstr, &clir) == FALSE)
return __ofono_error_invalid_format(msg);
- if (!vc->driver->dial)
+ if (vc->driver->dial == NULL)
return __ofono_error_not_implemented(msg);
if (voicecalls_have_incoming(vc))
@@ -1225,7 +1225,7 @@ static DBusMessage *manager_transfer(DBusConnection *conn,
if ((numactive != 1) && (numheld != 1))
return __ofono_error_failed(msg);
- if (!vc->driver->transfer)
+ if (vc->driver->transfer == NULL)
return __ofono_error_not_implemented(msg);
vc->pending = dbus_message_ref(msg);
@@ -1265,7 +1265,7 @@ static DBusMessage *manager_swap_calls(DBusConnection *conn,
if (voicecalls_have_waiting(vc))
return __ofono_error_failed(msg);
- if (!vc->driver->hold_all_active)
+ if (vc->driver->hold_all_active == NULL)
return __ofono_error_not_implemented(msg);
vc->pending = dbus_message_ref(msg);
@@ -1286,7 +1286,7 @@ static DBusMessage *manager_release_and_answer(DBusConnection *conn,
if (!voicecalls_have_waiting(vc))
return __ofono_error_failed(msg);
- if (!vc->driver->release_all_active)
+ if (vc->driver->release_all_active == NULL)
return __ofono_error_not_implemented(msg);
vc->pending = dbus_message_ref(msg);
@@ -1314,7 +1314,7 @@ static DBusMessage *manager_hold_and_answer(DBusConnection *conn,
if (voicecalls_have_active(vc) && voicecalls_have_held(vc))
return __ofono_error_failed(msg);
- if (!vc->driver->hold_all_active)
+ if (vc->driver->hold_all_active == NULL)
return __ofono_error_not_implemented(msg);
vc->pending = dbus_message_ref(msg);
@@ -1448,7 +1448,7 @@ static DBusMessage *multiparty_private_chat(DBusConnection *conn,
c = strrchr(callpath, '/');
- if (!c || strncmp(path, callpath, c-callpath))
+ if (c == NULL || strncmp(path, callpath, c-callpath))
return __ofono_error_not_found(msg);
if (!sscanf(c, "/voicecall%2u", &id))
@@ -1460,7 +1460,7 @@ static DBusMessage *multiparty_private_chat(DBusConnection *conn,
break;
}
- if (!l)
+ if (l == NULL)
return __ofono_error_not_found(msg);
/*
@@ -1471,7 +1471,7 @@ static DBusMessage *multiparty_private_chat(DBusConnection *conn,
if (voicecalls_have_held(vc))
return __ofono_error_failed(msg);
- if (!vc->driver->private_chat)
+ if (vc->driver->private_chat == NULL)
return __ofono_error_not_implemented(msg);
vc->pending = dbus_message_ref(msg);
@@ -1540,7 +1540,7 @@ static DBusMessage *multiparty_create(DBusConnection *conn,
if (!voicecalls_have_held(vc) || !voicecalls_have_active(vc))
return __ofono_error_failed(msg);
- if (!vc->driver->create_multiparty)
+ if (vc->driver->create_multiparty == NULL)
return __ofono_error_not_implemented(msg);
vc->pending = dbus_message_ref(msg);
@@ -1558,13 +1558,13 @@ static DBusMessage *multiparty_hangup(DBusConnection *conn,
if (vc->pending)
return __ofono_error_busy(msg);
- if (!vc->driver->release_specific)
+ if (vc->driver->release_specific == NULL)
return __ofono_error_not_implemented(msg);
- if (!vc->driver->release_all_held)
+ if (vc->driver->release_all_held == NULL)
return __ofono_error_not_implemented(msg);
- if (!vc->driver->release_all_active)
+ if (vc->driver->release_all_active == NULL)
return __ofono_error_not_implemented(msg);
if (vc->multiparty_list == NULL) {
@@ -1628,7 +1628,7 @@ static DBusMessage *manager_tone(DBusConnection *conn,
if (vc->pending)
return __ofono_error_busy(msg);
- if (!vc->driver->send_tones)
+ if (vc->driver->send_tones == NULL)
return __ofono_error_not_implemented(msg);
/* Send DTMFs only if we have at least one connected call */
@@ -1760,7 +1760,7 @@ void ofono_voicecall_disconnected(struct ofono_voicecall *vc, int id,
l = g_slist_find_custom(vc->call_list, GUINT_TO_POINTER(id),
call_compare_by_id);
- if (!l) {
+ if (l == NULL) {
ofono_error("Plugin notified us of call disconnect for"
" unknown call");
return;
@@ -1839,14 +1839,14 @@ void ofono_voicecall_notify(struct ofono_voicecall *vc,
newcall = g_memdup(call, sizeof(struct ofono_call));
- if (!newcall) {
+ if (newcall == NULL) {
ofono_error("Unable to allocate call");
goto error;
}
v = voicecall_create(vc, newcall);
- if (!v) {
+ if (v == NULL) {
ofono_error("Unable to allocate voicecall_data");
goto error;
}
@@ -2363,7 +2363,7 @@ int __ofono_voicecall_dial(struct ofono_voicecall *vc,
if (!valid_phone_number_format(addr))
return -EINVAL;
- if (!vc->driver->dial)
+ if (vc->driver->dial == NULL)
return -ENOSYS;
if (interaction == OFONO_VOICECALL_INTERACTION_DISCONNECT &&
@@ -2419,7 +2419,7 @@ int __ofono_voicecall_dial(struct ofono_voicecall *vc,
void __ofono_voicecall_dial_cancel(struct ofono_voicecall *vc)
{
- if (!vc->dial_req || !vc->dial_req->cb)
+ if (vc->dial_req == NULL || vc->dial_req->cb == NULL)
return;
vc->dial_req->cb = NULL;
@@ -2431,7 +2431,7 @@ static void tone_request_cb(const struct ofono_error *error, void *data)
struct tone_queue_entry *entry = g_queue_peek_head(vc->toneq);
int len = 0;
- if (!entry)
+ if (entry == NULL)
return;
/*
@@ -2477,7 +2477,7 @@ static gboolean tone_request_run(gpointer user_data)
vc->tone_source = 0;
- if (!entry)
+ if (entry == NULL)
return FALSE;
len = strcspn(entry->left, "pP");
@@ -2504,7 +2504,7 @@ int __ofono_voicecall_tone_send(struct ofono_voicecall *vc,
const char *tone_str,
ofono_voicecall_tone_cb_t cb, void *user_data)
{
- if (!vc->driver->send_tones)
+ if (vc->driver->send_tones == NULL)
return -ENOSYS;
/* Send DTMFs only if we have at least one connected call */
--
1.7.3.2
^ permalink raw reply related [flat|nested] 20+ messages in thread* Re: [PATCH 9/9] core: explicitly compare pointers to NULL
2010-11-27 19:39 ` [PATCH 9/9] core: " Lucas De Marchi
@ 2010-11-29 20:52 ` Denis Kenzior
0 siblings, 0 replies; 20+ messages in thread
From: Denis Kenzior @ 2010-11-29 20:52 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 1958 bytes --]
Hi Lucas,
On 11/27/2010 01:39 PM, Lucas De Marchi wrote:
> 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>
> ---
> src/audio-settings.c | 12 ++++----
> src/call-barring.c | 18 ++++++------
> src/call-forwarding.c | 20 +++++++-------
> src/call-meter.c | 26 +++++++++---------
> src/call-settings.c | 26 +++++++++---------
> src/call-volume.c | 6 ++--
> src/cbs.c | 16 +++++-----
> src/common.c | 2 +-
> src/dbus.c | 8 +++---
> src/gprs.c | 28 ++++++++++----------
> src/history.c | 2 +-
> src/main.c | 2 +-
> src/message-waiting.c | 4 +-
> src/modem.c | 14 +++++-----
> src/nettime.c | 2 +-
> src/network.c | 28 ++++++++++----------
> src/phonebook.c | 10 +++---
> src/plugin.c | 2 +-
> src/radio-settings.c | 20 +++++++-------
> src/sim.c | 16 +++++-----
> src/simfs.c | 28 ++++++++++----------
> src/simutil.c | 16 +++++-----
> src/sms.c | 40 ++++++++++++++--------------
> src/smsagent.c | 12 ++++----
> src/smsutil.c | 34 ++++++++++++------------
> src/stk.c | 62 +++++++++++++++++++++---------------------
> src/stkagent.c | 2 +-
> src/stkutil.c | 4 +-
> src/ussd.c | 46 ++++++++++++++++----------------
> src/util.c | 14 +++++-----
> src/voicecall.c | 70 ++++++++++++++++++++++++------------------------
> 31 files changed, 295 insertions(+), 295 deletions(-)
>
I applied this patch but broke it up into several for the core files I
really want to track separately. Thanks for doing all this.
Regards,
-Denis
^ permalink raw reply [flat|nested] 20+ messages in thread
* Re: [PATCH 1/9] coding-style: add rule about checking NULL pointer
2010-11-27 19:38 [PATCH 1/9] coding-style: add rule about checking NULL pointer Lucas De Marchi
` (7 preceding siblings ...)
2010-11-27 19:39 ` [PATCH 9/9] core: " Lucas De Marchi
@ 2010-11-29 17:49 ` Denis Kenzior
8 siblings, 0 replies; 20+ messages in thread
From: Denis Kenzior @ 2010-11-29 17:49 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 235 bytes --]
Hi Lucas,
On 11/27/2010 01:38 PM, Lucas De Marchi wrote:
> ---
> doc/coding-style.txt | 21 +++++++++++++++++++++
> 1 files changed, 21 insertions(+), 0 deletions(-)
>
Patch has been applied, thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 20+ messages in thread
* [PATCH 2/9] drivers: explicitly compare pointers to NULL
2010-11-27 15:38 [PATCH 0/9] coding-style: explicitly compare pointers to NULL Lucas De Marchi
@ 2010-11-27 15:38 ` Lucas De Marchi
0 siblings, 0 replies; 20+ messages in thread
From: Lucas De Marchi @ 2010-11-27 15:38 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 78356 bytes --]
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>
---
drivers/atmodem/atutil.c | 2 +-
drivers/atmodem/atutil.h | 2 +-
drivers/atmodem/call-barring.c | 6 ++--
drivers/atmodem/call-forwarding.c | 4 +-
drivers/atmodem/call-meter.c | 14 ++++++------
drivers/atmodem/call-settings.c | 14 ++++++------
drivers/atmodem/call-volume.c | 4 +-
drivers/atmodem/cbs.c | 6 ++--
drivers/atmodem/devinfo.c | 8 +++---
drivers/atmodem/gprs-context.c | 2 +-
drivers/atmodem/gprs.c | 6 ++--
drivers/atmodem/network-registration.c | 18 ++++++++--------
drivers/atmodem/phonebook.c | 4 +-
drivers/atmodem/sim-poll.c | 2 +-
drivers/atmodem/sim.c | 32 +++++++++++++++---------------
drivers/atmodem/sms.c | 12 +++++-----
drivers/atmodem/stk.c | 4 +-
drivers/atmodem/ussd.c | 6 ++--
drivers/atmodem/voicecall.c | 24 +++++++++++-----------
drivers/calypsomodem/stk.c | 6 ++--
drivers/calypsomodem/voicecall.c | 6 ++--
drivers/hfpmodem/call-volume.c | 4 +-
drivers/hfpmodem/network-registration.c | 6 ++--
drivers/hfpmodem/voicecall.c | 28 +++++++++++++-------------
drivers/hsomodem/gprs-context.c | 4 +-
drivers/hsomodem/radio-settings.c | 2 +-
drivers/huaweimodem/audio-settings.c | 2 +-
drivers/huaweimodem/gprs-context.c | 6 ++--
drivers/huaweimodem/voicecall.c | 8 +++---
drivers/ifxmodem/audio-settings.c | 2 +-
drivers/ifxmodem/gprs-context.c | 8 +++---
drivers/ifxmodem/radio-settings.c | 2 +-
drivers/ifxmodem/stk.c | 6 ++--
drivers/ifxmodem/voicecall.c | 18 ++++++++--------
drivers/isimodem/audio-settings.c | 6 ++--
drivers/isimodem/call-barring.c | 12 +++++-----
drivers/isimodem/call-forwarding.c | 12 +++++-----
drivers/isimodem/call-meter.c | 4 +-
drivers/isimodem/call-settings.c | 10 ++++----
drivers/isimodem/cbs.c | 9 +++----
drivers/isimodem/devinfo.c | 12 +++++-----
drivers/isimodem/gprs-context.c | 19 +++++++----------
drivers/isimodem/gprs.c | 10 ++++----
drivers/isimodem/infoserver.c | 4 +-
drivers/isimodem/network-registration.c | 22 +++++++++-----------
drivers/isimodem/phonebook.c | 10 ++++----
drivers/isimodem/radio-settings.c | 10 ++++----
drivers/isimodem/sim.c | 12 +++++-----
drivers/isimodem/sms.c | 17 +++++++--------
drivers/isimodem/ssn.c | 6 ++--
drivers/isimodem/ussd.c | 10 ++++----
drivers/isimodem/voicecall.c | 12 ++++------
drivers/mbmmodem/gprs-context.c | 6 ++--
drivers/mbmmodem/stk.c | 6 ++--
drivers/nwmodem/radio-settings.c | 2 +-
drivers/stemodem/gprs-context.c | 14 ++++++------
drivers/stemodem/radio-settings.c | 2 +-
drivers/stemodem/voicecall.c | 16 +++++++-------
58 files changed, 256 insertions(+), 265 deletions(-)
diff --git a/drivers/atmodem/atutil.c b/drivers/atmodem/atutil.c
index fe7cbfc..576094f 100644
--- a/drivers/atmodem/atutil.c
+++ b/drivers/atmodem/atutil.c
@@ -134,7 +134,7 @@ GSList *at_util_parse_clcc(GAtResult *result)
call = g_try_new0(struct ofono_call, 1);
- if (!call)
+ if (call == NULL)
break;
call->id = id;
diff --git a/drivers/atmodem/atutil.h b/drivers/atmodem/atutil.h
index 7dbb8a6..324fb4e 100644
--- a/drivers/atmodem/atutil.h
+++ b/drivers/atmodem/atutil.h
@@ -83,7 +83,7 @@ static inline struct cb_data *cb_data_new(void *cb, void *data)
ret = g_try_new0(struct cb_data, 1);
- if (!ret)
+ if (ret == NULL)
return ret;
ret->cb = cb;
diff --git a/drivers/atmodem/call-barring.c b/drivers/atmodem/call-barring.c
index 50e0eef..c0b1d11 100644
--- a/drivers/atmodem/call-barring.c
+++ b/drivers/atmodem/call-barring.c
@@ -86,7 +86,7 @@ static void at_call_barring_query(struct ofono_call_barring *cb,
struct cb_data *cbd = cb_data_new(callback, data);
char buf[64];
- if (!cbd || strlen(lock) != 2)
+ if (cbd == NULL || strlen(lock) != 2)
goto error;
snprintf(buf, sizeof(buf), "AT+CLCK=\"%s\",2", lock);
@@ -121,7 +121,7 @@ static void at_call_barring_set(struct ofono_call_barring *cb, const char *lock,
char buf[64];
int len;
- if (!cbd || strlen(lock) != 2 || (cls && !passwd))
+ if (cbd == NULL || strlen(lock) != 2 || (cls && passwd == NULL))
goto error;
len = snprintf(buf, sizeof(buf), "AT+CLCK=\"%s\",%i", lock, enable);
@@ -164,7 +164,7 @@ static void at_call_barring_set_passwd(struct ofono_call_barring *cb,
struct cb_data *cbd = cb_data_new(callback, data);
char buf[64];
- if (!cbd || strlen(lock) != 2)
+ if (cbd == NULL || strlen(lock) != 2)
goto error;
snprintf(buf, sizeof(buf), "AT+CPWD=\"%s\",\"%s\",\"%s\"",
diff --git a/drivers/atmodem/call-forwarding.c b/drivers/atmodem/call-forwarding.c
index d20ac2e..a74d4c3 100644
--- a/drivers/atmodem/call-forwarding.c
+++ b/drivers/atmodem/call-forwarding.c
@@ -128,7 +128,7 @@ static void at_ccfc_query(struct ofono_call_forwarding *cf, int type, int cls,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[64];
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = GINT_TO_POINTER(cls);
@@ -165,7 +165,7 @@ static void at_ccfc_set(struct ofono_call_forwarding *cf, const char *buf,
GAtChat *chat = ofono_call_forwarding_get_data(cf);
struct cb_data *cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (g_at_chat_send(chat, buf, none_prefix,
diff --git a/drivers/atmodem/call-meter.c b/drivers/atmodem/call-meter.c
index 28359af..5c93397 100644
--- a/drivers/atmodem/call-meter.c
+++ b/drivers/atmodem/call-meter.c
@@ -116,7 +116,7 @@ static void at_caoc_query(struct ofono_call_meter *cm,
GAtChat *chat = ofono_call_meter_get_data(cm);
struct cb_data *cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = "+CAOC:";
@@ -137,7 +137,7 @@ static void at_cacm_query(struct ofono_call_meter *cm,
GAtChat *chat = ofono_call_meter_get_data(cm);
struct cb_data *cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = "+CACM:";
@@ -169,7 +169,7 @@ static void at_cacm_set(struct ofono_call_meter *cm, const char *passwd,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[64];
- if (!cbd)
+ if (cbd == NULL)
goto error;
snprintf(buf, sizeof(buf), "AT+CACM=\"%s\"", passwd);
@@ -191,7 +191,7 @@ static void at_camm_query(struct ofono_call_meter *cm,
GAtChat *chat = ofono_call_meter_get_data(cm);
struct cb_data *cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = "+CAMM:";
@@ -213,7 +213,7 @@ static void at_camm_set(struct ofono_call_meter *cm,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[64];
- if (!cbd)
+ if (cbd == NULL)
goto error;
snprintf(buf, sizeof(buf), "AT+CAMM=\"%06X\",\"%s\"", accmax, passwd);
@@ -274,7 +274,7 @@ static void at_cpuc_query(struct ofono_call_meter *cm,
GAtChat *chat = ofono_call_meter_get_data(cm);
struct cb_data *cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = "+CPUC:";
@@ -296,7 +296,7 @@ static void at_cpuc_set(struct ofono_call_meter *cm, const char *currency,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[64];
- if (!cbd)
+ if (cbd == NULL)
goto error;
snprintf(buf, sizeof(buf), "AT+CPUC=\"%s\",\"%f\",\"%s\"",
diff --git a/drivers/atmodem/call-settings.c b/drivers/atmodem/call-settings.c
index b5acc02..05c9438 100644
--- a/drivers/atmodem/call-settings.c
+++ b/drivers/atmodem/call-settings.c
@@ -84,7 +84,7 @@ static void at_ccwa_query(struct ofono_call_settings *cs, int cls,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[64];
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = GINT_TO_POINTER(cls);
@@ -122,7 +122,7 @@ static void at_ccwa_set(struct ofono_call_settings *cs, int mode, int cls,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[64];
- if (!cbd)
+ if (cbd == NULL)
goto error;
snprintf(buf, sizeof(buf), "AT+CCWA=1,%d,%d", mode, cls);
@@ -175,7 +175,7 @@ static void at_clip_query(struct ofono_call_settings *cs,
GAtChat *chat = ofono_call_settings_get_data(cs);
struct cb_data *cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (g_at_chat_send(chat, "AT+CLIP?", clip_prefix,
@@ -225,7 +225,7 @@ static void at_colp_query(struct ofono_call_settings *cs,
GAtChat *chat = ofono_call_settings_get_data(cs);
struct cb_data *cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (g_at_chat_send(chat, "AT+COLP?", colp_prefix,
@@ -274,7 +274,7 @@ static void at_clir_query(struct ofono_call_settings *cs,
GAtChat *chat = ofono_call_settings_get_data(cs);
struct cb_data *cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (g_at_chat_send(chat, "AT+CLIR?", clir_prefix,
@@ -305,7 +305,7 @@ static void at_clir_set(struct ofono_call_settings *cs, int mode,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[64];
- if (!cbd)
+ if (cbd == NULL)
goto error;
snprintf(buf, sizeof(buf), "AT+CLIR=%d", mode);
@@ -358,7 +358,7 @@ static void at_colr_query(struct ofono_call_settings *cs,
GAtChat *chat = ofono_call_settings_get_data(cs);
struct cb_data *cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (g_at_chat_send(chat, "AT+COLR", colr_prefix,
diff --git a/drivers/atmodem/call-volume.c b/drivers/atmodem/call-volume.c
index 76d2f96..fbec668 100644
--- a/drivers/atmodem/call-volume.c
+++ b/drivers/atmodem/call-volume.c
@@ -138,7 +138,7 @@ static void at_call_volume_speaker_volume(struct ofono_call_volume *cv,
char buf[64];
int level;
- if (!cbd)
+ if (cbd == NULL)
goto error;
level = ((cvd->clvl_max - cvd->clvl_min) *
@@ -163,7 +163,7 @@ static void at_call_volume_mute(struct ofono_call_volume *cv, int muted,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[64];
- if (!cbd)
+ if (cbd == NULL)
goto error;
snprintf(buf, sizeof(buf), "AT+CMUT=%d", muted);
diff --git a/drivers/atmodem/cbs.c b/drivers/atmodem/cbs.c
index 2ae75fb..17488ef 100644
--- a/drivers/atmodem/cbs.c
+++ b/drivers/atmodem/cbs.c
@@ -75,7 +75,7 @@ static void at_cbm_notify(GAtResult *result, gpointer user_data)
hexpdu = g_at_result_pdu(result);
- if (!hexpdu) {
+ if (hexpdu == NULL) {
ofono_error("Got a CBM, but no PDU. Are we in text mode?");
return;
}
@@ -116,7 +116,7 @@ static void at_cbs_set_topics(struct ofono_cbs *cbs, const char *topics,
DBG("");
- if (!cbd)
+ if (cbd == NULL)
goto error;
/* For the Qualcomm based devices it is required to clear
@@ -155,7 +155,7 @@ static void at_cbs_clear_topics(struct ofono_cbs *cbs,
DBG("");
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (data->cscb_mode_1)
diff --git a/drivers/atmodem/devinfo.c b/drivers/atmodem/devinfo.c
index 4d3cf98..84ff898 100644
--- a/drivers/atmodem/devinfo.c
+++ b/drivers/atmodem/devinfo.c
@@ -92,7 +92,7 @@ static void at_query_manufacturer(struct ofono_devinfo *info,
struct cb_data *cbd = cb_data_new(cb, data);
GAtChat *chat = ofono_devinfo_get_data(info);
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = "+CGMI:";
@@ -113,7 +113,7 @@ static void at_query_model(struct ofono_devinfo *info,
struct cb_data *cbd = cb_data_new(cb, data);
GAtChat *chat = ofono_devinfo_get_data(info);
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = "+CGMM:";
@@ -134,7 +134,7 @@ static void at_query_revision(struct ofono_devinfo *info,
struct cb_data *cbd = cb_data_new(cb, data);
GAtChat *chat = ofono_devinfo_get_data(info);
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = "+CGMR:";
@@ -155,7 +155,7 @@ static void at_query_serial(struct ofono_devinfo *info,
struct cb_data *cbd = cb_data_new(cb, data);
GAtChat *chat = ofono_devinfo_get_data(info);
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = "+CGSN:";
diff --git a/drivers/atmodem/gprs-context.c b/drivers/atmodem/gprs-context.c
index 03c6f46..6b657f3 100644
--- a/drivers/atmodem/gprs-context.c
+++ b/drivers/atmodem/gprs-context.c
@@ -282,7 +282,7 @@ static int at_gprs_context_probe(struct ofono_gprs_context *gc,
}
gcd = g_try_new0(struct gprs_context_data, 1);
- if (!gcd)
+ if (gcd == NULL)
return -ENOMEM;
gcd->chat = g_at_chat_clone(chat);
diff --git a/drivers/atmodem/gprs.c b/drivers/atmodem/gprs.c
index 94247ec..8cff35b 100644
--- a/drivers/atmodem/gprs.c
+++ b/drivers/atmodem/gprs.c
@@ -69,7 +69,7 @@ static void at_gprs_set_attached(struct ofono_gprs *gprs, int attached,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[64];
- if (!cbd)
+ if (cbd == NULL)
goto error;
snprintf(buf, sizeof(buf), "AT+CGATT=%i", attached ? 1 : 0);
@@ -115,7 +115,7 @@ static void at_gprs_registration_status(struct ofono_gprs *gprs,
struct gprs_data *gd = ofono_gprs_get_data(gprs);
struct cb_data *cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = gd;
@@ -350,7 +350,7 @@ static int at_gprs_probe(struct ofono_gprs *gprs,
struct gprs_data *gd;
gd = g_try_new0(struct gprs_data, 1);
- if (!gd)
+ if (gd == NULL)
return -ENOMEM;
gd->chat = g_at_chat_clone(chat);
diff --git a/drivers/atmodem/network-registration.c b/drivers/atmodem/network-registration.c
index 5b87b39..1f0bc4f 100644
--- a/drivers/atmodem/network-registration.c
+++ b/drivers/atmodem/network-registration.c
@@ -182,7 +182,7 @@ static void at_registration_status(struct ofono_netreg *netreg,
struct netreg_data *nd = ofono_netreg_get_data(netreg);
struct cb_data *cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = nd;
@@ -349,7 +349,7 @@ static void at_current_operator(struct ofono_netreg *netreg,
struct cb_data *cbd = cb_data_new(cb, data);
gboolean ok;
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = netreg;
@@ -409,7 +409,7 @@ static void cops_list_cb(gboolean ok, GAtResult *result, gpointer user_data)
list = g_try_new0(struct ofono_network_operator, num);
- if (!list) {
+ if (list == NULL) {
CALLBACK_WITH_FAILURE(cb, 0, NULL, cbd->data);
return;
}
@@ -492,7 +492,7 @@ static void at_list_operators(struct ofono_netreg *netreg,
struct netreg_data *nd = ofono_netreg_get_data(netreg);
struct cb_data *cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (g_at_chat_send(nd->chat, "AT+COPS=?", cops_prefix,
@@ -522,7 +522,7 @@ static void at_register_auto(struct ofono_netreg *netreg,
struct netreg_data *nd = ofono_netreg_get_data(netreg);
struct cb_data *cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (g_at_chat_send(nd->chat, "AT+COPS=0", none_prefix,
@@ -543,7 +543,7 @@ static void at_register_manual(struct ofono_netreg *netreg,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[128];
- if (!cbd)
+ if (cbd == NULL)
goto error;
snprintf(buf, sizeof(buf), "AT+COPS=1,2,\"%s%s\"", mcc, mnc);
@@ -564,7 +564,7 @@ static void at_deregister(struct ofono_netreg *netreg,
struct netreg_data *nd = ofono_netreg_get_data(netreg);
struct cb_data *cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (g_at_chat_send(nd->chat, "AT+COPS=2", none_prefix,
@@ -862,7 +862,7 @@ static void at_signal_strength(struct ofono_netreg *netreg,
struct netreg_data *nd = ofono_netreg_get_data(netreg);
struct cb_data *cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = nd;
@@ -1045,7 +1045,7 @@ static void creg_notify(GAtResult *result, gpointer user_data)
switch (nd->vendor) {
case OFONO_VENDOR_OPTION_HSO:
tq = g_new0(struct tech_query, 1);
- if (!tq)
+ if (tq == NULL)
break;
tq->status = status;
diff --git a/drivers/atmodem/phonebook.c b/drivers/atmodem/phonebook.c
index dede235..731205e 100644
--- a/drivers/atmodem/phonebook.c
+++ b/drivers/atmodem/phonebook.c
@@ -368,7 +368,7 @@ static void at_export_entries(struct ofono_phonebook *pb, const char *storage,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[32];
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = pb;
@@ -536,7 +536,7 @@ static int at_phonebook_probe(struct ofono_phonebook *pb, unsigned int vendor,
struct pb_data *pbd;
pbd = g_try_new0(struct pb_data, 1);
- if (!pbd)
+ if (pbd == NULL)
return -ENOMEM;
pbd->chat = g_at_chat_clone(chat);
diff --git a/drivers/atmodem/sim-poll.c b/drivers/atmodem/sim-poll.c
index ae1b55c..daef24a 100644
--- a/drivers/atmodem/sim-poll.c
+++ b/drivers/atmodem/sim-poll.c
@@ -246,7 +246,7 @@ void atmodem_poll_enable(struct ofono_modem *modem, GAtChat *chat)
sim_atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_SIM);
stk_atom = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_STK);
- if (!sim_atom)
+ if (sim_atom == NULL)
return;
spd = g_new0(struct sim_poll_data, 1);
diff --git a/drivers/atmodem/sim.c b/drivers/atmodem/sim.c
index 9cfdc65..1653ede 100644
--- a/drivers/atmodem/sim.c
+++ b/drivers/atmodem/sim.c
@@ -138,7 +138,7 @@ static void at_sim_read_info(struct ofono_sim *sim, int fileid,
}
cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
snprintf(buf, sizeof(buf), "AT+CRSM=192,%i", fileid);
@@ -211,7 +211,7 @@ static void at_sim_read_binary(struct ofono_sim *sim, int fileid,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[64];
- if (!cbd)
+ if (cbd == NULL)
goto error;
snprintf(buf, sizeof(buf), "AT+CRSM=176,%i,%i,%i,%i", fileid,
@@ -235,7 +235,7 @@ static void at_sim_read_record(struct ofono_sim *sim, int fileid,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[64];
- if (!cbd)
+ if (cbd == NULL)
goto error;
snprintf(buf, sizeof(buf), "AT+CRSM=178,%i,%i,4,%i", fileid,
@@ -300,7 +300,7 @@ static void at_sim_update_binary(struct ofono_sim *sim, int fileid,
char *buf = g_try_new(char, 36 + length * 2);
int len, ret;
- if (!cbd || !buf)
+ if (cbd == NULL || buf == NULL)
goto error;
len = sprintf(buf, "AT+CRSM=214,%i,%i,%i,%i,", fileid,
@@ -333,7 +333,7 @@ static void at_sim_update_record(struct ofono_sim *sim, int fileid,
char *buf = g_try_new(char, 36 + length * 2);
int len, ret;
- if (!cbd || !buf)
+ if (cbd == NULL || buf == NULL)
goto error;
len = sprintf(buf, "AT+CRSM=220,%i,%i,4,%i,", fileid,
@@ -365,7 +365,7 @@ static void at_sim_update_cyclic(struct ofono_sim *sim, int fileid,
char *buf = g_try_new(char, 36 + length * 2);
int len, ret;
- if (!cbd || !buf)
+ if (cbd == NULL || buf == NULL)
goto error;
len = sprintf(buf, "AT+CRSM=220,%i,0,3,%i,", fileid, length);
@@ -421,7 +421,7 @@ static void at_read_imsi(struct ofono_sim *sim, ofono_sim_imsi_cb_t cb,
struct sim_data *sd = ofono_sim_get_data(sim);
struct cb_data *cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (g_at_chat_send(sd->chat, "AT+CIMI", NULL,
@@ -517,7 +517,7 @@ static void at_pin_query(struct ofono_sim *sim, ofono_sim_passwd_cb_t cb,
struct sim_data *sd = ofono_sim_get_data(sim);
struct cb_data *cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = sim;
@@ -626,7 +626,7 @@ static void at_pin_send(struct ofono_sim *sim, const char *passwd,
char buf[64];
int ret;
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = sd;
@@ -656,7 +656,7 @@ static void at_pin_send_puk(struct ofono_sim *sim, const char *puk,
char buf[64];
int ret;
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = sd;
@@ -711,10 +711,10 @@ static void at_pin_enable(struct ofono_sim *sim,
int ret;
unsigned int len = sizeof(at_clck_cpwd_fac) / sizeof(*at_clck_cpwd_fac);
- if (!cbd)
+ if (cbd == NULL)
goto error;
- if (passwd_type >= len || !at_clck_cpwd_fac[passwd_type])
+ if (passwd_type >= len || at_clck_cpwd_fac[passwd_type] == NULL)
goto error;
snprintf(buf, sizeof(buf), "AT+CLCK=\"%s\",%i,\"%s\"",
@@ -745,11 +745,11 @@ static void at_change_passwd(struct ofono_sim *sim,
int ret;
unsigned int len = sizeof(at_clck_cpwd_fac) / sizeof(*at_clck_cpwd_fac);
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (passwd_type >= len ||
- !at_clck_cpwd_fac[passwd_type])
+ at_clck_cpwd_fac[passwd_type] == NULL)
goto error;
snprintf(buf, sizeof(buf), "AT+CPWD=\"%s\",\"%s\",\"%s\"",
@@ -808,10 +808,10 @@ static void at_pin_query_enabled(struct ofono_sim *sim,
char buf[64];
unsigned int len = sizeof(at_clck_cpwd_fac) / sizeof(*at_clck_cpwd_fac);
- if (!cbd)
+ if (cbd == NULL)
goto error;
- if (passwd_type >= len || !at_clck_cpwd_fac[passwd_type])
+ if (passwd_type >= len || at_clck_cpwd_fac[passwd_type] == NULL)
goto error;
snprintf(buf, sizeof(buf), "AT+CLCK=\"%s\",2",
diff --git a/drivers/atmodem/sms.c b/drivers/atmodem/sms.c
index d6683fe..5298b1b 100644
--- a/drivers/atmodem/sms.c
+++ b/drivers/atmodem/sms.c
@@ -106,7 +106,7 @@ static void at_csca_set(struct ofono_sms *sms,
struct cb_data *cbd = cb_data_new(cb, user_data);
char buf[64];
- if (!cbd)
+ if (cbd == NULL)
goto error;
snprintf(buf, sizeof(buf), "AT+CSCA=\"%s\",%d", sca->number, sca->type);
@@ -173,7 +173,7 @@ static void at_csca_query(struct ofono_sms *sms, ofono_sms_sca_query_cb_t cb,
struct sms_data *data = ofono_sms_get_data(sms);
struct cb_data *cbd = cb_data_new(cb, user_data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (g_at_chat_send(data->chat, "AT+CSCA?", csca_prefix,
@@ -227,7 +227,7 @@ static void at_cmgs(struct ofono_sms *sms, unsigned char *pdu, int pdu_len,
char buf[512];
int len;
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (mms) {
@@ -267,7 +267,7 @@ static void at_cgsms_set(struct ofono_sms *sms, int bearer,
struct cb_data *cbd = cb_data_new(cb, user_data);
char buf[64];
- if (!cbd)
+ if (cbd == NULL)
goto error;
snprintf(buf, sizeof(buf), "AT+CGSMS=%d", bearer);
@@ -319,7 +319,7 @@ static void at_cgsms_query(struct ofono_sms *sms,
struct sms_data *data = ofono_sms_get_data(sms);
struct cb_data *cbd = cb_data_new(cb, user_data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (g_at_chat_send(data->chat, "AT+CGSMS?", cgsms_prefix,
@@ -867,7 +867,7 @@ static void construct_ack_pdu(struct sms_data *d)
d->cnma_ack_pdu = encode_hex(pdu, tpdu_len, 0);
- if (!d->cnma_ack_pdu)
+ if (d->cnma_ack_pdu == NULL)
goto err;
d->cnma_ack_pdu_len = tpdu_len;
diff --git a/drivers/atmodem/stk.c b/drivers/atmodem/stk.c
index bd4a7d2..fa8175a 100644
--- a/drivers/atmodem/stk.c
+++ b/drivers/atmodem/stk.c
@@ -153,7 +153,7 @@ static void at_stk_envelope(struct ofono_stk *stk, int length,
char *buf = g_try_new(char, 64 + length * 2);
int len, ret;
- if (!cbd || !buf)
+ if (cbd == NULL || buf == NULL)
goto error;
len = sprintf(buf, "AT+CSIM=%i,A0C20000%02hhX",
@@ -236,7 +236,7 @@ static void at_stk_terminal_response(struct ofono_stk *stk, int length,
char *buf = g_try_new(char, 64 + length * 2);
int len, ret;
- if (!cbd || !buf)
+ if (cbd == NULL || buf == NULL)
goto error;
len = sprintf(buf, "AT+CSIM=%i,A0140000%02hhX",
diff --git a/drivers/atmodem/ussd.c b/drivers/atmodem/ussd.c
index f38dfd0..78f6004 100644
--- a/drivers/atmodem/ussd.c
+++ b/drivers/atmodem/ussd.c
@@ -187,7 +187,7 @@ static void at_ussd_request(struct ofono_ussd *ussd, int dcs,
char buf[512];
enum sms_charset charset;
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = ussd;
@@ -212,7 +212,7 @@ static void at_ussd_request(struct ofono_ussd *ussd, int dcs,
char coded_buf[321];
char *converted = encode_hex_own_buf(pdu, len, 0, coded_buf);
- if (!converted)
+ if (converted == NULL)
goto error;
snprintf(buf, sizeof(buf), "AT+CUSD=1,\"%s\",%d",
@@ -264,7 +264,7 @@ static void at_ussd_cancel(struct ofono_ussd *ussd,
struct ussd_data *data = ofono_ussd_get_data(ussd);
struct cb_data *cbd = cb_data_new(cb, user_data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = data;
diff --git a/drivers/atmodem/voicecall.c b/drivers/atmodem/voicecall.c
index 10b8f4b..83c43d6 100644
--- a/drivers/atmodem/voicecall.c
+++ b/drivers/atmodem/voicecall.c
@@ -106,7 +106,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);
@@ -154,7 +154,7 @@ static void clcc_poll_cb(gboolean ok, GAtResult *result, gpointer user_data)
if (nc && nc->status >= 2 && nc->status <= 5)
poll_again = TRUE;
- 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))
@@ -167,7 +167,7 @@ static void clcc_poll_cb(gboolean ok, GAtResult *result, gpointer user_data)
reason, NULL);
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);
@@ -309,7 +309,7 @@ static void atd_cb(gboolean ok, GAtResult *result, gpointer user_data)
/* Generate a voice call that was just dialed, we guess the ID */
call = create_call(vc, 0, 0, 2, num, type, validity);
- if (!call) {
+ if (call == NULL) {
ofono_error("Unable to malloc, call tracking will fail!");
return;
}
@@ -339,7 +339,7 @@ static void at_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;
@@ -387,7 +387,7 @@ static void at_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;
@@ -467,7 +467,7 @@ static void at_release_specific(struct ofono_voicecall *vc, int id,
struct release_id_req *req = g_try_new0(struct release_id_req, 1);
char buf[32];
- if (!req)
+ if (req == NULL)
goto error;
req->vc = vc;
@@ -571,14 +571,14 @@ static void at_send_dtmf(struct ofono_voicecall *vc, const char *dtmf,
int i;
char *buf;
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = vd;
/* strlen("+VTS=T;") = 7 + initial AT + null */
buf = g_try_new(char, len * 9 + 3);
- if (!buf)
+ if (buf == NULL)
goto error;
s = sprintf(buf, "AT+VTS=%c", dtmf[0]);
@@ -621,7 +621,7 @@ static void ring_notify(GAtResult *result, gpointer user_data)
/* Generate an incoming call of unknown type */
call = create_call(vc, 9, 1, 4, NULL, 128, 2);
- if (!call) {
+ if (call == NULL) {
ofono_error("Couldn't create call, call management is fubar!");
return;
}
@@ -788,7 +788,7 @@ static void ccwa_notify(GAtResult *result, gpointer user_data)
call = create_call(vc, class_to_call_type(cls), 1, 5,
num, num_type, validity);
- if (!call) {
+ if (call == NULL) {
ofono_error("Unable to malloc. Call management is fubar");
return;
}
@@ -887,7 +887,7 @@ static int at_voicecall_probe(struct ofono_voicecall *vc, unsigned int vendor,
struct voicecall_data *vd;
vd = g_try_new0(struct voicecall_data, 1);
- if (!vd)
+ if (vd == NULL)
return -ENOMEM;
vd->chat = g_at_chat_clone(chat);
diff --git a/drivers/calypsomodem/stk.c b/drivers/calypsomodem/stk.c
index 334abc6..203cb9b 100644
--- a/drivers/calypsomodem/stk.c
+++ b/drivers/calypsomodem/stk.c
@@ -101,7 +101,7 @@ static void calypso_stk_envelope(struct ofono_stk *stk, int length,
DBG("");
- if (!cbd || !buf)
+ if (cbd == NULL || buf == NULL)
goto error;
len = sprintf(buf, "AT%%SATE=\"");
@@ -148,7 +148,7 @@ static void calypso_stk_terminal_response(struct ofono_stk *stk, int length,
DBG("");
- if (!cbd || !buf)
+ if (cbd == NULL || buf == NULL)
goto error;
len = sprintf(buf, "AT%%SATR=\"");
@@ -258,7 +258,7 @@ static int calypso_stk_probe(struct ofono_stk *stk,
DBG("");
sd = g_try_new0(struct stk_data, 1);
- if (!sd)
+ if (sd == NULL)
return -ENOMEM;
sd->chat = g_at_chat_clone(chat);
diff --git a/drivers/calypsomodem/voicecall.c b/drivers/calypsomodem/voicecall.c
index b2c9a96..0e6a388 100644
--- a/drivers/calypsomodem/voicecall.c
+++ b/drivers/calypsomodem/voicecall.c
@@ -64,7 +64,7 @@ static void calypso_template(struct ofono_voicecall *vc, const char *cmd,
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
struct cb_data *cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (g_at_chat_send(vd->chat, cmd, none_prefix,
@@ -210,7 +210,7 @@ static void calypso_send_dtmf(struct ofono_voicecall *vc, const char *dtmf,
/* strlen("+VTS=\"T\";") = 9 + initial AT + null */
buf = g_try_new(char, len * 9 + 3);
- if (!buf) {
+ if (buf == NULL) {
CALLBACK_WITH_FAILURE(cb, data);
return;
}
@@ -390,7 +390,7 @@ static int calypso_voicecall_probe(struct ofono_voicecall *vc,
struct voicecall_data *vd;
vd = g_try_new0(struct voicecall_data, 1);
- if (!vd)
+ if (vd == NULL)
return -ENOMEM;
vd->chat = g_at_chat_clone(chat);
diff --git a/drivers/hfpmodem/call-volume.c b/drivers/hfpmodem/call-volume.c
index d3807f7..f985175 100644
--- a/drivers/hfpmodem/call-volume.c
+++ b/drivers/hfpmodem/call-volume.c
@@ -73,7 +73,7 @@ static void hfp_speaker_volume(struct ofono_call_volume *cv,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[64];
- if (!cbd)
+ if (cbd == NULL)
goto error;
vd->sp_volume = percent;
@@ -100,7 +100,7 @@ static void hfp_microphone_volume(struct ofono_call_volume *cv,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[64];
- if (!cbd)
+ if (cbd == NULL)
goto error;
vd->mic_volume = percent;
diff --git a/drivers/hfpmodem/network-registration.c b/drivers/hfpmodem/network-registration.c
index 5f123fc..03ddc7b 100644
--- a/drivers/hfpmodem/network-registration.c
+++ b/drivers/hfpmodem/network-registration.c
@@ -236,7 +236,7 @@ static void hfp_registration_status(struct ofono_netreg *netreg,
struct cb_data *cbd = cb_data_new(cb, data);
gboolean ok;
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = netreg;
@@ -259,7 +259,7 @@ static void hfp_current_operator(struct ofono_netreg *netreg,
struct cb_data *cbd = cb_data_new(cb, data);
gboolean ok;
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = netreg;
@@ -284,7 +284,7 @@ static void hfp_signal_strength(struct ofono_netreg *netreg,
struct netreg_data *nd = ofono_netreg_get_data(netreg);
struct cb_data *cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = netreg;
diff --git a/drivers/hfpmodem/voicecall.c b/drivers/hfpmodem/voicecall.c
index e96ec7c..a8adc78 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);
@@ -98,7 +98,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 +225,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 +240,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);
@@ -345,7 +345,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 +364,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 +392,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 +506,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 +584,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 +595,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 +654,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 +725,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 +878,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,
diff --git a/drivers/hsomodem/gprs-context.c b/drivers/hsomodem/gprs-context.c
index dc6f1b6..a3f55ab 100644
--- a/drivers/hsomodem/gprs-context.c
+++ b/drivers/hsomodem/gprs-context.c
@@ -156,7 +156,7 @@ static void hso_gprs_activate_primary(struct ofono_gprs_context *gc,
char buf[AUTH_BUF_LENGTH];
int len;
- if (!cbd)
+ if (cbd == NULL)
goto error;
gcd->active_context = ctx->cid;
@@ -200,7 +200,7 @@ static void hso_gprs_deactivate_primary(struct ofono_gprs_context *gc,
struct cb_data *cbd = cb_data_new(cb, data);
char buf[128];
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = gc;
diff --git a/drivers/hsomodem/radio-settings.c b/drivers/hsomodem/radio-settings.c
index 3e22065..70c0efe 100644
--- a/drivers/hsomodem/radio-settings.c
+++ b/drivers/hsomodem/radio-settings.c
@@ -172,7 +172,7 @@ static int hso_radio_settings_probe(struct ofono_radio_settings *rs,
struct radio_settings_data *rsd;
rsd = g_try_new0(struct radio_settings_data, 1);
- if (!rsd)
+ if (rsd == NULL)
return -ENOMEM;
rsd->chat = g_at_chat_clone(chat);
diff --git a/drivers/huaweimodem/audio-settings.c b/drivers/huaweimodem/audio-settings.c
index d5d3bba..305776f 100644
--- a/drivers/huaweimodem/audio-settings.c
+++ b/drivers/huaweimodem/audio-settings.c
@@ -90,7 +90,7 @@ static int huawei_audio_settings_probe(struct ofono_audio_settings *as,
struct audio_settings_data *asd;
asd = g_try_new0(struct audio_settings_data, 1);
- if (!asd)
+ if (asd == NULL)
return -ENOMEM;
asd->chat = g_at_chat_clone(chat);
diff --git a/drivers/huaweimodem/gprs-context.c b/drivers/huaweimodem/gprs-context.c
index 48e21ab..ef3d93c 100644
--- a/drivers/huaweimodem/gprs-context.c
+++ b/drivers/huaweimodem/gprs-context.c
@@ -311,7 +311,7 @@ static void huawei_gprs_activate_primary(struct ofono_gprs_context *gc,
DBG("cid %u", ctx->cid);
- if (!cbd)
+ if (cbd == NULL)
goto error;
gcd->active_context = ctx->cid;
@@ -344,7 +344,7 @@ static void huawei_gprs_deactivate_primary(struct ofono_gprs_context *gc,
DBG("cid %u", cid);
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = gc;
@@ -376,7 +376,7 @@ static int huawei_gprs_context_probe(struct ofono_gprs_context *gc,
}
gcd = g_try_new0(struct gprs_context_data, 1);
- if (!gcd)
+ if (gcd == NULL)
return -ENOMEM;
gcd->chat = g_at_chat_clone(chat);
diff --git a/drivers/huaweimodem/voicecall.c b/drivers/huaweimodem/voicecall.c
index b417438..ff08124 100644
--- a/drivers/huaweimodem/voicecall.c
+++ b/drivers/huaweimodem/voicecall.c
@@ -57,7 +57,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 = id;
@@ -99,7 +99,7 @@ static void huawei_template(struct ofono_voicecall *vc, const char *cmd,
struct voicecall_data *vd = ofono_voicecall_get_data(vc);
struct cb_data *cbd = cb_data_new(cb, data);
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (g_at_chat_send(vd->chat, cmd, none_prefix,
@@ -319,7 +319,7 @@ static void orig_notify(GAtResult *result, gpointer user_data)
ofono_info("Call origin: id %d type %d", call_id, call_type);
call = create_call(vc, call_type, 0, 2, NULL, 128, 2, call_id);
- if (!call) {
+ if (call == NULL) {
ofono_error("Unable to malloc, call tracking will fail!");
return;
}
@@ -472,7 +472,7 @@ static int huawei_voicecall_probe(struct ofono_voicecall *vc,
struct voicecall_data *vd;
vd = g_try_new0(struct voicecall_data, 1);
- if (!vd)
+ if (vd == NULL)
return -ENOMEM;
vd->chat = g_at_chat_clone(chat);
diff --git a/drivers/ifxmodem/audio-settings.c b/drivers/ifxmodem/audio-settings.c
index fd100aa..8273335 100644
--- a/drivers/ifxmodem/audio-settings.c
+++ b/drivers/ifxmodem/audio-settings.c
@@ -116,7 +116,7 @@ static int ifx_audio_settings_probe(struct ofono_audio_settings *as,
struct audio_settings_data *asd;
asd = g_try_new0(struct audio_settings_data, 1);
- if (!asd)
+ if (asd == NULL)
return -ENOMEM;
asd->chat = g_at_chat_clone(chat);
diff --git a/drivers/ifxmodem/gprs-context.c b/drivers/ifxmodem/gprs-context.c
index 2a2b8df..fcfe698 100644
--- a/drivers/ifxmodem/gprs-context.c
+++ b/drivers/ifxmodem/gprs-context.c
@@ -122,7 +122,7 @@ static void failed_setup(struct ofono_gprs_context *gc,
gcd->active_context = 0;
gcd->state = STATE_IDLE;
- if (!result) {
+ if (result == NULL) {
CALLBACK_WITH_FAILURE(gcd->up_cb, NULL, 0, NULL, NULL,
NULL, NULL, gcd->cb_data);
return;
@@ -154,7 +154,7 @@ static void session_cb(gboolean ok, GAtResult *result, gpointer user_data)
dns[2] = 0;
interface = setup_rawip(gc);
- if (!interface)
+ if (interface == NULL)
interface = "invalid";
CALLBACK_WITH_SUCCESS(gcd->up_cb, interface, TRUE, gcd->address,
@@ -446,11 +446,11 @@ static int ifx_gprs_context_probe(struct ofono_gprs_context *gc,
return -ENODEV;
}
- if (!g_at_chat_get_slave(chat))
+ if (g_at_chat_get_slave(chat) == NULL)
return -EINVAL;
gcd = g_try_new0(struct gprs_context_data, 1);
- if (!gcd)
+ if (gcd == NULL)
return -ENOMEM;
gcd->chat = g_at_chat_clone(chat);
diff --git a/drivers/ifxmodem/radio-settings.c b/drivers/ifxmodem/radio-settings.c
index 89e97e7..2ec94f1 100644
--- a/drivers/ifxmodem/radio-settings.c
+++ b/drivers/ifxmodem/radio-settings.c
@@ -173,7 +173,7 @@ static int ifx_radio_settings_probe(struct ofono_radio_settings *rs,
struct radio_settings_data *rsd;
rsd = g_try_new0(struct radio_settings_data, 1);
- if (!rsd)
+ if (rsd == NULL)
return -ENOMEM;
rsd->chat = g_at_chat_clone(chat);
diff --git a/drivers/ifxmodem/stk.c b/drivers/ifxmodem/stk.c
index c17a5ad..6494c4d 100644
--- a/drivers/ifxmodem/stk.c
+++ b/drivers/ifxmodem/stk.c
@@ -104,7 +104,7 @@ static void ifx_stk_envelope(struct ofono_stk *stk, int length,
DBG("");
- if (!cbd || !buf)
+ if (cbd == NULL || buf == NULL)
goto error;
len = sprintf(buf, "AT+SATE=\"");
@@ -150,7 +150,7 @@ static void ifx_stk_terminal_response(struct ofono_stk *stk, int length,
DBG("");
- if (!cbd || !buf)
+ if (cbd == NULL || buf == NULL)
goto error;
len = sprintf(buf, "AT+SATR=\"");
@@ -273,7 +273,7 @@ static int ifx_stk_probe(struct ofono_stk *stk, unsigned int vendor, void *data)
DBG("");
sd = g_try_new0(struct stk_data, 1);
- if (!sd)
+ if (sd == NULL)
return -ENOMEM;
sd->chat = g_at_chat_clone(chat);
diff --git a/drivers/ifxmodem/voicecall.c b/drivers/ifxmodem/voicecall.c
index 26cc7fe..4bb5681 100644
--- a/drivers/ifxmodem/voicecall.c
+++ b/drivers/ifxmodem/voicecall.c
@@ -94,7 +94,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);
@@ -287,7 +287,7 @@ static void atd_cb(gboolean ok, GAtResult *result, gpointer user_data)
/* Generate a voice call that was just dialed, we guess the ID */
call = create_call(vc, 0, 0, 2, num, type, validity);
- if (!call) {
+ if (call == NULL) {
ofono_error("Unable to malloc, call tracking will fail!");
return;
}
@@ -311,7 +311,7 @@ static void ifx_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;
@@ -359,7 +359,7 @@ static void ifx_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;
@@ -431,7 +431,7 @@ static void ifx_release_specific(struct ofono_voicecall *vc, int id,
struct release_id_req *req = g_try_new0(struct release_id_req, 1);
char buf[32];
- if (!req)
+ if (req == NULL)
goto error;
req->vc = vc;
@@ -518,12 +518,12 @@ static void ifx_send_dtmf(struct ofono_voicecall *vc, const char *dtmf,
int i;
char *buf;
- if (!cbd)
+ if (cbd == NULL)
goto error;
/* strlen("+VTS=T\;") = 7 + initial AT + null */
buf = g_try_new(char, len * 7 + 3);
- if (!buf)
+ if (buf == NULL)
goto error;
s = sprintf(buf, "AT+VTS=%c", dtmf[0]);
@@ -689,7 +689,7 @@ static void ccwa_notify(GAtResult *result, gpointer user_data)
call = create_call(vc, class_to_call_type(cls), 1, 5,
num, num_type, validity);
- if (!call) {
+ if (call == NULL) {
ofono_error("Unable to malloc. Call management is fubar");
return;
}
@@ -723,7 +723,7 @@ static int ifx_voicecall_probe(struct ofono_voicecall *vc, unsigned int vendor,
struct voicecall_data *vd;
vd = g_try_new0(struct voicecall_data, 1);
- if (!vd)
+ if (vd == NULL)
return -ENOMEM;
vd->chat = g_at_chat_clone(chat);
diff --git a/drivers/isimodem/audio-settings.c b/drivers/isimodem/audio-settings.c
index 80c5648..04774af 100644
--- a/drivers/isimodem/audio-settings.c
+++ b/drivers/isimodem/audio-settings.c
@@ -107,11 +107,11 @@ static int isi_audio_settings_probe(struct ofono_audio_settings *as,
struct audio_settings_data *asd =
g_try_new0(struct audio_settings_data, 1);
- if (!asd)
+ if (asd == NULL)
return -ENOMEM;
asd->client = g_isi_client_create(idx, PN_CALL);
- if (!asd->client) {
+ if (asd->client == NULL) {
g_free(asd);
return -ENOMEM;
}
@@ -128,7 +128,7 @@ static void isi_audio_settings_remove(struct ofono_audio_settings *as)
{
struct audio_settings_data *asd = ofono_audio_settings_get_data(as);
- if (!asd)
+ if (asd == NULL)
return;
ofono_audio_settings_set_data(as, NULL);
diff --git a/drivers/isimodem/call-barring.c b/drivers/isimodem/call-barring.c
index 7cdd218..5ec9b0c 100644
--- a/drivers/isimodem/call-barring.c
+++ b/drivers/isimodem/call-barring.c
@@ -128,7 +128,7 @@ static void isi_set(struct ofono_call_barring *barr, const char *lock,
DBG("lock code %s enable %d class %d password %s",
lock, enable, cls, passwd);
- if (!cbd || !bd)
+ if (cbd == NULL || bd == NULL)
goto error;
if (g_isi_request_make(bd->client, msg, sizeof(msg), SS_TIMEOUT,
@@ -275,7 +275,7 @@ static void isi_query(struct ofono_call_barring *barr, const char *lock,
DBG("barring query lock code %s", lock);
- if (!cbd || !bd)
+ if (cbd == NULL || bd == NULL)
goto error;
if (g_isi_request_make(bd->client, msg, sizeof(msg), SS_TIMEOUT,
@@ -346,7 +346,7 @@ static void isi_set_passwd(struct ofono_call_barring *barr, const char *lock,
DBG("lock code %s (%u) old password %s new password %s",
lock, ss_code, old_passwd, new_passwd);
- if (!cbd || !bd)
+ if (cbd == NULL || bd == NULL)
goto error;
if (g_isi_request_make(bd->client, msg, sizeof(msg), SS_TIMEOUT,
@@ -397,11 +397,11 @@ static int isi_call_barring_probe(struct ofono_call_barring *barr,
GIsiModem *idx = user;
struct barr_data *data = g_try_new0(struct barr_data, 1);
- if (!data)
+ if (data == NULL)
return -ENOMEM;
data->client = g_isi_client_create(idx, PN_SS);
- if (!data->client)
+ if (data->client == NULL)
return -ENOMEM;
ofono_call_barring_set_data(barr, data);
@@ -415,7 +415,7 @@ static void isi_call_barring_remove(struct ofono_call_barring *barr)
{
struct barr_data *data = ofono_call_barring_get_data(barr);
- if (!data)
+ if (data == NULL)
return;
ofono_call_barring_set_data(barr, NULL);
diff --git a/drivers/isimodem/call-forwarding.c b/drivers/isimodem/call-forwarding.c
index bb25ee7..a08524d 100644
--- a/drivers/isimodem/call-forwarding.c
+++ b/drivers/isimodem/call-forwarding.c
@@ -229,7 +229,7 @@ static void isi_registration(struct ofono_call_forwarding *cf,
DBG("forwarding type %d class %d", type, cls);
- if (!cbd || !fd || !number->number || strlen(number->number) > 28)
+ if (cbd == NULL || fd == NULL || !number->number || strlen(number->number) > 28)
goto error;
ss_code = forw_type_to_isi_code(type);
@@ -349,7 +349,7 @@ static void isi_erasure(struct ofono_call_forwarding *cf, int type, int cls,
DBG("forwarding type %d class %d", type, cls);
- if (!cbd || !fd)
+ if (cbd == NULL || fd == NULL)
goto error;
ss_code = forw_type_to_isi_code(type);
@@ -481,7 +481,7 @@ static void isi_query(struct ofono_call_forwarding *cf, int type, int cls,
DBG("forwarding type %d class %d", type, cls);
- if (!cbd || !fd || cls != 7)
+ if (cbd == NULL || fd == NULL || cls != 7)
goto error;
ss_code = forw_type_to_isi_code(type);
@@ -541,11 +541,11 @@ static int isi_call_forwarding_probe(struct ofono_call_forwarding *cf,
data = g_try_new0(struct forw_data, 1);
- if (!data)
+ if (data == NULL)
return -ENOMEM;
data->client = g_isi_client_create(idx, PN_SS);
- if (!data->client)
+ if (data->client == NULL)
return -ENOMEM;
ofono_call_forwarding_set_data(cf, data);
@@ -560,7 +560,7 @@ static void isi_call_forwarding_remove(struct ofono_call_forwarding *cf)
{
struct forw_data *data = ofono_call_forwarding_get_data(cf);
- if (!data)
+ if (data == NULL)
return;
ofono_call_forwarding_set_data(cf, NULL);
diff --git a/drivers/isimodem/call-meter.c b/drivers/isimodem/call-meter.c
index 336a077..2fc74c8 100644
--- a/drivers/isimodem/call-meter.c
+++ b/drivers/isimodem/call-meter.c
@@ -90,11 +90,11 @@ static int isi_call_meter_probe(struct ofono_call_meter *cm,
GIsiModem *idx = user;
struct call_meter_data *data = g_try_new0(struct call_meter_data, 1);
- if (!data)
+ if (data == NULL)
return -ENOMEM;
data->client = g_isi_client_create(idx, PN_SS);
- if (!data->client)
+ if (data->client == NULL)
return -ENOMEM;
ofono_call_meter_set_data(cm, data);
diff --git a/drivers/isimodem/call-settings.c b/drivers/isimodem/call-settings.c
index 23c1982..754dbcd 100644
--- a/drivers/isimodem/call-settings.c
+++ b/drivers/isimodem/call-settings.c
@@ -177,7 +177,7 @@ static void isi_cw_query(struct ofono_call_settings *cs, int cls,
DBG("waiting class %d", cls);
- if (!cbd || !sd)
+ if (cbd == NULL || sd == NULL)
goto error;
if (g_isi_request_make(sd->client, msg, sizeof(msg), SS_TIMEOUT,
@@ -268,7 +268,7 @@ static void isi_cw_set(struct ofono_call_settings *cs, int mode, int cls,
DBG("waiting mode %d class %d", mode, cls);
- if (!cbd || !sd)
+ if (cbd == NULL || sd == NULL)
goto error;
if (g_isi_request_make(sd->client, msg, sizeof(msg), SS_TIMEOUT,
@@ -321,12 +321,12 @@ static int isi_call_settings_probe(struct ofono_call_settings *cs,
data = g_try_new0(struct settings_data, 1);
- if (!data)
+ if (data == NULL)
return -ENOMEM;
data->client = g_isi_client_create(idx, PN_SS);
- if (!data->client)
+ if (data->client == NULL)
return -ENOMEM;
ofono_call_settings_set_data(cs, data);
@@ -341,7 +341,7 @@ static void isi_call_settings_remove(struct ofono_call_settings *cs)
{
struct settings_data *data = ofono_call_settings_get_data(cs);
- if (!data)
+ if (data == NULL)
return;
ofono_call_settings_set_data(cs, NULL);
diff --git a/drivers/isimodem/cbs.c b/drivers/isimodem/cbs.c
index 2a32720..6780743 100644
--- a/drivers/isimodem/cbs.c
+++ b/drivers/isimodem/cbs.c
@@ -136,11 +136,11 @@ static int isi_cbs_probe(struct ofono_cbs *cbs, unsigned int vendor,
0x00 /* Languages */
};
- if (!cd)
+ if (cd == NULL)
return -ENOMEM;
cd->client = g_isi_client_create(idx, PN_SMS);
- if (!cd->client)
+ if (cd->client == NULL)
return -ENOMEM;
ofono_cbs_set_data(cbs, cd);
@@ -149,8 +149,7 @@ static int isi_cbs_probe(struct ofono_cbs *cbs, unsigned int vendor,
if (debug && (strcmp(debug, "all") == 0 || strcmp(debug, "cbs") == 0))
g_isi_client_set_debug(cd->client, sms_debug, NULL);
- if (!g_isi_request_make(cd->client, msg, sizeof(msg), CBS_TIMEOUT,
- routing_resp_cb, cbs))
+ if (g_isi_request_make(cd->client, msg, sizeof(msg), CBS_TIMEOUT, routing_resp_cb, cbs) == NULL)
DBG("Failed to set CBS routing.");
return 0;
@@ -173,7 +172,7 @@ static void isi_cbs_remove(struct ofono_cbs *cbs)
0x00 /* Languages */
};
- if (!data)
+ if (data == NULL)
return;
if (data->client) {
diff --git a/drivers/isimodem/devinfo.c b/drivers/isimodem/devinfo.c
index f7960ff..7f94f9e 100644
--- a/drivers/isimodem/devinfo.c
+++ b/drivers/isimodem/devinfo.c
@@ -128,7 +128,7 @@ static void isi_query_manufacturer(struct ofono_devinfo *info,
INFO_PRODUCT_MANUFACTURER
};
- if (!cbd || !dev)
+ if (cbd == NULL || dev == NULL)
goto error;
if (g_isi_request_make(dev->client, msg, sizeof(msg),
@@ -152,7 +152,7 @@ static void isi_query_model(struct ofono_devinfo *info,
INFO_PRODUCT_NAME
};
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (g_isi_request_make(dev->client, msg, sizeof(msg),
@@ -177,7 +177,7 @@ static void isi_query_revision(struct ofono_devinfo *info,
0x00, 0x00, 0x00, 0x00
};
- if (!cbd || !dev)
+ if (cbd == NULL || dev == NULL)
goto error;
if (g_isi_request_make(dev->client, msg, sizeof(msg),
@@ -201,7 +201,7 @@ static void isi_query_serial(struct ofono_devinfo *info,
INFO_SN_IMEI_PLAIN
};
- if (!cbd || !dev)
+ if (cbd == NULL || dev == NULL)
goto error;
if (g_isi_request_make(dev->client, msg, sizeof(msg),
@@ -252,11 +252,11 @@ static int isi_devinfo_probe(struct ofono_devinfo *info, unsigned int vendor,
GIsiModem *idx = user;
struct devinfo_data *data = g_try_new0(struct devinfo_data, 1);
- if (!data)
+ if (data == NULL)
return -ENOMEM;
data->client = g_isi_client_create(idx, PN_PHONE_INFO);
- if (!data->client) {
+ if (data->client == NULL) {
g_free(data);
return -ENOMEM;
}
diff --git a/drivers/isimodem/gprs-context.c b/drivers/isimodem/gprs-context.c
index 88450b8..1cfbfee 100644
--- a/drivers/isimodem/gprs-context.c
+++ b/drivers/isimodem/gprs-context.c
@@ -85,7 +85,7 @@ struct context_data {
static void reset_context(struct context_data *cd)
{
- if (!cd)
+ if (cd == NULL)
return;
g_isi_remove_subscription(cd->client, PN_GPDS,
@@ -399,8 +399,7 @@ static void send_context_authenticate(GIsiClient *client, void *opaque)
{ cd->password, password_len },
};
- if (!g_isi_request_vmake(client, iov, 4, GPDS_TIMEOUT,
- context_auth_cb, cd))
+ if (g_isi_request_vmake(client, iov, 4, GPDS_TIMEOUT, context_auth_cb, cd) == NULL)
gprs_up_fail(cd);
}
@@ -495,8 +494,7 @@ static void create_pipe_cb(GIsiPipe *pipe)
GPDS_CONTEXT_ID_CREATE_REQ,
};
- if (!g_isi_request_make(cd->client, msg, sizeof(msg), GPDS_TIMEOUT,
- create_context_cb, cd))
+ if (g_isi_request_make(cd->client, msg, sizeof(msg), GPDS_TIMEOUT, create_context_cb, cd) == NULL)
gprs_up_fail(cd);
}
@@ -582,7 +580,7 @@ static void isi_gprs_deactivate_primary(struct ofono_gprs_context *gc,
0x00, /* GPDS context ID, added later */
};
- if (!cd)
+ if (cd == NULL)
return;
cd->down_cb = cb;
@@ -590,8 +588,7 @@ static void isi_gprs_deactivate_primary(struct ofono_gprs_context *gc,
msg[1] = cd->handle;
- if (!g_isi_request_make(cd->client, msg, sizeof(msg), GPDS_TIMEOUT,
- context_deactivate_cb, cd)) {
+ if (g_isi_request_make(cd->client, msg, sizeof(msg), GPDS_TIMEOUT, context_deactivate_cb, cd) == NULL) {
gprs_down_fail(cd);
return;
}
@@ -630,11 +627,11 @@ static int isi_gprs_context_probe(struct ofono_gprs_context *gc,
GIsiModem *idx = user;
struct context_data *cd = g_try_new0(struct context_data, 1);
- if (!cd)
+ if (cd == NULL)
return -ENOMEM;
cd->client = g_isi_client_create(idx, PN_GPDS);
- if (!cd->client) {
+ if (cd->client == NULL) {
g_free(cd);
return -ENOMEM;
}
@@ -652,7 +649,7 @@ static void isi_gprs_context_remove(struct ofono_gprs_context *gc)
{
struct context_data *cd = ofono_gprs_context_get_data(gc);
- if (!cd)
+ if (cd == NULL)
return;
ofono_gprs_context_set_data(gc, NULL);
diff --git a/drivers/isimodem/gprs.c b/drivers/isimodem/gprs.c
index 9cbe4f3..3c9facd 100644
--- a/drivers/isimodem/gprs.c
+++ b/drivers/isimodem/gprs.c
@@ -165,11 +165,11 @@ static int isi_gprs_probe(struct ofono_gprs *gprs,
GIsiModem *idx = user;
struct gprs_data *gd = g_try_new0(struct gprs_data, 1);
- if (!gd)
+ if (gd == NULL)
return -ENOMEM;
gd->client = g_isi_client_create(idx, PN_GPDS);
- if (!gd->client) {
+ if (gd->client == NULL) {
g_free(gd);
return -ENOMEM;
}
@@ -187,7 +187,7 @@ static void isi_gprs_remove(struct ofono_gprs *gprs)
{
struct gprs_data *data = ofono_gprs_get_data(gprs);
- if (!data)
+ if (data == NULL)
return;
ofono_gprs_set_data(gprs, NULL);
@@ -286,7 +286,7 @@ static void isi_gprs_set_attached(struct ofono_gprs *gprs, int attached,
GIsiRequest *req;
- if (!cbd || !gd)
+ if (cbd == NULL || gd == NULL)
goto error;
if (attached)
@@ -356,7 +356,7 @@ static void isi_gprs_attached_status(struct ofono_gprs *gprs,
GPDS_STATUS_REQ,
};
- if (!cbd || !gd)
+ if (cbd == NULL || gd == NULL)
goto error;
if (g_isi_send(gd->client, msg, sizeof(msg), GPDS_TIMEOUT,
diff --git a/drivers/isimodem/infoserver.c b/drivers/isimodem/infoserver.c
index 7f07da3..9665996 100644
--- a/drivers/isimodem/infoserver.c
+++ b/drivers/isimodem/infoserver.c
@@ -93,11 +93,11 @@ struct isi_infoserver *isi_infoserver_create(struct ofono_modem *modem,
struct isi_infoserver *self;
self = g_new0(struct isi_infoserver, 1);
- if (!self)
+ if (self == NULL)
return NULL;
self->server = g_isi_server_create(data, PN_EPOC_INFO, 0, 0);
- if (!self->server) {
+ if (self->server == NULL) {
g_free(self);
return NULL;
}
diff --git a/drivers/isimodem/network-registration.c b/drivers/isimodem/network-registration.c
index 1e7c892..d885aae 100644
--- a/drivers/isimodem/network-registration.c
+++ b/drivers/isimodem/network-registration.c
@@ -255,7 +255,7 @@ static void isi_registration_status(struct ofono_netreg *netreg,
NET_REG_STATUS_GET_REQ
};
- if (!cbd || !nd)
+ if (cbd == NULL || nd == NULL)
goto error;
if (g_isi_request_make(nd->client, msg, sizeof(msg),
@@ -360,7 +360,7 @@ static void isi_current_operator(struct ofono_netreg *netreg,
0x00 /* No sub-blocks */
};
- if (!cbd || !nd)
+ if (cbd == NULL || nd == NULL)
goto error;
if (g_isi_request_make(nd->client, msg, sizeof(msg),
@@ -482,7 +482,7 @@ static void isi_list_operators(struct ofono_netreg *netreg,
0x00
};
- if (!cbd || !net)
+ if (cbd == NULL || net == NULL)
goto error;
if (g_isi_request_make(net->client, msg, sizeof(msg),
@@ -548,7 +548,7 @@ static void isi_register_auto(struct ofono_netreg *netreg,
0x00 /* Index not used */
};
- if (!cbd || !net)
+ if (cbd == NULL || net == NULL)
goto error;
if (g_isi_request_make(net->client, msg, sizeof(msg),
@@ -621,7 +621,7 @@ static void isi_register_manual(struct ofono_netreg *netreg,
0x00, 0x00 /* Filler */
};
- if (!cbd || !nd)
+ if (cbd == NULL || nd == NULL)
goto error;
if (g_isi_request_make(nd->client, msg, sizeof(msg),
@@ -866,7 +866,7 @@ static void isi_strength(struct ofono_netreg *netreg,
NET_CURRENT_CELL_RSSI
};
- if (!cbd || !nd)
+ if (cbd == NULL || nd == NULL)
goto error;
if (g_isi_request_make(nd->client, msg, sizeof(msg),
@@ -901,9 +901,7 @@ static gboolean isi_netreg_register(gpointer user)
g_isi_subscribe(nd->client, NET_TIME_IND, time_ind_cb, netreg);
/* Bootstrap current RAT setting */
- if (!g_isi_request_make(nd->client, rat, sizeof(rat),
- NETWORK_TIMEOUT,
- rat_resp_cb, netreg))
+ if (g_isi_request_make(nd->client, rat, sizeof(rat), NETWORK_TIMEOUT, rat_resp_cb, netreg) == NULL)
DBG("Failed to bootstrap RAT");
ofono_netreg_register(netreg);
@@ -935,11 +933,11 @@ static int isi_netreg_probe(struct ofono_netreg *netreg, unsigned int vendor,
GIsiModem *idx = user;
struct netreg_data *nd = g_try_new0(struct netreg_data, 1);
- if (!nd)
+ if (nd == NULL)
return -ENOMEM;
nd->client = g_isi_client_create(idx, PN_NETWORK);
- if (!nd->client) {
+ if (nd->client == NULL) {
g_free(nd);
return -ENOMEM;
}
@@ -954,7 +952,7 @@ static void isi_netreg_remove(struct ofono_netreg *net)
{
struct netreg_data *data = ofono_netreg_get_data(net);
- if (!data)
+ if (data == NULL)
return;
ofono_netreg_set_data(net, NULL);
diff --git a/drivers/isimodem/phonebook.c b/drivers/isimodem/phonebook.c
index dc832c4..5ee4315 100644
--- a/drivers/isimodem/phonebook.c
+++ b/drivers/isimodem/phonebook.c
@@ -192,7 +192,7 @@ static void read_next_entry(GIsiClient *client, int location,
if (location < 0)
goto error;
- if (!cbd)
+ if (cbd == NULL)
goto error;
if (g_isi_request_make(client, msg, sizeof(msg), SIM_TIMEOUT,
@@ -259,7 +259,7 @@ static void isi_export_entries(struct ofono_phonebook *pb, const char *storage,
0, 0 /* filler */
};
- if (!cbd || !pbd)
+ if (cbd == NULL || pbd == NULL)
goto error;
if (strcmp(storage, "SM"))
@@ -314,11 +314,11 @@ static int isi_phonebook_probe(struct ofono_phonebook *pb, unsigned int vendor,
GIsiModem *idx = user;
struct pb_data *data = g_try_new0(struct pb_data, 1);
- if (!data)
+ if (data == NULL)
return -ENOMEM;
data->client = g_isi_client_create(idx, PN_SIM);
- if (!data->client) {
+ if (data->client == NULL) {
g_free(data);
return -ENOMEM;
}
@@ -335,7 +335,7 @@ static void isi_phonebook_remove(struct ofono_phonebook *pb)
{
struct pb_data *data = ofono_phonebook_get_data(pb);
- if (!data)
+ if (data == NULL)
return;
ofono_phonebook_set_data(pb, NULL);
diff --git a/drivers/isimodem/radio-settings.c b/drivers/isimodem/radio-settings.c
index 558e032..a93cde2 100644
--- a/drivers/isimodem/radio-settings.c
+++ b/drivers/isimodem/radio-settings.c
@@ -159,7 +159,7 @@ static void isi_query_rat_mode(struct ofono_radio_settings *rs,
0x00 /* subblock count */
};
- if (!cbd || !rd)
+ if (cbd == NULL || rd == NULL)
goto error;
if (g_isi_request_make(rd->client, msg, sizeof(msg), GSS_TIMEOUT,
@@ -226,7 +226,7 @@ static void isi_set_rat_mode(struct ofono_radio_settings *rs,
0x00 /* filler */
};
- if (!cbd || !rd)
+ if (cbd == NULL || rd == NULL)
goto error;
if (isi_mode == -1)
@@ -363,11 +363,11 @@ static int isi_radio_settings_probe(struct ofono_radio_settings *rs,
GIsiModem *idx = user;
struct radio_data *rd = g_try_new0(struct radio_data, 1);
- if (!rd)
+ if (rd == NULL)
return -ENOMEM;
rd->client = g_isi_client_create(idx, PN_GSS);
- if (!rd->client) {
+ if (rd->client == NULL) {
g_free(rd);
return -ENOMEM;
}
@@ -384,7 +384,7 @@ static void isi_radio_settings_remove(struct ofono_radio_settings *rs)
{
struct radio_data *rd = ofono_radio_settings_get_data(rs);
- if (!rd)
+ if (rd == NULL)
return;
ofono_radio_settings_set_data(rs, NULL);
diff --git a/drivers/isimodem/sim.c b/drivers/isimodem/sim.c
index d03a07e..b79c52a 100644
--- a/drivers/isimodem/sim.c
+++ b/drivers/isimodem/sim.c
@@ -156,7 +156,7 @@ static gboolean isi_read_spn(struct ofono_sim *sim, struct isi_cb_data *cbd)
0
};
- if (!sd)
+ if (sd == NULL)
return FALSE;
return g_isi_request_make(sd->client, msg, sizeof(msg),
@@ -200,7 +200,7 @@ static gboolean isi_read_iccid(struct ofono_sim *sim, struct isi_cb_data *cbd)
struct sim_data *sd = ofono_sim_get_data(sim);
const unsigned char req[] = { SIM_READ_FIELD_REQ, ICC };
- if (!sd)
+ if (sd == NULL)
return FALSE;
return g_isi_request_make(sd->client, req, sizeof(req), SIM_TIMEOUT,
@@ -343,7 +343,7 @@ static void isi_read_imsi(struct ofono_sim *sim,
READ_IMSI
};
- if (!cbd || !sd)
+ if (cbd == NULL || sd == NULL)
goto error;
if (g_isi_request_make(sd->client, msg, sizeof(msg), SIM_TIMEOUT,
@@ -451,11 +451,11 @@ static int isi_sim_probe(struct ofono_sim *sim, unsigned int vendor,
struct sim_data *sd = g_try_new0(struct sim_data, 1);
const char *debug = getenv("OFONO_ISI_DEBUG");
- if (!sd)
+ if (sd == NULL)
return -ENOMEM;
sd->client = g_isi_client_create(idx, PN_SIM);
- if (!sd->client)
+ if (sd->client == NULL)
return -ENOMEM;
ofono_sim_set_data(sim, sd);
@@ -472,7 +472,7 @@ static void isi_sim_remove(struct ofono_sim *sim)
{
struct sim_data *data = ofono_sim_get_data(sim);
- if (!data)
+ if (data == NULL)
return;
ofono_sim_set_data(sim, NULL);
diff --git a/drivers/isimodem/sms.c b/drivers/isimodem/sms.c
index e2c2533..e5b97e1 100644
--- a/drivers/isimodem/sms.c
+++ b/drivers/isimodem/sms.c
@@ -156,7 +156,7 @@ static void isi_sca_query(struct ofono_sms *sms,
1, /* Location, default is 1 */
};
- if (!cbd || !sd)
+ if (cbd == NULL || sd == NULL)
goto error;
if (g_isi_send(sd->sim, msg, sizeof(msg), SIM_TIMEOUT,
@@ -214,7 +214,7 @@ static void isi_sca_set(struct ofono_sms *sms,
{ &sd->params, sizeof(sd->params) },
};
- if (!cbd || !sd)
+ if (cbd == NULL || sd == NULL)
goto error;
bcd = sd->params.sca;
@@ -350,7 +350,7 @@ static void isi_submit(struct ofono_sms *sms, unsigned char *pdu,
{ sca_sb, sca_sb_len },
};
- if (!cbd || !sd)
+ if (cbd == NULL || sd == NULL)
goto error;
if (use_sca) {
@@ -560,18 +560,18 @@ static int isi_sms_probe(struct ofono_sms *sms, unsigned int vendor,
0x00 /* Sub-sub-block count */
};
- if (!data)
+ if (data == NULL)
return -ENOMEM;
data->params.absent = 0xff;
data->params.alphalen = 1; /* Includes final UCS2-coded NUL */
data->client = g_isi_client_create(idx, PN_SMS);
- if (!data->client)
+ if (data->client == NULL)
return -ENOMEM;
data->sim = g_isi_client_create(idx, PN_SIM);
- if (!data->sim) {
+ if (data->sim == NULL) {
g_isi_client_destroy(data->client);
return -ENOMEM;
}
@@ -586,8 +586,7 @@ static int isi_sms_probe(struct ofono_sms *sms, unsigned int vendor,
g_isi_subscribe(data->client, SMS_MESSAGE_SEND_STATUS_IND,
send_status_ind_cb, sms);
- if (!g_isi_send(data->client, msg, sizeof(msg), SMS_TIMEOUT,
- routing_resp_cb, sms, NULL))
+ if (g_isi_send(data->client, msg, sizeof(msg), SMS_TIMEOUT, routing_resp_cb, sms, NULL) == NULL)
DBG("Failed to set SMS routing.");
return 0;
@@ -609,7 +608,7 @@ static void isi_sms_remove(struct ofono_sms *sms)
0x00 /* Sub-sub-block count */
};
- if (!data)
+ if (data == NULL)
return;
ofono_sms_set_data(sms, NULL);
diff --git a/drivers/isimodem/ssn.c b/drivers/isimodem/ssn.c
index 797ba9d..402a48a 100644
--- a/drivers/isimodem/ssn.c
+++ b/drivers/isimodem/ssn.c
@@ -51,11 +51,11 @@ static int isi_ssn_probe(struct ofono_ssn *ssn, unsigned int vendor,
GIsiModem *idx = user;
struct ssn_data *data = g_try_new0(struct ssn_data, 1);
- if (!data)
+ if (data == NULL)
return -ENOMEM;
data->client = g_isi_client_create(idx, PN_SS);
- if (!data->client)
+ if (data->client == NULL)
return -ENOMEM;
ofono_ssn_set_data(ssn, data);
@@ -67,7 +67,7 @@ static void isi_ssn_remove(struct ofono_ssn *ssn)
{
struct ssn_data *data = ofono_ssn_get_data(ssn);
- if (!data)
+ if (data == NULL)
return;
ofono_ssn_set_data(ssn, NULL);
diff --git a/drivers/isimodem/ussd.c b/drivers/isimodem/ussd.c
index 78ac9fe..a509a0a 100644
--- a/drivers/isimodem/ussd.c
+++ b/drivers/isimodem/ussd.c
@@ -181,7 +181,7 @@ static void isi_request(struct ofono_ussd *ussd, int dcs,
{ (uint8_t *)pdu, len }
};
- if (!cbd || !ud)
+ if (cbd == NULL || ud == NULL)
goto error;
if (g_isi_vsend(ud->client, iov, 2, SS_TIMEOUT,
@@ -205,7 +205,7 @@ static void isi_cancel(struct ofono_ussd *ussd,
0x00 /* subblock count */
};
- if (!cbd || !ud)
+ if (cbd == NULL || ud == NULL)
goto error;
if (g_isi_send(ud->client, msg, sizeof(msg), SS_TIMEOUT,
@@ -258,11 +258,11 @@ static int isi_ussd_probe(struct ofono_ussd *ussd, unsigned int vendor,
GIsiModem *idx = user;
struct ussd_data *ud = g_try_new0(struct ussd_data, 1);
- if (!ud)
+ if (ud == NULL)
return -ENOMEM;
ud->client = g_isi_client_create(idx, PN_SS);
- if (!ud->client)
+ if (ud->client == NULL)
return -ENOMEM;
ofono_ussd_set_data(ussd, ud);
@@ -275,7 +275,7 @@ static void isi_ussd_remove(struct ofono_ussd *ussd)
{
struct ussd_data *data = ofono_ussd_get_data(ussd);
- if (!data)
+ if (data == NULL)
return;
ofono_ussd_set_data(ussd, NULL);
diff --git a/drivers/isimodem/voicecall.c b/drivers/isimodem/voicecall.c
index 497a2ce..d250924 100644
--- a/drivers/isimodem/voicecall.c
+++ b/drivers/isimodem/voicecall.c
@@ -176,7 +176,7 @@ static gboolean isi_ctx_return(struct isi_call_req_context *irc,
enum ofono_error_type type,
int error)
{
- if (!irc)
+ if (irc == NULL)
return TRUE;
if (irc->cb) {
@@ -1252,14 +1252,14 @@ static int isi_voicecall_probe(struct ofono_voicecall *ovc,
struct isi_voicecall *ivc = g_try_new0(struct isi_voicecall, 1);
int id;
- if (!ivc)
+ if (ivc == NULL)
return -ENOMEM;
for (id = 0; id <= 7; id++)
ivc->calls[id].id = id;
ivc->client = g_isi_client_create(idx, PN_CALL);
- if (!ivc->client) {
+ if (ivc->client == NULL) {
g_free(ivc);
return -ENOMEM;
}
@@ -1302,9 +1302,7 @@ static gboolean isi_call_register(gpointer _ovc)
CALL_STATUS_IND, isi_call_status_ind_cb,
ovc);
- if (!isi_call_status_req(ovc, CALL_ID_ALL,
- CALL_STATUS_MODE_ADDR_AND_ORIGIN,
- NULL, NULL))
+ if (isi_call_status_req(ovc, CALL_ID_ALL, CALL_STATUS_MODE_ADDR_AND_ORIGIN, NULL, NULL) == NULL)
DBG("Failed to request call status");
ofono_voicecall_register(ovc);
@@ -1316,7 +1314,7 @@ static void isi_voicecall_remove(struct ofono_voicecall *call)
{
struct isi_voicecall *data = ofono_voicecall_get_data(call);
- if (!data)
+ if (data == NULL)
return;
ofono_voicecall_set_data(call, NULL);
diff --git a/drivers/mbmmodem/gprs-context.c b/drivers/mbmmodem/gprs-context.c
index 553b7fd..0a1ca2c 100644
--- a/drivers/mbmmodem/gprs-context.c
+++ b/drivers/mbmmodem/gprs-context.c
@@ -364,7 +364,7 @@ static void mbm_gprs_activate_primary(struct ofono_gprs_context *gc,
DBG("cid %u", ctx->cid);
- if (!cbd)
+ if (cbd == NULL)
goto error;
gcd->active_context = ctx->cid;
@@ -408,7 +408,7 @@ static void mbm_gprs_deactivate_primary(struct ofono_gprs_context *gc,
DBG("cid %u", cid);
- if (!cbd)
+ if (cbd == NULL)
goto error;
cbd->user = gc;
@@ -471,7 +471,7 @@ static int mbm_gprs_context_probe(struct ofono_gprs_context *gc,
DBG("");
gcd = g_try_new0(struct gprs_context_data, 1);
- if (!gcd)
+ if (gcd == NULL)
return -ENOMEM;
gcd->chat = g_at_chat_clone(chat);
diff --git a/drivers/mbmmodem/stk.c b/drivers/mbmmodem/stk.c
index 87a2dd0..81c36db 100644
--- a/drivers/mbmmodem/stk.c
+++ b/drivers/mbmmodem/stk.c
@@ -88,7 +88,7 @@ static void mbm_stk_envelope(struct ofono_stk *stk, int length,
DBG("");
- if (!cbd || !buf)
+ if (cbd == NULL || buf == NULL)
goto error;
len = sprintf(buf, "AT*STKE=\"");
@@ -134,7 +134,7 @@ static void mbm_stk_terminal_response(struct ofono_stk *stk, int length,
DBG("");
- if (!cbd || !buf)
+ if (cbd == NULL || buf == NULL)
goto error;
len = sprintf(buf, "AT*STKR=\"");
@@ -236,7 +236,7 @@ static int mbm_stk_probe(struct ofono_stk *stk, unsigned int vendor, void *data)
DBG("");
sd = g_try_new0(struct stk_data, 1);
- if (!sd)
+ if (sd == NULL)
return -ENOMEM;
sd->chat = g_at_chat_clone(chat);
diff --git a/drivers/nwmodem/radio-settings.c b/drivers/nwmodem/radio-settings.c
index 2f5527e..36fab39 100644
--- a/drivers/nwmodem/radio-settings.c
+++ b/drivers/nwmodem/radio-settings.c
@@ -170,7 +170,7 @@ static int nw_radio_settings_probe(struct ofono_radio_settings *rs,
struct radio_settings_data *rsd;
rsd = g_try_new0(struct radio_settings_data, 1);
- if (!rsd)
+ if (rsd == NULL)
return -ENOMEM;
rsd->chat = g_at_chat_clone(chat);
diff --git a/drivers/stemodem/gprs-context.c b/drivers/stemodem/gprs-context.c
index 1675cd8..faa3124 100644
--- a/drivers/stemodem/gprs-context.c
+++ b/drivers/stemodem/gprs-context.c
@@ -158,7 +158,7 @@ static struct conn_info *conn_info_create(unsigned int device,
{
struct conn_info *connection = g_try_new0(struct conn_info, 1);
- if (!connection)
+ if (connection == NULL)
return NULL;
connection->cid = 0;
@@ -206,7 +206,7 @@ static void ste_eppsd_down_cb(gboolean ok, GAtResult *result,
GUINT_TO_POINTER(gcd->active_context),
conn_compare_by_cid);
- if (!l) {
+ if (l == NULL) {
DBG("Did not find data (used caif device) for"
"connection with cid; %d",
gcd->active_context);
@@ -247,7 +247,7 @@ static void ste_eppsd_up_cb(gboolean ok, GAtResult *result, gpointer user_data)
GUINT_TO_POINTER(gcd->active_context),
conn_compare_by_cid);
- if (!l) {
+ if (l == NULL) {
DBG("Did not find data (device and channel id)"
"for connection with cid; %d",
gcd->active_context);
@@ -344,7 +344,7 @@ static void ste_cgdcont_cb(gboolean ok, GAtResult *result, gpointer user_data)
l = g_slist_find_custom(g_caif_devices, GUINT_TO_POINTER(0),
conn_compare_by_cid);
- if (!l) {
+ if (l == NULL) {
DBG("at_cgdcont_cb, no more available devices");
goto error;
}
@@ -376,7 +376,7 @@ static void ste_gprs_activate_primary(struct ofono_gprs_context *gc,
char buf[AUTH_BUF_LENGTH];
int len;
- if (!cbd)
+ if (cbd == NULL)
goto error;
gcd->active_context = ctx->cid;
@@ -421,7 +421,7 @@ static void ste_gprs_deactivate_primary(struct ofono_gprs_context *gc,
char buf[64];
GSList *l;
- if (!cbd)
+ if (cbd == NULL)
goto error;
gcd->active_context = id;
@@ -430,7 +430,7 @@ static void ste_gprs_deactivate_primary(struct ofono_gprs_context *gc,
l = g_slist_find_custom(g_caif_devices, GUINT_TO_POINTER(id),
conn_compare_by_cid);
- if (!l) {
+ if (l == NULL) {
DBG("at_gprs_deactivate_primary, did not find"
"data (channel id) for connection with cid; %d", id);
goto error;
diff --git a/drivers/stemodem/radio-settings.c b/drivers/stemodem/radio-settings.c
index 5b16ec0..6377431 100644
--- a/drivers/stemodem/radio-settings.c
+++ b/drivers/stemodem/radio-settings.c
@@ -193,7 +193,7 @@ static int ste_radio_settings_probe(struct ofono_radio_settings *rs,
GAtChat *chat = data;
struct radio_settings_data *rsd;
rsd = g_try_new0(struct radio_settings_data, 1);
- if (!rsd)
+ if (rsd == NULL)
return -ENOMEM;
rsd->chat = chat;
diff --git a/drivers/stemodem/voicecall.c b/drivers/stemodem/voicecall.c
index b9d91d2..bf68f52 100644
--- a/drivers/stemodem/voicecall.c
+++ b/drivers/stemodem/voicecall.c
@@ -109,7 +109,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->type = type;
@@ -187,7 +187,7 @@ static void ste_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;
@@ -235,7 +235,7 @@ static void ste_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;
@@ -299,7 +299,7 @@ static void ste_release_specific(struct ofono_voicecall *vc, int id,
struct release_id_req *req = g_try_new0(struct release_id_req, 1);
char buf[32];
- if (!req)
+ if (req == NULL)
goto error;
req->vc = vc;
@@ -379,13 +379,13 @@ static void ste_send_dtmf(struct ofono_voicecall *vc, const char *dtmf,
int s;
char *buf;
- if (!cbd)
+ if (cbd == NULL)
goto error;
/* strlen("AT+VTS=) = 7 */
buf = g_try_new(char, len + 7);
- if (!buf)
+ if (buf == NULL)
goto error;
sprintf(buf, "AT+VTS=%s", dtmf);
@@ -506,7 +506,7 @@ static void ecav_notify(GAtResult *result, gpointer user_data)
new_call = create_call(vc, call_type, direction, status,
num, num_type, clip_validity);
- if (!new_call) {
+ if (new_call == NULL) {
ofono_error("Unable to malloc. "
"Call management is fubar");
return;
@@ -546,7 +546,7 @@ static int ste_voicecall_probe(struct ofono_voicecall *vc, unsigned int vendor,
struct voicecall_data *vd;
vd = g_try_new0(struct voicecall_data, 1);
- if (!vd)
+ if (vd == NULL)
return -ENOMEM;
vd->chat = g_at_chat_clone(chat);
--
1.7.3.2
^ permalink raw reply related [flat|nested] 20+ messages in thread