summaryrefslogtreecommitdiff
path: root/gisi
diff options
context:
space:
mode:
authorAki Niemi <aki.niemi@nokia.com>2010-12-03 09:53:32 +0200
committerAki Niemi <aki.niemi@nokia.com>2010-12-22 17:13:48 +0200
commit7d6e163184d09a605b051607b17e919ce734dd72 (patch)
treee55ec4bbdd7443dd573b0703eba3498a4fec3933 /gisi
parent0bfc0ea48774cb7711261efb2ad8f06bda7a3771 (diff)
gisi: Explicit compare to NULL
Diffstat (limited to 'gisi')
-rw-r--r--gisi/client.c51
-rw-r--r--gisi/iter.c8
-rw-r--r--gisi/message.c47
-rw-r--r--gisi/modem.c58
-rw-r--r--gisi/netlink.c2
-rw-r--r--gisi/pep.c2
-rw-r--r--gisi/pipe.c15
-rw-r--r--gisi/server.c30
8 files changed, 116 insertions, 97 deletions
diff --git a/gisi/client.c b/gisi/client.c
index e536d4e3..267bfc5e 100644
--- a/gisi/client.c
+++ b/gisi/client.c
@@ -49,10 +49,10 @@ static void pending_destroy(gpointer data)
{
struct pending_data *pd = data;
- if (!pd)
+ if (pd == NULL)
return;
- if (pd->destroy)
+ if (pd->destroy != NULL)
pd->destroy(pd->data);
g_free(pd);
@@ -62,10 +62,10 @@ static void pending_resp_notify(const GIsiMessage *msg, void *data)
{
struct pending_data *pd = data;
- if (!pd)
+ if (pd == NULL)
return;
- if (pd->notify)
+ if (pd->notify != NULL)
pd->notify(msg, pd->data);
pd->client->pending = g_slist_remove(pd->client->pending,
@@ -76,34 +76,34 @@ static void pending_notify(const GIsiMessage *msg, void *data)
{
struct pending_data *pd = data;
- if (!pd)
+ if (pd == NULL)
return;
- if (pd->notify)
+ if (pd->notify != NULL)
pd->notify(msg, pd->data);
}
uint8_t g_isi_client_resource(GIsiClient *client)
{
- return client ? client->resource : 0;
+ return client != NULL ? client->resource : 0;
}
GIsiModem *g_isi_client_modem(GIsiClient *client)
{
- return client ? client->modem : NULL;
+ return client != NULL ? client->modem : NULL;
}
GIsiClient *g_isi_client_create(GIsiModem *modem, uint8_t resource)
{
GIsiClient *client;
- if (!modem) {
+ if (modem == NULL) {
errno = EINVAL;
return NULL;
}
client = g_try_new0(GIsiClient, 1);
- if (!client) {
+ if (client == NULL) {
errno = ENOMEM;
return NULL;
}
@@ -120,7 +120,7 @@ static void foreach_destroy(gpointer value, gpointer user)
GIsiPending *op = value;
GIsiClient *client = user;
- if (!op || !client)
+ if (op == NULL || client == NULL)
return;
client->pending = g_slist_remove(client->pending, op);
@@ -129,10 +129,7 @@ static void foreach_destroy(gpointer value, gpointer user)
void g_isi_client_reset(GIsiClient *client)
{
- if (client == NULL)
- return;
-
- if (!client->pending)
+ if (client == NULL || client->pending == NULL)
return;
g_slist_foreach(client->pending, foreach_destroy, client);
@@ -142,7 +139,7 @@ void g_isi_client_reset(GIsiClient *client)
void g_isi_client_destroy(GIsiClient *client)
{
- if (!client)
+ if (client == NULL)
return;
g_isi_client_reset(client);
@@ -162,7 +159,7 @@ static struct pending_data *pending_data_create(GIsiClient *client,
}
pd = g_try_new0(struct pending_data, 1);
- if (!pd) {
+ if (pd == NULL) {
errno = ENOMEM;
return NULL;
}
@@ -184,12 +181,12 @@ GIsiPending *g_isi_client_send(GIsiClient *client, const void *__restrict buf,
GIsiPending *op;
pd = pending_data_create(client, notify, data, destroy);
- if (!pd)
+ if (pd == NULL)
return NULL;
op = g_isi_request_send(client->modem, client->resource, buf, len, timeout,
pending_resp_notify, pd, pending_destroy);
- if (!op) {
+ if (op == NULL) {
g_free(pd);
return NULL;
}
@@ -208,13 +205,13 @@ GIsiPending *g_isi_client_vsend(GIsiClient *client,
GIsiPending *op;
pd = pending_data_create(client, notify, data, destroy);
- if (!pd)
+ if (pd == NULL)
return NULL;
op = g_isi_request_vsend(client->modem, client->resource, iov, iovlen,
timeout, pending_resp_notify, pd,
pending_destroy);
- if (!op) {
+ if (op == NULL) {
g_free(pd);
return NULL;
}
@@ -230,12 +227,12 @@ GIsiPending *g_isi_client_ind_subscribe(GIsiClient *client, uint8_t type,
GIsiPending *op;
pd = pending_data_create(client, notify, data, NULL);
- if (!pd)
+ if (pd == NULL)
return NULL;
op = g_isi_ind_subscribe(client->modem, client->resource, type,
pending_notify, pd, pending_destroy);
- if (!op) {
+ if (op == NULL) {
g_free(pd);
return NULL;
}
@@ -251,12 +248,12 @@ GIsiPending *g_isi_client_ntf_subscribe(GIsiClient *client, uint8_t type,
GIsiPending *op;
pd = pending_data_create(client, notify, data, NULL);
- if (!pd)
+ if (pd == NULL)
return NULL;
op = g_isi_ntf_subscribe(client->modem, client->resource, type,
pending_notify, pd, pending_destroy);
- if (!op) {
+ if (op == NULL) {
g_free(pd);
return NULL;
}
@@ -272,13 +269,13 @@ GIsiPending *g_isi_client_verify(GIsiClient *client, GIsiNotifyFunc notify,
GIsiPending *op;
pd = pending_data_create(client, notify, data, destroy);
- if (!pd)
+ if (pd == NULL)
return NULL;
op = g_isi_resource_ping(client->modem, client->resource,
pending_resp_notify, pd,
pending_destroy);
- if (!op) {
+ if (op == NULL) {
g_free(pd);
return NULL;
}
diff --git a/gisi/iter.c b/gisi/iter.c
index 53e4c3b3..d9c111fd 100644
--- a/gisi/iter.c
+++ b/gisi/iter.c
@@ -52,7 +52,7 @@ void g_isi_sb_iter_init_full(GIsiSubBlockIter *iter, const GIsiMessage *msg,
const uint8_t *data = g_isi_msg_data(msg);
size_t len = g_isi_msg_data_len(msg);
- if (!data)
+ if (data == NULL)
len = used = 0;
iter->start = (uint8_t *)data + used;
@@ -67,7 +67,7 @@ void g_isi_sb_iter_init(GIsiSubBlockIter *iter, const GIsiMessage *msg,
const uint8_t *data = g_isi_msg_data(msg);
size_t len = g_isi_msg_data_len(msg);
- if (!data)
+ if (data == NULL)
len = used = 0;
iter->start = (uint8_t *)data + used;
@@ -204,7 +204,7 @@ gboolean g_isi_sb_iter_get_alpha_tag(const GIsiSubBlockIter *restrict iter,
if (pos > g_isi_sb_iter_get_len(iter))
return FALSE;
- if (!utf8 || len == 0 || pos + len > g_isi_sb_iter_get_len(iter))
+ if (utf8 == NULL || len == 0 || pos + len > g_isi_sb_iter_get_len(iter))
return FALSE;
ucs2 = iter->start + pos;
@@ -224,7 +224,7 @@ gboolean g_isi_sb_iter_get_latin_tag(const GIsiSubBlockIter *restrict iter,
if (pos > g_isi_sb_iter_get_len(iter))
return FALSE;
- if (!latin || len == 0 || pos + len > g_isi_sb_iter_get_len(iter))
+ if (latin == NULL || len == 0 || pos + len > g_isi_sb_iter_get_len(iter))
return FALSE;
str = iter->start + pos;
diff --git a/gisi/message.c b/gisi/message.c
index 01f3a277..8f4fe5a7 100644
--- a/gisi/message.c
+++ b/gisi/message.c
@@ -33,17 +33,23 @@
int g_isi_msg_version_major(const GIsiMessage *msg)
{
- return msg && msg->version ? msg->version->major : -1;
+ if (msg == NULL || msg->version == NULL)
+ return -1;
+
+ return msg->version->major;
}
int g_isi_msg_version_minor(const GIsiMessage *msg)
{
- return msg && msg->version ? msg->version->minor : -1;
+ if (msg == NULL || msg->version == NULL)
+ return -1;
+
+ return msg->version->minor;
}
int g_isi_msg_error(const GIsiMessage *msg)
{
- return msg ? -msg->error : -EINVAL;
+ return msg != NULL ? -msg->error : -EINVAL;
}
const char *g_isi_msg_strerror(const GIsiMessage *msg)
@@ -53,19 +59,25 @@ const char *g_isi_msg_strerror(const GIsiMessage *msg)
uint8_t g_isi_msg_resource(const GIsiMessage *msg)
{
- return msg && msg->addr ? msg->addr->spn_resource : 0;
+ if (msg == NULL || msg->addr == NULL)
+ return 0;
+
+ return msg->addr->spn_resource;
}
uint16_t g_isi_msg_object(const GIsiMessage *msg)
{
- return msg && msg->addr ? (msg->addr->spn_dev << 8) | msg->addr->spn_obj : 0;
+ if (msg == NULL || msg->addr == NULL)
+ return 0;
+
+ return (msg->addr->spn_dev << 8) | msg->addr->spn_obj;
}
uint8_t g_isi_msg_id(const GIsiMessage *msg)
{
const uint8_t *buf;
- if (!msg || !msg->data || msg->len < 2)
+ if (msg == NULL || msg->data == NULL || msg->len < 2)
return 0;
buf = msg->data;
@@ -77,7 +89,7 @@ uint8_t g_isi_msg_utid(const GIsiMessage *msg)
{
const uint8_t *buf;
- if (!msg || !msg->data || msg->len < 2)
+ if (msg == NULL || msg->data == NULL || msg->len < 2)
return 0;
buf = msg->data;
@@ -87,12 +99,18 @@ uint8_t g_isi_msg_utid(const GIsiMessage *msg)
size_t g_isi_msg_data_len(const GIsiMessage *msg)
{
- return msg && msg->data ? msg->len - 2 : 0;
+ if (msg == NULL || msg->data == NULL)
+ return 0;
+
+ return msg->len - 2;
}
const void *g_isi_msg_data(const GIsiMessage *msg)
{
- return msg && msg->data ? (void *)msg->data + 2 : NULL;
+ if (msg == NULL || msg->data == NULL)
+ return NULL;
+
+ return (void *)msg->data + 2;
}
gboolean g_isi_msg_data_get_byte(const GIsiMessage *msg, unsigned offset,
@@ -100,10 +118,10 @@ gboolean g_isi_msg_data_get_byte(const GIsiMessage *msg, unsigned offset,
{
const uint8_t *buf = g_isi_msg_data(msg);
- if (!buf || g_isi_msg_data_len(msg) < offset)
+ if (buf == NULL || g_isi_msg_data_len(msg) < offset)
return FALSE;
- if (byte)
+ if (byte != NULL)
*byte = buf[offset];
return TRUE;
@@ -115,11 +133,12 @@ gboolean g_isi_msg_data_get_word(const GIsiMessage *msg, unsigned offset,
const uint8_t *buf = g_isi_msg_data(msg);
uint16_t val;
- if (!buf || g_isi_msg_data_len(msg) < offset + 1)
+ if (buf == NULL || g_isi_msg_data_len(msg) < offset + 1)
return FALSE;
memcpy(&val, buf + offset, sizeof(uint16_t));
- if (word)
+
+ if (word != NULL)
*word = ntohs(val);
return TRUE;
@@ -131,7 +150,7 @@ gboolean g_isi_msg_data_get_struct(const GIsiMessage *msg, unsigned offset,
if (g_isi_msg_data_len(msg) < offset + len)
return FALSE;
- if (type)
+ if (type != NULL)
*type = g_isi_msg_data(msg) + offset;
return TRUE;
diff --git a/gisi/modem.c b/gisi/modem.c
index 473ca295..d3e15a4b 100644
--- a/gisi/modem.c
+++ b/gisi/modem.c
@@ -93,11 +93,11 @@ static GIsiServiceMux *service_get(GIsiModem *modem, uint8_t resource)
int key = resource;
mux = g_hash_table_lookup(modem->services, GINT_TO_POINTER(key));
- if (mux)
+ if (mux != NULL)
return mux;
mux = g_try_new0(GIsiServiceMux, 1);
- if (!mux)
+ if (mux == NULL)
return NULL;
g_hash_table_insert(modem->services, GINT_TO_POINTER(key), mux);
@@ -136,7 +136,7 @@ static void service_dispatch(GIsiServiceMux *mux, GIsiMessage *msg,
GSList *l = mux->pending;
- while (l) {
+ while (l != NULL) {
GSList *next = l->next;
GIsiPending *pend = l->data;
msg->private = pend;
@@ -348,13 +348,13 @@ static void pending_destroy(gpointer value, gpointer user)
{
GIsiPending *op = value;
- if (!op)
+ if (op == NULL)
return;
if (op->timeout > 0)
g_source_remove(op->timeout);
- if (op->destroy)
+ if (op->destroy != NULL)
op->destroy(op->data);
g_free(op);
@@ -388,7 +388,7 @@ GIsiModem *g_isi_modem_create(unsigned index)
}
modem = g_try_new0(GIsiModem, 1);
- if (!modem) {
+ if (modem == NULL) {
errno = ENOMEM;
return NULL;
}
@@ -396,7 +396,7 @@ GIsiModem *g_isi_modem_create(unsigned index)
inds = g_isi_phonet_new(index);
reqs = g_isi_phonet_new(index);
- if (!inds || !reqs) {
+ if (inds == NULL || reqs == NULL) {
g_free(modem);
return NULL;
}
@@ -490,7 +490,7 @@ static void service_regs_decr(GIsiServiceMux *mux)
void g_isi_modem_destroy(GIsiModem *modem)
{
- if (!modem)
+ if (modem == NULL)
return;
g_hash_table_remove_all(modem->services);
@@ -502,10 +502,10 @@ void g_isi_modem_destroy(GIsiModem *modem)
g_hash_table_unref(modem->services);
- if (modem->ind_watch)
+ if (modem->ind_watch > 0)
g_source_remove(modem->ind_watch);
- if (modem->req_watch)
+ if (modem->req_watch > 0)
g_source_remove(modem->req_watch);
g_free(modem);
@@ -513,7 +513,7 @@ void g_isi_modem_destroy(GIsiModem *modem)
unsigned g_isi_modem_index(GIsiModem *modem)
{
- return modem ? modem->index : 0;
+ return modem != NULL ? modem->index : 0;
}
GIsiPending *g_isi_request_send(GIsiModem *modem, uint8_t resource,
@@ -617,19 +617,19 @@ GIsiPending *g_isi_request_vsendto(GIsiModem *modem, struct sockaddr_pn *dst,
GIsiServiceMux *mux;
GIsiPending *resp;
- if (!modem) {
+ if (modem == NULL) {
errno = EINVAL;
return NULL;
}
mux = service_get(modem, dst->spn_resource);
- if (!mux) {
+ if (mux == NULL) {
errno = ENOMEM;
return NULL;
}
resp = g_try_new0(GIsiPending, 1);
- if (!resp) {
+ if (resp == NULL) {
errno = ENOMEM;
return NULL;
}
@@ -675,7 +675,7 @@ GIsiPending *g_isi_request_vsendto(GIsiModem *modem, struct sockaddr_pn *dst,
mux->pending = g_slist_prepend(mux->pending, resp);
- if (timeout)
+ if (timeout > 0)
resp->timeout = g_timeout_add_seconds(timeout, resp_timeout, resp);
mux->last_utid = resp->utid;
@@ -688,17 +688,17 @@ error:
uint8_t g_isi_request_utid(GIsiPending *resp)
{
- return resp ? resp->utid : 0;
+ return resp != NULL ? resp->utid : 0;
}
GIsiPending *g_isi_pending_from_msg(const GIsiMessage *msg)
{
- return msg ? msg->private : NULL;
+ return msg != NULL ? msg->private : NULL;
}
void g_isi_pending_remove(GIsiPending *op)
{
- if (!op)
+ if (op == NULL)
return;
op->service->pending = g_slist_remove(op->service->pending, op);
@@ -709,7 +709,7 @@ void g_isi_pending_remove(GIsiPending *op)
if (op->type == GISI_MESSAGE_TYPE_REQ)
service_regs_decr(op->service);
- if (op->type == GISI_MESSAGE_TYPE_RESP && op->notify) {
+ if (op->type == GISI_MESSAGE_TYPE_RESP && op->notify != NULL) {
GIsiMessage msg = {
.error = ESHUTDOWN,
.private = op,
@@ -729,13 +729,13 @@ GIsiPending *g_isi_ntf_subscribe(GIsiModem *modem, uint8_t resource,
GIsiPending *ntf;
mux = service_get(modem, resource);
- if (!mux) {
+ if (mux == NULL) {
errno = ENOMEM;
return NULL;
}
ntf = g_try_new0(GIsiPending, 1);
- if (!ntf) {
+ if (ntf == NULL) {
errno = ENOMEM;
return NULL;
}
@@ -760,13 +760,13 @@ GIsiPending *g_isi_service_bind(GIsiModem *modem, uint8_t resource,
GIsiPending *srv;
mux = service_get(modem, resource);
- if (!mux) {
+ if (mux == NULL) {
errno = ENOMEM;
return NULL;
}
srv = g_try_new0(GIsiPending, 1);
- if (!srv) {
+ if (srv == NULL) {
errno = ENOMEM;
return NULL;
}
@@ -793,13 +793,13 @@ GIsiPending *g_isi_ind_subscribe(GIsiModem *modem, uint8_t resource,
GIsiPending *ind;
mux = service_get(modem, resource);
- if (!mux) {
+ if (mux == NULL) {
errno = ENOMEM;
return NULL;
}
ind = g_try_new0(GIsiPending, 1);
- if (!ind) {
+ if (ind == NULL) {
errno = ENOMEM;
return NULL;
}
@@ -876,11 +876,11 @@ int g_isi_modem_vsendto(GIsiModem *modem, struct sockaddr_pn *dst,
size_t i, len;
GIsiServiceMux *mux;
- if (!modem)
+ if (modem == NULL)
return -EINVAL;
mux = service_get(modem, dst->spn_resource);
- if (!mux)
+ if (mux == NULL)
return -ENOMEM;
for (i = 0, len = 0; i < iovlen; i++)
@@ -972,13 +972,13 @@ GIsiPending *g_isi_resource_ping(GIsiModem *modem, uint8_t resource,
int ret;
mux = service_get(modem, resource);
- if (!mux) {
+ if (mux == NULL) {
errno = ENOMEM;
return NULL;
}
ping = g_try_new0(GIsiPending, 1);
- if (!ping) {
+ if (ping == NULL) {
errno = ENOMEM;
return NULL;
}
diff --git a/gisi/netlink.c b/gisi/netlink.c
index ed95af6a..07cd6f49 100644
--- a/gisi/netlink.c
+++ b/gisi/netlink.c
@@ -336,7 +336,7 @@ error:
void g_isi_pn_netlink_stop(GIsiPhonetNetlink *self)
{
- if (!self)
+ if (self == NULL)
return;
netlink_list = g_slist_remove(netlink_list, self);
diff --git a/gisi/pep.c b/gisi/pep.c
index bea19024..c82dc39c 100644
--- a/gisi/pep.c
+++ b/gisi/pep.c
@@ -65,7 +65,7 @@ static gboolean g_isi_pep_callback(GIOChannel *channel, GIOCondition cond,
}
pep->gprs_fd = fd;
- if (pep->ready)
+ if (pep->ready != NULL)
pep->ready(pep, pep->opaque);
return FALSE;
diff --git a/gisi/pipe.c b/gisi/pipe.c
index 84ceb16c..31be675f 100644
--- a/gisi/pipe.c
+++ b/gisi/pipe.c
@@ -171,7 +171,8 @@ static void g_isi_pipe_handle_error(GIsiPipe *pipe, uint8_t code)
static void g_isi_pipe_created(const GIsiMessage *msg, void *data)
{
- const struct isi_pipe_resp *resp = g_isi_msg_data(msg);
+ struct isi_pipe_resp *resp;
+ size_t len = sizeof(struct isi_pipe_resp);
GIsiPipe *pipe = data;
if (g_isi_msg_error(msg) < 0) {
@@ -182,7 +183,7 @@ static void g_isi_pipe_created(const GIsiMessage *msg, void *data)
if (g_isi_msg_id(msg) != PNS_PIPE_CREATE_RESP)
return;
- if (!resp || g_isi_msg_data_len(msg) != sizeof(struct isi_pipe_resp))
+ if (!g_isi_msg_data_get_struct(msg, 0, (const void **) &resp, len))
return;
if (resp->pipe_handle == PN_PIPE_INVALID_HANDLE) {
@@ -259,7 +260,8 @@ GIsiPipe *g_isi_pipe_create(GIsiModem *modem, GIsiPipeHandler cb, uint16_t obj1,
static void g_isi_pipe_enabled(const GIsiMessage *msg, void *data)
{
GIsiPipe *pipe = data;
- const struct isi_pipe_resp *resp = g_isi_msg_data(msg);
+ const struct isi_pipe_resp *resp;
+ size_t len = sizeof(struct isi_pipe_resp);
if (g_isi_msg_error(msg) < 0) {
g_isi_pipe_handle_error(pipe, PN_PIPE_ERR_TIMEOUT);
@@ -269,7 +271,7 @@ static void g_isi_pipe_enabled(const GIsiMessage *msg, void *data)
if (g_isi_msg_id(msg) != PNS_PIPE_ENABLE_RESP)
return;
- if (!resp || g_isi_msg_data_len(msg) != sizeof(struct isi_pipe_resp))
+ if (!g_isi_msg_data_get_struct(msg, 0, (const void **) &resp, len))
return;
if (pipe->handle != resp->pipe_handle)
@@ -320,7 +322,8 @@ int g_isi_pipe_start(GIsiPipe *pipe)
static void g_isi_pipe_removed(const GIsiMessage *msg, void *data)
{
GIsiPipe *pipe = data;
- const struct isi_pipe_resp *resp = g_isi_msg_data(msg);
+ struct isi_pipe_resp *resp;
+ size_t len = sizeof(struct isi_pipe_resp);
if (g_isi_msg_error(msg) < 0) {
g_isi_pipe_handle_error(pipe, PN_PIPE_ERR_TIMEOUT);
@@ -330,7 +333,7 @@ static void g_isi_pipe_removed(const GIsiMessage *msg, void *data)
if (g_isi_msg_id(msg) != PNS_PIPE_REMOVE_RESP)
return;
- if (!resp || g_isi_msg_data_len(msg) != sizeof(struct isi_pipe_resp))
+ if (!g_isi_msg_data_get_struct(msg, 0, (const void **) &resp, len))
return;
if (pipe->handle != resp->pipe_handle)
diff --git a/gisi/server.c b/gisi/server.c
index 45c523d8..e6cc9a5b 100644
--- a/gisi/server.c
+++ b/gisi/server.c
@@ -49,21 +49,21 @@ static void pending_notify(const GIsiMessage *msg, void *data)
{
struct pending_data *pd = data;
- if (!pd)
+ if (pd == NULL)
return;
- if (pd->notify)
+ if (pd->notify != NULL)
pd->notify(msg, pd->data);
}
uint8_t g_isi_server_resource(GIsiServer *server)
{
- return server ? server->resource : 0;
+ return server != NULL ? server->resource : 0;
}
GIsiModem *g_isi_server_modem(GIsiServer *server)
{
- return server ? server->modem : 0;
+ return server != NULL ? server->modem : 0;
}
GIsiServer *g_isi_server_create(GIsiModem *modem, uint8_t resource,
@@ -71,18 +71,18 @@ GIsiServer *g_isi_server_create(GIsiModem *modem, uint8_t resource,
{
GIsiServer *server;
- if (!modem) {
+ if (modem == NULL) {
errno = EINVAL;
return NULL;
}
server = g_try_new0(GIsiServer, 1);
- if (!server) {
+ if (server == NULL) {
errno = ENOMEM;
return NULL;
}
- if (version)
+ if (version != NULL)
memcpy(&server->version, version, sizeof(GIsiVersion));
server->resource = resource;
@@ -97,7 +97,7 @@ static void foreach_destroy(gpointer value, gpointer user)
GIsiPending *op = value;
GIsiServer *server = user;
- if (!op || !server)
+ if (op == NULL || server == NULL)
return;
server->pending = g_slist_remove(server->pending, op);
@@ -106,7 +106,7 @@ static void foreach_destroy(gpointer value, gpointer user)
void g_isi_server_destroy(GIsiServer *server)
{
- if (!server)
+ if (server == NULL)
return;
g_slist_foreach(server->pending, foreach_destroy, server);
@@ -117,7 +117,7 @@ void g_isi_server_destroy(GIsiServer *server)
int g_isi_server_send(GIsiServer *server, const GIsiMessage *req,
const void *__restrict buf, size_t len)
{
- if (!server)
+ if (server == NULL)
return -EINVAL;
return g_isi_response_send(server->modem, req, buf, len);
@@ -126,7 +126,7 @@ int g_isi_server_send(GIsiServer *server, const GIsiMessage *req,
int g_isi_server_vsend(GIsiServer *server, const GIsiMessage *req,
const struct iovec *iov, size_t iovlen)
{
- if (!server)
+ if (server == NULL)
return -EINVAL;
return g_isi_response_vsend(server->modem, req, iov, iovlen);
@@ -138,13 +138,13 @@ static struct pending_data *pending_data_create(GIsiServer *server,
{
struct pending_data *pd;
- if (!server) {
+ if (server == NULL) {
errno = EINVAL;
return NULL;
}
pd = g_try_new0(struct pending_data, 1);
- if (!pd) {
+ if (pd == NULL) {
errno = ENOMEM;
return NULL;
}
@@ -163,12 +163,12 @@ GIsiPending *g_isi_server_handle(GIsiServer *server, uint8_t type,
GIsiPending *op;
pd = pending_data_create(server, notify, data);
- if (!pd)
+ if (pd == NULL)
return NULL;
op = g_isi_service_bind(server->modem, server->resource, type,
pending_notify, pd, g_free);
- if (!op) {
+ if (op == NULL) {
g_free(pd);
return NULL;
}