void buffer_clear(buffer_t *buffer) {
free(buffer->data);
- buffer->data = 0;
+ buffer->data = NULL;
buffer->maxlen = 0;
buffer->len = 0;
buffer->offset = 0;
}
bool get_config_subnet(const config_t *cfg, subnet_t ** result) {
- subnet_t subnet = {0};
+ subnet_t subnet = {NULL};
if(!cfg)
return false;
for(node = connection_tree->head; node; node = next) {
next = node->next;
c = node->data;
- c->outgoing = false;
+ c->outgoing = NULL;
terminate_connection(c, false);
}
}
node_t *lookup_node(char *name) {
- node_t n = {0};
+ node_t n = {NULL};
n.name = name;
}
node_t *lookup_node_udp(const sockaddr_t *sa) {
- node_t n = {0};
+ node_t n = {NULL};
n.address = *sa;
n.name = NULL;
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);
}
}
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;
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,
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,
/* 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;
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[] = "";
/* Change process priority */
- char *priority = 0;
+ char *priority = NULL;
if(get_config_string(lookup_config(config_tree, "ProcessPriority"), &priority)) {
if(!strcasecmp(priority, "Normal")) {
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)
void *p;
p = malloc (n);
- if (p == 0)
+ if (p == NULL)
xalloc_fail ((int)n);
return p;
}
void *p;
p = malloc (n);
- if (p == 0)
+ if (p == NULL)
xalloc_fail ((int)n);
memset (p, '\0', n);
return p;
xrealloc (void *p, size_t n)
{
p = realloc (p, n);
- if (p == 0)
+ if (p == NULL)
xalloc_fail (n);
return p;
}