From: Sven-Haegar Koch Date: Sat, 28 May 2011 01:46:39 +0000 (+0200) Subject: sparse fixup: warning: Using plain integer as NULL pointer X-Git-Tag: release-1.1pre1~38 X-Git-Url: https://tinc-vpn.org/git/browse?a=commitdiff_plain;h=434e57ae5ee79b3d990c4d75358047bad641998b;p=tinc sparse fixup: warning: Using plain integer as NULL pointer --- diff --git a/src/buffer.c b/src/buffer.c index 315faf18..3d4c3297 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -101,7 +101,7 @@ char *buffer_read(buffer_t *buffer, int size) { void buffer_clear(buffer_t *buffer) { free(buffer->data); - buffer->data = 0; + buffer->data = NULL; buffer->maxlen = 0; buffer->len = 0; buffer->offset = 0; diff --git a/src/conf.c b/src/conf.c index 30ac5852..593cd0c2 100644 --- a/src/conf.c +++ b/src/conf.c @@ -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) { - subnet_t subnet = {0}; + subnet_t subnet = {NULL}; if(!cfg) return false; diff --git a/src/net_setup.c b/src/net_setup.c index 543dad30..f0e1cdfe 100644 --- a/src/net_setup.c +++ b/src/net_setup.c @@ -608,7 +608,7 @@ void close_network_connections(void) { for(node = connection_tree->head; node; node = next) { next = node->next; c = node->data; - c->outgoing = false; + c->outgoing = NULL; terminate_connection(c, false); } diff --git a/src/node.c b/src/node.c index dee7aadf..dbc5a7eb 100644 --- a/src/node.c +++ b/src/node.c @@ -126,7 +126,7 @@ void node_del(node_t *n) { } node_t *lookup_node(char *name) { - node_t n = {0}; + node_t n = {NULL}; n.name = name; @@ -134,7 +134,7 @@ node_t *lookup_node(char *name) { } node_t *lookup_node_udp(const sockaddr_t *sa) { - node_t n = {0}; + node_t n = {NULL}; n.address = *sa; 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); } else { 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); } } diff --git a/src/protocol.c b/src/protocol.c index 230ee3b8..fd908949 100644 --- a/src/protocol.c +++ b/src/protocol.c @@ -178,7 +178,7 @@ static void free_past_request(past_request_t *r) { static struct event past_request_event; bool seen_request(char *request) { - past_request_t *new, p = {0}; + past_request_t *new, p = {NULL}; p.request = request; diff --git a/src/protocol_subnet.c b/src/protocol_subnet.c index d509c2ba..6f9e626e 100644 --- a/src/protocol_subnet.c +++ b/src/protocol_subnet.c @@ -45,7 +45,7 @@ bool add_subnet_h(connection_t *c, char *request) { char subnetstr[MAX_STRING_SIZE]; char name[MAX_STRING_SIZE]; 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) { 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 name[MAX_STRING_SIZE]; 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) { logger(LOG_ERR, "Got bad %s from %s (%s)", "DEL_SUBNET", c->name, diff --git a/src/splay_tree.c b/src/splay_tree.c index 3a792e8b..135ba06b 100644 --- a/src/splay_tree.c +++ b/src/splay_tree.c @@ -25,7 +25,7 @@ /* Splay operation */ 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 *root = tree->root; int c; diff --git a/src/subnet.c b/src/subnet.c index b96abfb5..bf1bda2e 100644 --- a/src/subnet.c +++ b/src/subnet.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) { splay_node_t *node; int i; - char *envp[9] = {0}; + char *envp[9] = {NULL}; char netstr[MAXNETSTR]; char *name, *address, *port; char empty[] = ""; diff --git a/src/tincd.c b/src/tincd.c index 17d50085..84971495 100644 --- a/src/tincd.c +++ b/src/tincd.c @@ -445,7 +445,7 @@ int main2(int argc, char **argv) { /* Change process priority */ - char *priority = 0; + char *priority = NULL; if(get_config_string(lookup_config(config_tree, "ProcessPriority"), &priority)) { if(!strcasecmp(priority, "Normal")) { diff --git a/src/xmalloc.c b/src/xmalloc.c index 131b41f1..0e009e22 100644 --- a/src/xmalloc.c +++ b/src/xmalloc.c @@ -56,7 +56,7 @@ int xalloc_exit_failure = EXIT_FAILURE; char *const xalloc_msg_memory_exhausted = "Memory exhausted"; /* FIXME: describe */ -void (*xalloc_fail_func) (int) = 0; +void (*xalloc_fail_func) (int) = NULL; static void xalloc_fail (int size) @@ -75,7 +75,7 @@ xmalloc (size_t n) void *p; p = malloc (n); - if (p == 0) + if (p == NULL) xalloc_fail ((int)n); return p; } @@ -88,7 +88,7 @@ xmalloc_and_zero (size_t n) void *p; p = malloc (n); - if (p == 0) + if (p == NULL) xalloc_fail ((int)n); memset (p, '\0', n); return p; @@ -102,7 +102,7 @@ void * xrealloc (void *p, size_t n) { p = realloc (p, n); - if (p == 0) + if (p == NULL) xalloc_fail (n); return p; }