sparse fixup: warning: Using plain integer as NULL pointer
This commit is contained in:
parent
f4010694b3
commit
434e57ae5e
10 changed files with 16 additions and 16 deletions
|
@ -101,7 +101,7 @@ char *buffer_read(buffer_t *buffer, int size) {
|
||||||
|
|
||||||
void buffer_clear(buffer_t *buffer) {
|
void buffer_clear(buffer_t *buffer) {
|
||||||
free(buffer->data);
|
free(buffer->data);
|
||||||
buffer->data = 0;
|
buffer->data = NULL;
|
||||||
buffer->maxlen = 0;
|
buffer->maxlen = 0;
|
||||||
buffer->len = 0;
|
buffer->len = 0;
|
||||||
buffer->offset = 0;
|
buffer->offset = 0;
|
||||||
|
|
|
@ -188,7 +188,7 @@ bool get_config_address(const config_t *cfg, struct addrinfo **result) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool get_config_subnet(const config_t *cfg, subnet_t ** result) {
|
bool get_config_subnet(const config_t *cfg, subnet_t ** result) {
|
||||||
subnet_t subnet = {0};
|
subnet_t subnet = {NULL};
|
||||||
|
|
||||||
if(!cfg)
|
if(!cfg)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -608,7 +608,7 @@ void close_network_connections(void) {
|
||||||
for(node = connection_tree->head; node; node = next) {
|
for(node = connection_tree->head; node; node = next) {
|
||||||
next = node->next;
|
next = node->next;
|
||||||
c = node->data;
|
c = node->data;
|
||||||
c->outgoing = false;
|
c->outgoing = NULL;
|
||||||
terminate_connection(c, false);
|
terminate_connection(c, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -126,7 +126,7 @@ void node_del(node_t *n) {
|
||||||
}
|
}
|
||||||
|
|
||||||
node_t *lookup_node(char *name) {
|
node_t *lookup_node(char *name) {
|
||||||
node_t n = {0};
|
node_t n = {NULL};
|
||||||
|
|
||||||
n.name = name;
|
n.name = name;
|
||||||
|
|
||||||
|
@ -134,7 +134,7 @@ node_t *lookup_node(char *name) {
|
||||||
}
|
}
|
||||||
|
|
||||||
node_t *lookup_node_udp(const sockaddr_t *sa) {
|
node_t *lookup_node_udp(const sockaddr_t *sa) {
|
||||||
node_t n = {0};
|
node_t n = {NULL};
|
||||||
|
|
||||||
n.address = *sa;
|
n.address = *sa;
|
||||||
n.name = NULL;
|
n.name = NULL;
|
||||||
|
@ -160,7 +160,7 @@ void update_node_udp(node_t *n, const sockaddr_t *sa) {
|
||||||
logger(LOG_DEBUG, "UDP address of %s set to %s", n->name, n->hostname);
|
logger(LOG_DEBUG, "UDP address of %s set to %s", n->name, n->hostname);
|
||||||
} else {
|
} else {
|
||||||
memset(&n->address, 0, sizeof n->address);
|
memset(&n->address, 0, sizeof n->address);
|
||||||
n->hostname = 0;
|
n->hostname = NULL;
|
||||||
ifdebug(PROTOCOL) logger(LOG_DEBUG, "UDP address of %s cleared", n->name);
|
ifdebug(PROTOCOL) logger(LOG_DEBUG, "UDP address of %s cleared", n->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -178,7 +178,7 @@ static void free_past_request(past_request_t *r) {
|
||||||
static struct event past_request_event;
|
static struct event past_request_event;
|
||||||
|
|
||||||
bool seen_request(char *request) {
|
bool seen_request(char *request) {
|
||||||
past_request_t *new, p = {0};
|
past_request_t *new, p = {NULL};
|
||||||
|
|
||||||
p.request = request;
|
p.request = request;
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ bool add_subnet_h(connection_t *c, char *request) {
|
||||||
char subnetstr[MAX_STRING_SIZE];
|
char subnetstr[MAX_STRING_SIZE];
|
||||||
char name[MAX_STRING_SIZE];
|
char name[MAX_STRING_SIZE];
|
||||||
node_t *owner;
|
node_t *owner;
|
||||||
subnet_t s = {0}, *new, *old;
|
subnet_t s = {NULL}, *new, *old;
|
||||||
|
|
||||||
if(sscanf(request, "%*d %*x " MAX_STRING " " MAX_STRING, name, subnetstr) != 2) {
|
if(sscanf(request, "%*d %*x " MAX_STRING " " MAX_STRING, name, subnetstr) != 2) {
|
||||||
logger(LOG_ERR, "Got bad %s from %s (%s)", "ADD_SUBNET", c->name,
|
logger(LOG_ERR, "Got bad %s from %s (%s)", "ADD_SUBNET", c->name,
|
||||||
|
@ -155,7 +155,7 @@ bool del_subnet_h(connection_t *c, char *request) {
|
||||||
char subnetstr[MAX_STRING_SIZE];
|
char subnetstr[MAX_STRING_SIZE];
|
||||||
char name[MAX_STRING_SIZE];
|
char name[MAX_STRING_SIZE];
|
||||||
node_t *owner;
|
node_t *owner;
|
||||||
subnet_t s = {0}, *find;
|
subnet_t s = {NULL}, *find;
|
||||||
|
|
||||||
if(sscanf(request, "%*d %*x " MAX_STRING " " MAX_STRING, name, subnetstr) != 2) {
|
if(sscanf(request, "%*d %*x " MAX_STRING " " MAX_STRING, name, subnetstr) != 2) {
|
||||||
logger(LOG_ERR, "Got bad %s from %s (%s)", "DEL_SUBNET", c->name,
|
logger(LOG_ERR, "Got bad %s from %s (%s)", "DEL_SUBNET", c->name,
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
/* Splay operation */
|
/* Splay operation */
|
||||||
|
|
||||||
static splay_node_t *splay_top_down(splay_tree_t *tree, const void *data, int *result) {
|
static splay_node_t *splay_top_down(splay_tree_t *tree, const void *data, int *result) {
|
||||||
splay_node_t left = {0}, right = {0};
|
splay_node_t left = {NULL}, right = {NULL};
|
||||||
splay_node_t *leftbottom = &left, *rightbottom = &right, *child, *grandchild;
|
splay_node_t *leftbottom = &left, *rightbottom = &right, *child, *grandchild;
|
||||||
splay_node_t *root = tree->root;
|
splay_node_t *root = tree->root;
|
||||||
int c;
|
int c;
|
||||||
|
|
|
@ -452,7 +452,7 @@ subnet_t *lookup_subnet_ipv6(const ipv6_t *address) {
|
||||||
void subnet_update(node_t *owner, subnet_t *subnet, bool up) {
|
void subnet_update(node_t *owner, subnet_t *subnet, bool up) {
|
||||||
splay_node_t *node;
|
splay_node_t *node;
|
||||||
int i;
|
int i;
|
||||||
char *envp[9] = {0};
|
char *envp[9] = {NULL};
|
||||||
char netstr[MAXNETSTR];
|
char netstr[MAXNETSTR];
|
||||||
char *name, *address, *port;
|
char *name, *address, *port;
|
||||||
char empty[] = "";
|
char empty[] = "";
|
||||||
|
|
|
@ -445,7 +445,7 @@ int main2(int argc, char **argv) {
|
||||||
|
|
||||||
/* Change process priority */
|
/* Change process priority */
|
||||||
|
|
||||||
char *priority = 0;
|
char *priority = NULL;
|
||||||
|
|
||||||
if(get_config_string(lookup_config(config_tree, "ProcessPriority"), &priority)) {
|
if(get_config_string(lookup_config(config_tree, "ProcessPriority"), &priority)) {
|
||||||
if(!strcasecmp(priority, "Normal")) {
|
if(!strcasecmp(priority, "Normal")) {
|
||||||
|
|
|
@ -56,7 +56,7 @@ int xalloc_exit_failure = EXIT_FAILURE;
|
||||||
char *const xalloc_msg_memory_exhausted = "Memory exhausted";
|
char *const xalloc_msg_memory_exhausted = "Memory exhausted";
|
||||||
|
|
||||||
/* FIXME: describe */
|
/* FIXME: describe */
|
||||||
void (*xalloc_fail_func) (int) = 0;
|
void (*xalloc_fail_func) (int) = NULL;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
xalloc_fail (int size)
|
xalloc_fail (int size)
|
||||||
|
@ -75,7 +75,7 @@ xmalloc (size_t n)
|
||||||
void *p;
|
void *p;
|
||||||
|
|
||||||
p = malloc (n);
|
p = malloc (n);
|
||||||
if (p == 0)
|
if (p == NULL)
|
||||||
xalloc_fail ((int)n);
|
xalloc_fail ((int)n);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ xmalloc_and_zero (size_t n)
|
||||||
void *p;
|
void *p;
|
||||||
|
|
||||||
p = malloc (n);
|
p = malloc (n);
|
||||||
if (p == 0)
|
if (p == NULL)
|
||||||
xalloc_fail ((int)n);
|
xalloc_fail ((int)n);
|
||||||
memset (p, '\0', n);
|
memset (p, '\0', n);
|
||||||
return p;
|
return p;
|
||||||
|
@ -102,7 +102,7 @@ void *
|
||||||
xrealloc (void *p, size_t n)
|
xrealloc (void *p, size_t n)
|
||||||
{
|
{
|
||||||
p = realloc (p, n);
|
p = realloc (p, n);
|
||||||
if (p == 0)
|
if (p == NULL)
|
||||||
xalloc_fail (n);
|
xalloc_fail (n);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue