struct addrinfo *k;
for (k = ai; k; k = k->ai_next) {
- if (!(p = serialize_addrinfo(p, k, &resp->header.length, (char*) data + BUFSIZE - (char*) p))) {
+ p = serialize_addrinfo(p, k, &resp->header.length, (char*) data + BUFSIZE - (char*) p);
+ if (!p) {
resp->ret = EAI_MEMORY;
break;
}
for (asyncns->valid_workers = 0; asyncns->valid_workers < n_proc; asyncns->valid_workers++) {
int r;
-
- if ((r = pthread_create(&asyncns->workers[asyncns->valid_workers], NULL, thread_worker, asyncns)) != 0) {
+ r = pthread_create(&asyncns->workers[asyncns->valid_workers], NULL, thread_worker, asyncns);
+ if (r) {
errno = r;
goto fail;
}
asyncns_query_t *q;
assert(asyncns);
- if ((q = asyncns->queries[id % MAX_QUERIES]))
+ q = asyncns->queries[id % MAX_QUERIES];
+ if (q)
if (q->id == id)
return q;
if (*length < l)
return NULL;
- if (!(ai = malloc(sizeof(struct addrinfo))))
+ ai = malloc(sizeof(struct addrinfo));
+ if (!ai)
goto fail;
ai->ai_addr = NULL;
return 0;
}
- if (!(q = lookup_query(asyncns, resp->id)))
+ q = lookup_query(asyncns, resp->id);
+ if (!q)
return 0;
switch (resp->type) {
return -1;
}
- if (((l = recv(asyncns->fds[RESPONSE_RECV_FD], buf, sizeof(buf), 0)) < 0)) {
+ l = recv(asyncns->fds[RESPONSE_RECV_FD], buf, sizeof(buf), 0);
+ if (l < 0) {
fd_set fds;
if (errno != EAGAIN)
}
while (asyncns->queries[asyncns->current_index]) {
-
asyncns->current_index++;
asyncns->current_id++;
asyncns->current_index -= MAX_QUERIES;
}
- if (!(q = asyncns->queries[asyncns->current_index] = malloc(sizeof(asyncns_query_t)))) {
+ q = asyncns->queries[asyncns->current_index] = malloc(sizeof(asyncns_query_t));
+ if (!q) {
errno = ENOMEM;
return NULL;
}
return NULL;
}
- if (!(q = alloc_query(asyncns)))
+ q = alloc_query(asyncns);
+ if (!q)
return NULL;
-
req->node_len = node ? strlen(node)+1 : 0;
req->service_len = service ? strlen(service)+1 : 0;
return NULL;
}
- if (!(q = alloc_query(asyncns)))
+ q = alloc_query(asyncns);
+ if (!q)
return NULL;
-
req->header.id = q->id;
req->header.type = q->type = REQUEST_NAMEINFO;
req->header.length = sizeof(nameinfo_request_t) + salen;
return NULL;
}
- if (!(q = alloc_query(asyncns)))
+ q = alloc_query(asyncns);
+ if (!q)
return NULL;
req->dname_len = strlen(dname) + 1;