{
struct hr_ndef *ndef = data;
- if (ndef != NULL)
+ if (ndef)
g_free(ndef->ndef);
g_free(ndef);
DBG("");
ndef = g_hash_table_lookup(hr_ndef_hash, GINT_TO_POINTER(client_fd));
- if (ndef == NULL)
+ if (!ndef)
return;
g_hash_table_remove(hr_ndef_hash, GINT_TO_POINTER(client_fd));
DBG("");
- if ((ndef->ndef == NULL) ||
+ if ((!ndef->ndef) ||
(ndef->cur_ptr < NDEF_HR_MSG_MIN_LENGTH)) {
err = -EINVAL;
goto fail;
/* call the global parse function */
records = near_ndef_parse_msg(ndef->ndef, ndef->cur_ptr, &msg);
- if (records == NULL) {
+ if (!records) {
err = -ENOMEM;
goto fail;
}
int err;
ndef = g_hash_table_lookup(hr_ndef_hash, GINT_TO_POINTER(client_fd));
- if (ndef == NULL) {
+ if (!ndef) {
near_error("hr_ndef should exist");
return false;
}
/* Next prepare read to complete the Hr */
new_ndef = g_try_realloc(ndef->ndef, ndef->cur_record_len +
NDEF_HR_MSG_MIN_LENGTH);
- if (new_ndef == NULL)
+ if (!new_ndef)
return false;
ndef->ndef = new_ndef;
/* Next prepare read to complete the NDEF */
new_ndef = g_try_realloc(ndef->ndef, ndef->cur_record_len
+ ndef_size);
- if (new_ndef == NULL)
+ if (!new_ndef)
return false;
ndef->ndef = new_ndef;
DBG("");
ndef = g_hash_table_lookup(hr_ndef_hash, GINT_TO_POINTER(client_fd));
- if (ndef == NULL)
+ if (!ndef)
return false;
/* Read remaining bytes */
/* Allocate the ndef structure */
ndef = g_try_malloc0(sizeof(struct hr_ndef));
- if (ndef == NULL)
+ if (!ndef)
goto fail;
/* Allocate and read frame header (6 bytes) */
ndef->ndef = g_try_malloc0(NDEF_HR_MSG_MIN_LENGTH);
- if (ndef->ndef == NULL)
+ if (!ndef->ndef)
goto fail;
/* Initialize default values */
/* Next prepare read to complete the read */
ndef->ndef = g_try_realloc(ndef->ndef, ndef->cur_record_len);
- if (ndef->ndef == NULL)
+ if (!ndef->ndef)
goto fail;
return true;
struct hr_ndef *ndef;
ndef = g_hash_table_lookup(hr_ndef_hash, GINT_TO_POINTER(client_fd));
- if (ndef == NULL) {
+ if (!ndef) {
/* First call: allocate and read header bytes */
return handover_read_initialize(client_fd, adapter_idx,
target_idx, cb);
DBG("");
client = g_try_malloc0(sizeof(struct hr_push_client));
- if (client == NULL)
+ if (!client)
return -ENOMEM;
channel = g_io_channel_unix_new(client_fd);
{
struct sdu *i_sdu = data;
- if (i_sdu == NULL)
+ if (!i_sdu)
return;
g_free(i_sdu->data);
struct sdu *i_sdu = data;
int err;
- if (i_sdu == NULL)
+ if (!i_sdu)
return;
/* conn less or oriented ? */
struct sdu *i_sdu;
i_sdu = g_try_malloc0(sizeof(struct sdu));
- if (i_sdu == NULL)
+ if (!i_sdu)
goto out_error;
i_sdu->len = len;
if (len > 0) {
i_sdu->data = g_try_malloc0(len);
- if (i_sdu->data == NULL)
+ if (!i_sdu->data)
goto out_error;
memcpy(i_sdu->data, clt->miu_buffer, len);
}
cx_client = g_hash_table_lookup(llcp_client_hash,
GINT_TO_POINTER(client_fd));
- if (cx_client == NULL) {
+ if (!cx_client) {
cx_client = g_try_malloc0(sizeof(struct co_cl_client_data));
- if (cx_client == NULL)
+ if (!cx_client)
goto error;
cx_client->fd = client_fd;
cx_client->miu_len = LLCP_DEFAULT_MIU;
cx_client->miu_buffer = g_try_malloc0(cx_client->miu_len);
- if (cx_client->miu_buffer == NULL) {
+ if (!cx_client->miu_buffer) {
DBG("Cannot allocate MIU buffer (size: %d)",
cx_client->miu_len);
goto error;
DBG("%p", cookie);
- if (cookie == NULL)
+ if (!cookie)
return err;
if (err < 0 && cookie->cb) {
/* Additional sectors to read ? */;
- if (mf_ck->g_sect_list != NULL && mf_ck->g_sect_list->next != NULL) {
+ if (mf_ck->g_sect_list && mf_ck->g_sect_list->next) {
err = mifare_read_sector(data, /* cookie */
mf_ck->nfc_data, /* where to store */
DBG("Done reading");
nfc_data = near_tag_get_data(mf_ck->tag, &nfc_data_length);
- if (nfc_data == NULL) {
+ if (!nfc_data) {
err = -ENOMEM;
goto out_err;
}
DBG("");
/* Parse MAD entries to get the global size and fill the array */
- if (mf_ck->mad_1 == NULL) {
+ if (!mf_ck->mad_1) {
err = -EINVAL;
goto out_err;
}
/* Now MAD 2 */
ioffset = MAD_V1_AIDS_LEN + 1 + 1; /* skip 0x10 */
- if (mf_ck->mad_2 == NULL)
+ if (!mf_ck->mad_2)
goto done_mad;
/*
DBG("TAG Global size: [%d]", global_tag_size);
mf_ck->tag = near_tag_get_tag(mf_ck->adapter_idx, mf_ck->target_idx);
- if (mf_ck->tag == NULL) {
+ if (!mf_ck->tag) {
err = -ENOMEM;
goto out_err;
}
/* don't allocate new data before writing */
tag_data = near_tag_get_data(mf_ck->tag, &data_size);
- if (tag_data == NULL) {
+ if (!tag_data) {
err = near_tag_add_data(mf_ck->adapter_idx,
mf_ck->target_idx,
NULL, /* Empty */
/* As auth is ok, allocate Mifare Access Directory v1 */
mf_ck->mad_2 = g_try_malloc0(STD_SECTOR_SIZE);
- if (mf_ck->mad_2 == NULL) {
+ if (!mf_ck->mad_2) {
near_error("Memory allocation failed (MAD2)");
err = -ENOMEM;
goto out_err;
* allocated size is also STD_SECTOR_SIZE
*/
mf_ck->mad_1 = g_try_malloc0(STD_SECTOR_SIZE);
- if (mf_ck->mad_1 == NULL) {
+ if (!mf_ck->mad_1) {
near_error("Memory allocation failed (MAD1)");
err = -ENOMEM;
goto out_err;
/* Alloc global cookie */
cookie = g_try_malloc0(sizeof(struct mifare_cookie));
- if (cookie == NULL)
+ if (!cookie)
return -ENOMEM;
/* Get the nfcid1 */
/* Alloc global cookie */
cookie = g_try_malloc0(sizeof(struct mifare_cookie));
- if (cookie == NULL)
+ if (!cookie)
return -ENOMEM;
/* Get the nfcid1 */
int err;
int sector_id;
- if (mf_ck->acc_sect->next != NULL) {
+ if (mf_ck->acc_sect->next) {
mf_ck->acc_sect = mf_ck->acc_sect->next;
sector_id = GPOINTER_TO_INT(mf_ck->acc_sect->data);
/* Alloc global cookie */
cookie = g_try_malloc0(sizeof(struct mifare_cookie));
- if (cookie == NULL)
+ if (!cookie)
return -ENOMEM;
/* Get the nfcid1 */
static void t1_init_cmd(struct type1_tag *tag, struct type1_cmd *cmd)
{
- if (tag == NULL || cmd == NULL)
+ if (!tag || !cmd)
return;
memcpy(cmd->uid, tag->uid, UID_LENGTH);
DBG("%p", cookie);
- if (cookie == NULL)
+ if (!cookie)
return err;
- if (cookie->cb != NULL)
+ if (cookie->cb)
cookie->cb(cookie->adapter_idx, cookie->target_idx, err);
if (cookie->ndef)
goto out_err;
tag = near_tag_get_tag(cookie->adapter_idx, cookie->target_idx);
- if (tag == NULL) {
+ if (!tag) {
err = -ENOMEM;
goto out_err;
}
t1_tag = g_try_malloc0(sizeof(struct type1_tag));
- if (t1_tag == NULL) {
+ if (!t1_tag) {
err = -ENOMEM;
goto out_err;
}
memset(&cmd, 0, sizeof(cmd));
cookie = g_try_malloc0(sizeof(struct t1_cookie));
- if (cookie == NULL)
+ if (!cookie)
return -ENOMEM;
cookie->adapter_idx = adapter_idx;
cookie->target_idx = target_idx;
cookie->cb = cb;
- if (uid != NULL) {
+ if (uid) {
cmd.cmd = CMD_READ_ALL; /* Read ALL cmd give 124 bytes */
memcpy(cmd.uid, uid, UID_LENGTH);
memcpy(cookie->uid, uid, UID_LENGTH);
DBG("");
uid = near_tag_get_nfcid(adapter_idx, target_idx, &uid_length);
- if (uid == NULL || uid_length != UID_LENGTH) {
- if (uid != NULL) {
+ if (!uid || uid_length != UID_LENGTH) {
+ if (uid) {
near_error("Invalid UID");
g_free(uid);
DBG("");
uid = near_tag_get_nfcid(adapter_idx, target_idx, &uid_length);
- if (uid == NULL || uid_length != UID_LENGTH) {
+ if (!uid || uid_length != UID_LENGTH) {
near_error("Invalid type 1 UID");
err = -EINVAL;
goto out_err;
memcpy(cmd.uid, uid, UID_LENGTH);
cookie = g_try_malloc0(sizeof(struct t1_cookie));
- if (cookie == NULL) {
+ if (!cookie) {
g_free(uid);
err = -ENOMEM;
goto out_err;
sizeof(cmd), data_write_resp, cookie,
t1_cookie_release);
out_err:
- if (cb != NULL)
+ if (cb)
cb(adapter_idx, target_idx, err);
return err;
DBG("");
- if (ndef == NULL || cb == NULL) {
+ if (!ndef || !cb) {
err = -EINVAL;
goto out_err;
}
tag = near_tag_get_tag(adapter_idx, target_idx);
- if (tag == NULL) {
+ if (!tag) {
err = -EINVAL;
goto out_err;
}
return 0;
out_err:
- if (cb != NULL)
+ if (cb)
cb(adapter_idx, target_idx, err);
return err;
DBG("");
uid = near_tag_get_nfcid(adapter_idx, target_idx, &uid_length);
- if (uid == NULL || uid_length != UID_LENGTH) {
+ if (!uid || uid_length != UID_LENGTH) {
near_error("Invalid type 1 UID");
return -EINVAL;
}
g_free(uid);
cookie = g_try_malloc0(sizeof(struct t1_cookie));
- if (cookie == NULL)
+ if (!cookie)
return -ENOMEM;
cookie->adapter_idx = adapter_idx;
t1_cookie_release);
} else {
tag = near_tag_get_tag(cookie->adapter_idx, cookie->target_idx);
- if (tag == NULL) {
+ if (!tag) {
err = -EINVAL;
goto out_err;
}
DBG("");
tag = near_tag_get_tag(adapter_idx, target_idx);
- if (tag == NULL)
+ if (!tag)
return -EINVAL;
/* TODO: Dynamic tag format */
return -EOPNOTSUPP;
uid = near_tag_get_nfcid(adapter_idx, target_idx, &uid_length);
- if (uid == NULL || uid_length != UID_LENGTH) {
+ if (!uid || uid_length != UID_LENGTH) {
near_error("Invalid type 1 UID");
return -EINVAL;
}
cookie = g_try_malloc0(sizeof(struct t1_cookie));
- if (cookie == NULL) {
+ if (!cookie) {
err = -EINVAL;
goto out_err;
}
DBG("%p", cookie);
- if (cookie == NULL)
+ if (!cookie)
return err;
- if (cookie->cb != NULL)
+ if (cookie->cb)
cookie->cb(cookie->adapter_idx, cookie->target_idx, err);
if (cookie->ndef)
goto out_err;
tag = near_tag_get_tag(cookie->adapter_idx, cookie->target_idx);
- if (tag == NULL) {
+ if (!tag) {
err = -ENOMEM;
goto out_err;
}
t2_tag = g_try_malloc0(sizeof(struct type2_tag));
- if (t2_tag == NULL) {
+ if (!t2_tag) {
err = -ENOMEM;
goto out_err;
}
cmd.block = META_BLOCK_START;
cookie = g_try_malloc0(sizeof(struct t2_cookie));
- if (cookie == NULL)
+ if (!cookie)
return -ENOMEM;
cookie->adapter_idx = adapter_idx;
DBG("");
cookie = g_try_malloc0(sizeof(struct t2_cookie));
- if (cookie == NULL) {
+ if (!cookie) {
err = -ENOMEM;
- if (cb != NULL)
+ if (cb)
cb(adapter_idx, target_idx, err);
return err;
}
DBG("");
- if (ndef == NULL || cb == NULL) {
+ if (!ndef || !cb) {
err = -EINVAL;
goto out_err;
}
tag = near_tag_get_tag(adapter_idx, target_idx);
- if (tag == NULL) {
+ if (!tag) {
err = -EINVAL;
goto out_err;
}
return 0;
out_err:
- if (cb != NULL)
+ if (cb)
cb(adapter_idx, target_idx, err);
return err;
cmd.block = META_BLOCK_START;
cookie = g_try_malloc0(sizeof(struct t2_cookie));
- if (cookie == NULL)
+ if (!cookie)
return -ENOMEM;
cookie->adapter_idx = adapter_idx;
}
tag = near_tag_get_tag(cookie->adapter_idx, cookie->target_idx);
- if (tag == NULL) {
+ if (!tag) {
err = -EINVAL;
goto out_err;
}
DBG("");
tag = near_tag_get_tag(adapter_idx, target_idx);
- if (tag == NULL)
+ if (!tag)
return -EINVAL;
cc_ndef = g_try_malloc0(sizeof(struct near_ndef_message));
cookie = g_try_malloc0(sizeof(struct t2_cookie));
- if (t2_cc == NULL || cc_ndef == NULL || cookie == NULL) {
+ if (!t2_cc || !cc_ndef || !cookie) {
err = -ENOMEM;
goto out_err;
}
DBG("%p", cookie);
- if (cookie == NULL)
+ if (!cookie)
return err;
- if (cookie->cb != NULL)
+ if (cookie->cb)
cookie->cb(cookie->adapter_idx, cookie->target_idx, err);
- if (cookie->ndef != NULL)
+ if (cookie->ndef)
g_free(cookie->ndef->data);
g_free(cookie->ndef);
goto out_err;
tag = near_tag_get_tag(cookie->adapter_idx, cookie->target_idx);
- if (tag == NULL) {
+ if (!tag) {
err = -ENOMEM;
goto out_err;
}
near_tag_set_ro(tag, FALSE);
t3_tag = g_try_malloc0(sizeof(struct type3_tag));
- if (t3_tag == NULL) {
+ if (!t3_tag) {
err = -ENOMEM;
goto out_err;
}
tag = near_tag_get_tag(cookie->adapter_idx,
cookie->target_idx);
- if (tag == NULL) {
+ if (!tag) {
err = -ENOMEM;
goto out_err;
}
cmd.len = LEN_CMD + LEN_CMD_LEN + 4;
cookie = g_try_malloc0(sizeof(struct t3_cookie));
- if (cookie == NULL)
+ if (!cookie)
return -ENOMEM;
cookie->adapter_idx = adapter_idx;
cookie = g_try_malloc0(sizeof(struct t3_cookie));
- if (cookie == NULL) {
+ if (!cookie) {
err = -ENOMEM;
- if (cb != NULL)
+ if (cb)
cb(adapter_idx, target_idx, err);
return err;
cookie->current_block = 0;
idm = near_tag_get_idm(tag, &len);
- if (idm == NULL)
+ if (!idm)
return t3_cookie_release(-EINVAL, cookie);
memcpy(cookie->IDm, idm, len);
attr = near_tag_get_attr_block(tag, &len);
- if (attr == NULL)
+ if (!attr)
return t3_cookie_release(-EINVAL, cookie);
memcpy(cookie->attr, attr, len);
DBG("");
- if (ndef == NULL || cb == NULL) {
+ if (!ndef || !cb) {
err = -EINVAL;
goto out_err;
}
tag = near_tag_get_tag(adapter_idx, target_idx);
- if (tag == NULL) {
+ if (!tag) {
err = -EINVAL;
goto out_err;
}
err = data_write(adapter_idx, target_idx, ndef, tag, cb);
out_err:
- if (cb != NULL && err < 0)
+ if (cb && err < 0)
cb(adapter_idx, target_idx, err);
return err;
cmd.len = LEN_CMD + LEN_CMD_LEN + 4 ;
cookie = g_try_malloc0(sizeof(struct t3_cookie));
- if (cookie == NULL)
+ if (!cookie)
return -ENOMEM;
cookie->adapter_idx = adapter_idx;
goto out_err;
tag = near_tag_get_tag(cookie->adapter_idx, cookie->target_idx);
- if (tag == NULL) {
+ if (!tag) {
err = -ENOMEM;
goto out_err;
}
DBG("");
tag = near_tag_get_tag(adapter_idx, target_idx);
- if (tag == NULL)
+ if (!tag)
return -ENOMEM;
ic_type = near_tag_get_ic_type(tag);
return -EOPNOTSUPP;
cookie = g_try_malloc0(sizeof(struct t3_cookie));
- if (cookie == NULL)
+ if (!cookie)
return -ENOMEM;
cookie->adapter_idx = adapter_idx;
cookie->ic_type = ic_type;
idm = near_tag_get_idm(tag, &len);
- if (idm == NULL)
+ if (!idm)
return t3_cookie_release(-EINVAL, cookie);
memcpy(cookie->IDm, idm, len);
DBG("%p", cookie);
- if (cookie == NULL)
+ if (!cookie)
return err;
if (err < 0 && cookie->cb)
}
cmd = g_try_malloc0(total_cmd_length);
- if (cmd == NULL) {
+ if (!cmd) {
DBG("Mem alloc failed");
err = -ENOMEM;
goto out_err;
return t4_cookie_release(err, cookie);
tag = near_tag_get_tag(cookie->adapter_idx, cookie->target_idx);
- if (tag == NULL)
+ if (!tag)
return t4_cookie_release(-ENOMEM, cookie);
near_tag_set_max_ndef_size(tag, cookie->max_ndef_size);
/* -2 for status word and -1 is for NFC first byte... */
read_cc = g_try_malloc0(length - 2 - NFC_STATUS_BYTE_LEN);
- if (read_cc == NULL) {
+ if (!read_cc) {
DBG("Mem alloc failed");
return t4_cookie_release(-ENOMEM, cookie);
cookie->tag = near_tag_get_tag(cookie->adapter_idx,
cookie->target_idx);
- if (cookie->tag == NULL)
+ if (!cookie->tag)
return t4_cookie_release(-ENOMEM, cookie);
near_tag_set_blank(cookie->tag, TRUE);
DBG("");
cookie = g_try_malloc0(sizeof(struct t4_cookie));
- if (cookie == NULL)
+ if (!cookie)
return -ENOMEM;
cookie->adapter_idx = adapter_idx;
cookie = g_try_malloc0(sizeof(struct t4_cookie));
- if (cookie == NULL) {
+ if (!cookie) {
err = -ENOMEM;
- if (cb != NULL)
+ if (cb)
cb(adapter_idx, target_idx, err);
return err;
DBG("");
- if (ndef == NULL || cb == NULL) {
+ if (!ndef || !cb) {
err = -EINVAL;
goto out_err;
}
tag = near_tag_get_tag(adapter_idx, target_idx);
- if (tag == NULL) {
+ if (!tag) {
err = -EINVAL;
goto out_err;
}
err = data_write(adapter_idx, target_idx, ndef, tag, cb);
out_err:
- if (cb != NULL)
+ if (cb)
cb(adapter_idx, target_idx, err);
return err;
DBG("");
cookie = g_try_malloc0(sizeof(struct t4_cookie));
- if (cookie == NULL)
+ if (!cookie)
return -ENOMEM;
cookie->adapter_idx = adapter_idx;
/* -2 for status word and -1 is for NFC first byte... */
read_cc = g_try_malloc0(length - 2 - NFC_STATUS_BYTE_LEN);
- if (read_cc == NULL) {
+ if (!read_cc) {
err = -ENOMEM;
goto out_err;
}
cookie->max_ndef_size = g_ntohs(read_cc->tlv_fc.max_ndef_size);
tag = near_tag_get_tag(cookie->adapter_idx, cookie->target_idx);
- if (tag == NULL) {
+ if (!tag) {
err = -EINVAL;
goto out_err;
}
}
tag = near_tag_get_tag(cookie->adapter_idx, cookie->target_idx);
- if (tag == NULL)
+ if (!tag)
return t4_cookie_release(-EINVAL, cookie);
DBG("Formatting is done");
+ ARRAY_SIZE(ndef_nlen);
cmd_data = g_try_malloc0(cmd_data_length);
- if (cmd_data == NULL) {
+ if (!cmd_data) {
err = -ENOMEM;
goto out_err;
}
}
ndef = g_try_malloc0(sizeof(struct desfire_std_file));
- if (ndef == NULL) {
+ if (!ndef) {
err = -ENOMEM;
goto out_err;
}
}
cc = g_try_malloc0(sizeof(struct desfire_cc_file));
- if (cc == NULL) {
+ if (!cc) {
err = -ENOMEM;
goto out_err;
}
}
cc = g_try_malloc0(sizeof(struct desfire_std_file));
- if (cc == NULL) {
+ if (!cc) {
err = -ENOMEM;
goto out_err;
}
/* Step4 : Select application (which is created just now) */
cmd_data_length = ARRAY_SIZE(desfire_aid_1);
cmd_data = g_try_malloc0(cmd_data_length);
- if (cmd_data == NULL) {
+ if (!cmd_data) {
err = -ENOMEM;
goto out_err;
}
}
app = g_try_malloc0(sizeof(struct desfire_app));
- if (app == NULL) {
+ if (!app) {
err = -ENOMEM;
goto out_err;
}
/* AID : 000000h */
cmd_data_length = ARRAY_SIZE(desfire_aid);
cmd_data = g_try_malloc0(cmd_data_length);
- if (cmd_data == NULL) {
+ if (!cmd_data) {
err = -ENOMEM;
goto out_err;
}
DBG("");
cookie = g_try_malloc0(sizeof(struct t4_cookie));
- if (cookie == NULL)
+ if (!cookie)
return -ENOMEM;
cookie->adapter_idx = adapter_idx;
DBG("NDEF %d length %d", i, ndef_length);
new_ndefs = g_try_realloc(ndefs, total_ndef_length);
- if (new_ndefs == NULL) {
+ if (!new_ndefs) {
near_error("Could not allocate NDEF buffer %d",
bytes_recv);
err = -ENOMEM;
return false;
device = near_device_get_device(adapter_idx, target_idx);
- if (device == NULL) {
+ if (!device) {
g_free(ndefs);
return -ENOMEM;
}
else
err = 0;
- if (client_data->driver->close != NULL)
+ if (client_data->driver->close)
client_data->driver->close(client_data->fd, err);
near_error("%s client channel closed",
client_data = (struct p2p_data *) data;
- if (client_data->driver->close != NULL)
+ if (client_data->driver->close)
client_data->driver->close(client_data->fd, 0);
if (client_data->watch > 0)
DBG("target idx %d", client_addr.target_idx);
client_data = g_try_malloc0(sizeof(struct p2p_data));
- if (client_data == NULL) {
+ if (!client_data) {
close(client_fd);
return FALSE;
}
DBG("condition 0x%x", condition);
- if (conn->driver->push == NULL) {
+ if (!conn->driver->push) {
err = -EOPNOTSUPP;
goto out;
}
return -errno;
server_data = g_try_malloc0(sizeof(struct p2p_data));
- if (server_data == NULL) {
+ if (!server_data) {
close(fd);
return -ENOMEM;
}
int err = -1, bind_err;
GSList *list;
- for (list = driver_list; list != NULL; list = list->next) {
+ for (list = driver_list; list; list = list->next) {
struct near_p2p_driver *driver = list->data;
bind_err = p2p_bind(driver, adapter_idx, cb);
return -errno;
conn = g_try_malloc0(sizeof(struct p2p_connect));
- if (conn == NULL) {
+ if (!conn) {
close(fd);
return -ENOMEM;
}
DBG("");
- for (list = driver_list; list != NULL; list = list->next) {
+ for (list = driver_list; list; list = list->next) {
struct near_p2p_driver *driver = list->data;
if (strcmp(driver->service_name, service_name) != 0)
if (fd > 0)
return fd;
- if (driver->fallback_service_name != NULL)
+ if (driver->fallback_service_name)
return p2p_push(adapter_idx, target_idx, ndef,
(char *) driver->fallback_service_name,
cb);
{
GList *old_ndefs = data;
- if (old_ndefs != NULL)
+ if (old_ndefs)
g_list_free(old_ndefs);
}
DBG("");
- if (snep_data->nfc_data == NULL)
+ if (!snep_data->nfc_data)
goto error;
/*
recd = records->data;
- if (recd == NULL) {
+ if (!recd) {
g_list_free(records);
goto error;
}
}
recd = records->data;
- if (recd == NULL) {
+ if (!recd) {
g_list_free(records);
goto error;
}
incoming_ndefs = g_hash_table_lookup(snep_validation_hash,
GINT_TO_POINTER(client_fd));
- if (incoming_ndefs == NULL)
+ if (!incoming_ndefs)
goto done;
/* Now, loop to find the the associated record */
device = near_device_get_device(snep_data->adapter_idx,
snep_data->target_idx);
- if (device == NULL)
+ if (!device)
return false;
records = near_ndef_parse_msg(snep_data->nfc_data,