summaryrefslogtreecommitdiffstats
path: root/gisi/client.c
diff options
context:
space:
mode:
Diffstat (limited to 'gisi/client.c')
-rw-r--r--gisi/client.c51
1 files changed, 24 insertions, 27 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;
}