diff --git a/src/audio-settings.c b/src/audio-settings.c index ed3e7d16..5d590208 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 db32c0c3..bb155307 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 ce03c402..bb8aa37f 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; @@ -374,8 +374,7 @@ static DBusMessage *cf_get_properties_reply(DBusMessage *msg, int i; reply = dbus_message_new_method_return(msg); - - if (!reply) + if (reply == NULL) return NULL; dbus_message_iter_init_append(reply, &iter); @@ -436,7 +435,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 +633,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 +712,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 +904,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 +1006,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 +1015,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 568fe40f..ac3ae6b3 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 c6568336..49a7fb01 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); @@ -799,8 +799,7 @@ static DBusMessage *generate_get_properties_reply(struct ofono_call_settings *cs const char *str; reply = dbus_message_new_method_return(msg); - - if (!reply) + if (reply == NULL) return NULL; dbus_message_iter_init_append(reply, &iter); @@ -859,7 +858,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 +885,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 +906,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 +927,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 +948,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 6f692f32..1e12d810 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 50e78c29..8e4afc10 100644 --- a/src/cbs.c +++ b/src/cbs.c @@ -131,8 +131,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 +194,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( @@ -289,8 +288,7 @@ static DBusMessage *cbs_get_properties(DBusConnection *conn, char *topics; reply = dbus_message_new_method_return(msg); - - if (!reply) + if (reply == NULL) return NULL; dbus_message_iter_init_append(reply, &iter); @@ -386,7 +384,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 +414,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 +436,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 +453,8 @@ 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 +950,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 f32153cb..5154b8d8 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 ad292412..c24615f4 100644 --- a/src/dbus.c +++ b/src/dbus.c @@ -175,8 +175,7 @@ int ofono_dbus_signal_property_changed(DBusConnection *conn, DBusMessageIter iter; 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; @@ -202,8 +201,7 @@ int ofono_dbus_signal_array_property_changed(DBusConnection *conn, DBusMessageIter iter; 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; @@ -229,8 +227,7 @@ int ofono_dbus_signal_dict_property_changed(DBusConnection *conn, DBusMessageIter iter; 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 +423,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 7e42a99c..610f3b23 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 7d3c9278..3eb9a3da 100644 --- a/src/history.c +++ b/src/history.c @@ -105,8 +105,7 @@ void __ofono_history_probe_drivers(struct ofono_modem *modem) driver = l->data; 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 eca008ed..87fb0ab8 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 97a238c0..d8bfe34b 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 f032d93c..52e647ba 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 904deeef..06242596 100644 --- a/src/nettime.c +++ b/src/nettime.c @@ -77,8 +77,7 @@ void __ofono_nettime_probe_drivers(struct ofono_modem *modem) driver = l->data; 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 83014bbe..d5b42a1c 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) { @@ -1549,8 +1549,7 @@ static void sim_spn_read_cb(int ok, int length, int record, * paragraph as 51.101 and has an Annex B which we implement. */ spn = sim_string_to_utf8(data + 1, length - 1); - - if (!spn) { + if (spn == NULL) { ofono_error("EFspn read successfully, but couldn't parse"); return; } @@ -1772,8 +1771,7 @@ static void netreg_load_settings(struct ofono_netreg *netreg) int mode; 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 cae2b14c..e388ac1e 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) { @@ -277,8 +277,7 @@ static DBusMessage *generate_export_entries_reply(struct ofono_phonebook *pb, DBusMessageIter iter; reply = dbus_message_new_method_return(msg); - - if (!reply) + if (reply == NULL) return NULL; dbus_message_iter_init_append(reply, &iter); @@ -292,7 +291,7 @@ static gboolean need_merge(const char *text) int len; char c; - if (!text) + if (text == NULL) return FALSE; len = strlen(text); @@ -375,7 +374,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); @@ -444,8 +443,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 7c0652bb..25e9a5a2 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 5794221f..ff6934b4 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 bc7859c6..860f1790 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/sms.c b/src/sms.c index 12988c8d..7da66c61 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); @@ -265,8 +265,7 @@ static DBusMessage *message_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); @@ -330,7 +329,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); @@ -486,8 +485,7 @@ static DBusMessage *generate_get_properties_reply(struct ofono_sms *sms, const char *bearer; reply = dbus_message_new_method_return(msg); - - if (!reply) + if (reply == NULL) return NULL; dbus_message_iter_init_append(reply, &iter); @@ -541,7 +539,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 +830,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 +989,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 +1173,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 +1184,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); @@ -1324,8 +1322,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 +1332,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 +1354,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 +1362,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 +1486,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 +1497,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 bb0a3abd..9d6f21da 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/stk.c b/src/stk.c index 88b162c1..a4abb7d3 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 5cf83e48..83150400 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/ussd.c b/src/ussd.c index c4de1770..e0c89cd6 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,11 @@ 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 +141,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 +160,11 @@ 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 +176,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 +418,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 +428,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 +445,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 +469,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 +492,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 +532,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 +581,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 +607,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 +639,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 +694,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 +714,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 +891,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 +913,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/voicecall.c b/src/voicecall.c index a91f14ff..d52428f8 100644 --- a/src/voicecall.c +++ b/src/voicecall.c @@ -369,8 +369,7 @@ static DBusMessage *voicecall_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); @@ -398,7 +397,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 +422,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 +532,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) @@ -569,8 +568,7 @@ static struct voicecall *voicecall_create(struct ofono_voicecall *vc, struct voicecall *v; v = g_try_new0(struct voicecall, 1); - - if (!v) + if (v == NULL) return NULL; v->call = call; @@ -729,7 +727,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 +877,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 +955,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; @@ -997,8 +995,7 @@ static DBusMessage *manager_get_properties(DBusConnection *conn, char **list; reply = dbus_message_new_method_return(msg); - - if (!reply) + if (reply == NULL) return NULL; dbus_message_iter_init_append(reply, &iter); @@ -1046,8 +1043,7 @@ static struct ofono_call *synthesize_outgoing_call(struct ofono_voicecall *vc, struct ofono_call *call; call = g_try_new0(struct ofono_call, 1); - - if (!call) + if (call == NULL) return call; call->id = __ofono_modem_callid_next(modem); @@ -1102,11 +1098,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 +1174,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 +1221,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 +1261,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 +1282,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 +1310,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 +1444,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 +1456,7 @@ static DBusMessage *multiparty_private_chat(DBusConnection *conn, break; } - if (!l) + if (l == NULL) return __ofono_error_not_found(msg); /* @@ -1471,7 +1467,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 +1536,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 +1554,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 +1624,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 +1756,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; @@ -1838,15 +1834,13 @@ void ofono_voicecall_notify(struct ofono_voicecall *vc, __ofono_modem_callid_hold(modem, call->id); 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 +2357,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 +2413,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 +2425,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 +2471,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 +2498,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 */