consistently use NULL for null pointers

makes the code noisier, but also somewhat more expressive.
This commit is contained in:
Oswald Buddenhagen 2019-07-28 20:50:31 +02:00
parent e2d3b4d55b
commit 64e5f07ad3
11 changed files with 151 additions and 151 deletions

View File

@ -191,7 +191,7 @@ int map_name( const char *arg, char **result, uint reserve, const char *in, cons
} }
#define ARRAY_INIT(arr) \ #define ARRAY_INIT(arr) \
do { (arr)->array.data = 0; (arr)->array.size = (arr)->alloc = 0; } while (0) do { (arr)->array.data = NULL; (arr)->array.size = (arr)->alloc = 0; } while (0)
#define ARRAY_SQUEEZE(arr) \ #define ARRAY_SQUEEZE(arr) \
do { \ do { \
@ -245,7 +245,7 @@ typedef struct {
void init_wakeup( wakeup_t *tmr, void (*cb)( void * ), void *aux ); void init_wakeup( wakeup_t *tmr, void (*cb)( void * ), void *aux );
void conf_wakeup( wakeup_t *tmr, int timeout ); void conf_wakeup( wakeup_t *tmr, int timeout );
void wipe_wakeup( wakeup_t *tmr ); void wipe_wakeup( wakeup_t *tmr );
static INLINE int ATTR_UNUSED pending_wakeup( wakeup_t *tmr ) { return tmr->links.next != 0; } static INLINE int ATTR_UNUSED pending_wakeup( wakeup_t *tmr ) { return tmr->links.next != NULL; }
void main_loop( void ); void main_loop( void );

View File

@ -54,7 +54,7 @@ get_arg( conffile_t *cfile, int required, int *comment )
error( "%s:%d: parameter missing\n", cfile->file, cfile->line ); error( "%s:%d: parameter missing\n", cfile->file, cfile->line );
cfile->err = 1; cfile->err = 1;
} }
ret = 0; ret = NULL;
} else { } else {
for (escaped = 0, quoted = 0, ret = t = p; c; c = *p) { for (escaped = 0, quoted = 0, ret = t = p; c; c = *p) {
p++; p++;
@ -74,12 +74,12 @@ get_arg( conffile_t *cfile, int required, int *comment )
if (escaped) { if (escaped) {
error( "%s:%d: unterminated escape sequence\n", cfile->file, cfile->line ); error( "%s:%d: unterminated escape sequence\n", cfile->file, cfile->line );
cfile->err = 1; cfile->err = 1;
ret = 0; ret = NULL;
} }
if (quoted) { if (quoted) {
error( "%s:%d: missing closing quote\n", cfile->file, cfile->line ); error( "%s:%d: missing closing quote\n", cfile->file, cfile->line );
cfile->err = 1; cfile->err = 1;
ret = 0; ret = NULL;
} }
} }
cfile->rest = p; cfile->rest = p;
@ -196,7 +196,7 @@ getopt_helper( conffile_t *cfile, int *cops, channel_conf_t *conf )
cfile->file, cfile->line, arg ); cfile->file, cfile->line, arg );
cfile->err = 1; cfile->err = 1;
} }
while ((arg = get_arg( cfile, ARG_OPTIONAL, 0 ))); while ((arg = get_arg( cfile, ARG_OPTIONAL, NULL )));
conf->ops[M] |= XOP_HAVE_TYPE; conf->ops[M] |= XOP_HAVE_TYPE;
} else if (!strcasecmp( "SyncState", cfile->cmd )) } else if (!strcasecmp( "SyncState", cfile->cmd ))
conf->sync_state = expand_strdup( cfile->val ); conf->sync_state = expand_strdup( cfile->val );
@ -223,7 +223,7 @@ getopt_helper( conffile_t *cfile, int *cops, channel_conf_t *conf )
cfile->file, cfile->line, boxOps[i].name, arg ); cfile->file, cfile->line, boxOps[i].name, arg );
cfile->err = 1; cfile->err = 1;
} }
} while ((arg = get_arg( cfile, ARG_OPTIONAL, 0 ))); } while ((arg = get_arg( cfile, ARG_OPTIONAL, NULL )));
conf->ops[M] |= op * (XOP_HAVE_EXPUNGE / OP_EXPUNGE); conf->ops[M] |= op * (XOP_HAVE_EXPUNGE / OP_EXPUNGE);
return 1; return 1;
} }
@ -239,7 +239,7 @@ getcline( conffile_t *cfile )
char *arg; char *arg;
int comment; int comment;
if (cfile->rest && (arg = get_arg( cfile, ARG_OPTIONAL, 0 ))) { if (cfile->rest && (arg = get_arg( cfile, ARG_OPTIONAL, NULL ))) {
error( "%s:%d: excess token '%s'\n", cfile->file, cfile->line, arg ); error( "%s:%d: excess token '%s'\n", cfile->file, cfile->line, arg );
cfile->err = 1; cfile->err = 1;
} }
@ -251,7 +251,7 @@ getcline( conffile_t *cfile )
continue; continue;
return 1; return 1;
} }
if (!(cfile->val = get_arg( cfile, ARG_REQUIRED, 0 ))) if (!(cfile->val = get_arg( cfile, ARG_REQUIRED, NULL )))
continue; continue;
return 1; return 1;
} }
@ -343,7 +343,7 @@ load_config( const char *where, int pseudo )
cfile.bufl = sizeof(buf) - 1; cfile.bufl = sizeof(buf) - 1;
cfile.line = 0; cfile.line = 0;
cfile.err = 0; cfile.err = 0;
cfile.rest = 0; cfile.rest = NULL;
gcops = 0; gcops = 0;
global_conf.expire_unread = -1; global_conf.expire_unread = -1;
@ -360,7 +360,7 @@ load_config( const char *where, int pseudo )
store->flat_delim = ""; store->flat_delim = "";
*storeapp = store; *storeapp = store;
storeapp = &store->next; storeapp = &store->next;
*storeapp = 0; *storeapp = NULL;
} }
goto reloop; goto reloop;
} }
@ -382,7 +382,7 @@ load_config( const char *where, int pseudo )
arg = cfile.val; arg = cfile.val;
do do
add_string_list( &channel->patterns, arg ); add_string_list( &channel->patterns, arg );
while ((arg = get_arg( &cfile, ARG_OPTIONAL, 0 ))); while ((arg = get_arg( &cfile, ARG_OPTIONAL, NULL )));
} }
else if (!strcasecmp( "Master", cfile.cmd )) { else if (!strcasecmp( "Master", cfile.cmd )) {
ms = M; ms = M;
@ -438,17 +438,17 @@ load_config( const char *where, int pseudo )
group->name = nfstrdup( cfile.val ); group->name = nfstrdup( cfile.val );
*groupapp = group; *groupapp = group;
groupapp = &group->next; groupapp = &group->next;
*groupapp = 0; *groupapp = NULL;
chanlistapp = &group->channels; chanlistapp = &group->channels;
*chanlistapp = 0; *chanlistapp = NULL;
while ((arg = get_arg( &cfile, ARG_OPTIONAL, 0 ))) { while ((arg = get_arg( &cfile, ARG_OPTIONAL, NULL ))) {
addone: addone:
len = strlen( arg ); len = strlen( arg );
chanlist = nfmalloc( sizeof(*chanlist) + len ); chanlist = nfmalloc( sizeof(*chanlist) + len );
memcpy( chanlist->string, arg, len + 1 ); memcpy( chanlist->string, arg, len + 1 );
*chanlistapp = chanlist; *chanlistapp = chanlist;
chanlistapp = &chanlist->next; chanlistapp = &chanlist->next;
*chanlistapp = 0; *chanlistapp = NULL;
} }
while (getcline( &cfile )) { while (getcline( &cfile )) {
if (!cfile.cmd) if (!cfile.cmd)

View File

@ -336,7 +336,7 @@ DIAG_POP
iov[1].buf = cmd->param.data; iov[1].buf = cmd->param.data;
iov[1].len = cmd->param.data_len; iov[1].len = cmd->param.data_len;
iov[1].takeOwn = GiveOwn; iov[1].takeOwn = GiveOwn;
cmd->param.data = 0; cmd->param.data = NULL;
ctx->buffer_mem -= cmd->param.data_len; ctx->buffer_mem -= cmd->param.data_len;
iov[2].buf = "\r\n"; iov[2].buf = "\r\n";
iov[2].len = 2; iov[2].len = 2;
@ -346,7 +346,7 @@ DIAG_POP
socket_write( &ctx->conn, iov, iovcnt ); socket_write( &ctx->conn, iov, iovcnt );
if (cmd->param.to_trash && ctx->trashnc == TrashUnknown) if (cmd->param.to_trash && ctx->trashnc == TrashUnknown)
ctx->trashnc = TrashChecking; ctx->trashnc = TrashChecking;
cmd->next = 0; cmd->next = NULL;
*ctx->in_progress_append = cmd; *ctx->in_progress_append = cmd;
ctx->in_progress_append = &cmd->next; ctx->in_progress_append = &cmd->next;
ctx->num_in_progress++; ctx->num_in_progress++;
@ -435,7 +435,7 @@ submit_imap_cmd( imap_store_t *ctx, imap_cmd_t *cmd )
cmd->next = ctx->pending; cmd->next = ctx->pending;
ctx->pending = cmd; ctx->pending = cmd;
} else { } else {
cmd->next = 0; cmd->next = NULL;
*ctx->pending_append = cmd; *ctx->pending_append = cmd;
ctx->pending_append = &cmd->next; ctx->pending_append = &cmd->next;
} }
@ -649,7 +649,7 @@ imap_strchr( const char *s, char tc )
if (c == '\\') if (c == '\\')
c = *++s; c = *++s;
if (!c) if (!c)
return 0; return NULL;
if (c == tc) if (c == tc)
return s; return s;
} }
@ -664,12 +664,12 @@ next_arg( char **ps )
assert( ps ); assert( ps );
s = *ps; s = *ps;
if (!s) if (!s)
return 0; return NULL;
while (isspace( (uchar)*s )) while (isspace( (uchar)*s ))
s++; s++;
if (!*s) { if (!*s) {
*ps = 0; *ps = NULL;
return 0; return NULL;
} }
if (*s == '"') { if (*s == '"') {
s++; s++;
@ -678,8 +678,8 @@ next_arg( char **ps )
if (c == '\\') if (c == '\\')
c = *s++; c = *s++;
if (!c) { if (!c) {
*ps = 0; *ps = NULL;
return 0; return NULL;
} }
*d++ = c; *d++ = c;
} }
@ -695,7 +695,7 @@ next_arg( char **ps )
} }
} }
if (!*s) if (!*s)
s = 0; s = NULL;
*ps = s; *ps = s;
return ret; return ret;
@ -772,9 +772,9 @@ parse_imap_list( imap_store_t *ctx, char **sp, parse_list_state_t *sts )
goto next; goto next;
} }
*curp = cur = nfmalloc( sizeof(*cur) ); *curp = cur = nfmalloc( sizeof(*cur) );
cur->val = 0; /* for clean bail */ cur->val = NULL; /* for clean bail */
curp = &cur->next; curp = &cur->next;
*curp = 0; /* ditto */ *curp = NULL; /* ditto */
if (*s == '(') { if (*s == '(') {
/* sublist */ /* sublist */
if (sts->level == MAX_LIST_DEPTH) if (sts->level == MAX_LIST_DEPTH)
@ -783,7 +783,7 @@ parse_imap_list( imap_store_t *ctx, char **sp, parse_list_state_t *sts )
cur->val = LIST; cur->val = LIST;
sts->stack[sts->level++] = curp; sts->stack[sts->level++] = curp;
curp = &cur->child; curp = &cur->child;
*curp = 0; /* for clean bail */ *curp = NULL; /* for clean bail */
goto next2; goto next2;
} else if (ctx && *s == '{') { } else if (ctx && *s == '{') {
/* literal */ /* literal */
@ -873,7 +873,7 @@ parse_list_init( parse_list_state_t *sts )
{ {
sts->need_bytes = -1; sts->need_bytes = -1;
sts->level = 1; sts->level = 1;
sts->head = 0; sts->head = NULL;
sts->stack[0] = &sts->head; sts->stack[0] = &sts->head;
} }
@ -883,8 +883,8 @@ parse_list_continue( imap_store_t *ctx, char *s )
list_t *list; list_t *list;
int resp; int resp;
if ((resp = parse_imap_list( ctx, &s, &ctx->parse_list_sts )) != LIST_PARTIAL) { if ((resp = parse_imap_list( ctx, &s, &ctx->parse_list_sts )) != LIST_PARTIAL) {
list = (resp == LIST_BAD) ? 0 : ctx->parse_list_sts.head; list = (resp == LIST_BAD) ? NULL : ctx->parse_list_sts.head;
ctx->parse_list_sts.head = 0; ctx->parse_list_sts.head = NULL;
resp = ctx->parse_list_sts.callback( ctx, list, s ); resp = ctx->parse_list_sts.callback( ctx, list, s );
} }
return resp; return resp;
@ -971,7 +971,7 @@ static int
parse_fetch_rsp( imap_store_t *ctx, list_t *list, char *s ATTR_UNUSED ) parse_fetch_rsp( imap_store_t *ctx, list_t *list, char *s ATTR_UNUSED )
{ {
list_t *tmp, *flags; list_t *tmp, *flags;
char *body = 0, *tuid = 0, *msgid = 0, *ep; char *body = NULL, *tuid = NULL, *msgid = NULL, *ep;
imap_message_t *cur; imap_message_t *cur;
msg_data_t *msgdata; msg_data_t *msgdata;
imap_cmd_t *cmdp; imap_cmd_t *cmdp;
@ -1034,7 +1034,7 @@ parse_fetch_rsp( imap_store_t *ctx, list_t *list, char *s ATTR_UNUSED )
tmp = tmp->next; tmp = tmp->next;
if (is_atom( tmp )) { if (is_atom( tmp )) {
body = tmp->val; body = tmp->val;
tmp->val = 0; /* don't free together with list */ tmp->val = NULL; /* don't free together with list */
size = tmp->len; size = tmp->len;
} else } else
error( "IMAP error: unable to parse BODY[]\n" ); error( "IMAP error: unable to parse BODY[]\n" );
@ -1117,12 +1117,12 @@ parse_fetch_rsp( imap_store_t *ctx, list_t *list, char *s ATTR_UNUSED )
cur = nfcalloc( sizeof(*cur) ); cur = nfcalloc( sizeof(*cur) );
*ctx->msgapp = &cur->gen; *ctx->msgapp = &cur->gen;
ctx->msgapp = &cur->gen.next; ctx->msgapp = &cur->gen.next;
cur->gen.next = 0; cur->gen.next = NULL;
cur->gen.uid = uid; cur->gen.uid = uid;
cur->gen.flags = mask; cur->gen.flags = mask;
cur->gen.status = status; cur->gen.status = status;
cur->gen.size = size; cur->gen.size = size;
cur->gen.srec = 0; cur->gen.srec = NULL;
cur->gen.msgid = msgid; cur->gen.msgid = msgid;
if (tuid) if (tuid)
memcpy( cur->gen.tuid, tuid, TUIDL ); memcpy( cur->gen.tuid, tuid, TUIDL );
@ -1141,7 +1141,7 @@ parse_capability( imap_store_t *ctx, char *cmd )
uint i; uint i;
free_string_list( ctx->auth_mechs ); free_string_list( ctx->auth_mechs );
ctx->auth_mechs = 0; ctx->auth_mechs = NULL;
ctx->caps = 0x80000000; ctx->caps = 0x80000000;
while ((arg = next_arg( &cmd ))) { while ((arg = next_arg( &cmd ))) {
if (starts_with( arg, -1, "AUTH=", 5 )) { if (starts_with( arg, -1, "AUTH=", 5 )) {
@ -1393,7 +1393,7 @@ imap_socket_read( void *aux )
for (;;) { for (;;) {
if (ctx->parse_list_sts.level) { if (ctx->parse_list_sts.level) {
resp = parse_list_continue( ctx, 0 ); resp = parse_list_continue( ctx, NULL );
listret: listret:
if (resp == LIST_PARTIAL) if (resp == LIST_PARTIAL)
return; return;
@ -1427,7 +1427,7 @@ imap_socket_read( void *aux )
} }
if (ctx->greeting == GreetingPending && !strcmp( "PREAUTH", arg )) { if (ctx->greeting == GreetingPending && !strcmp( "PREAUTH", arg )) {
parse_response_code( ctx, 0, cmd ); parse_response_code( ctx, NULL, cmd );
ctx->greeting = GreetingPreauth; ctx->greeting = GreetingPreauth;
dogreet: dogreet:
imap_ref( ctx ); imap_ref( ctx );
@ -1435,7 +1435,7 @@ imap_socket_read( void *aux )
if (imap_deref( ctx )) if (imap_deref( ctx ))
return; return;
} else if (!strcmp( "OK", arg )) { } else if (!strcmp( "OK", arg )) {
parse_response_code( ctx, 0, cmd ); parse_response_code( ctx, NULL, cmd );
if (ctx->greeting == GreetingPending) { if (ctx->greeting == GreetingPending) {
ctx->greeting = GreetingOk; ctx->greeting = GreetingOk;
goto dogreet; goto dogreet;
@ -1499,7 +1499,7 @@ imap_socket_read( void *aux )
iov[0].buf = cmdp->param.data; iov[0].buf = cmdp->param.data;
iov[0].len = cmdp->param.data_len; iov[0].len = cmdp->param.data_len;
iov[0].takeOwn = GiveOwn; iov[0].takeOwn = GiveOwn;
cmdp->param.data = 0; cmdp->param.data = NULL;
ctx->buffer_mem -= cmdp->param.data_len; ctx->buffer_mem -= cmdp->param.data_len;
iov[1].buf = "\r\n"; iov[1].buf = "\r\n";
iov[1].len = 2; iov[1].len = 2;
@ -1667,7 +1667,7 @@ imap_free_store( store_t *gctx )
imap_store_t *ctx = (imap_store_t *)gctx; imap_store_t *ctx = (imap_store_t *)gctx;
free_generic_messages( ctx->msgs ); free_generic_messages( ctx->msgs );
ctx->msgs = 0; ctx->msgs = NULL;
imap_set_bad_callback( gctx, imap_cancel_unowned, gctx ); imap_set_bad_callback( gctx, imap_cancel_unowned, gctx );
gctx->next = unowned; gctx->next = unowned;
unowned = gctx; unowned = gctx;
@ -1687,7 +1687,7 @@ imap_cleanup( void )
imap_set_bad_callback( ctx, (void (*)(void *))imap_cancel_store, ctx ); imap_set_bad_callback( ctx, (void (*)(void *))imap_cancel_store, ctx );
if (((imap_store_t *)ctx)->state != SST_BAD) { if (((imap_store_t *)ctx)->state != SST_BAD) {
((imap_store_t *)ctx)->expectBYE = 1; ((imap_store_t *)ctx)->expectBYE = 1;
imap_exec( (imap_store_t *)ctx, 0, imap_cleanup_p2, "LOGOUT" ); imap_exec( (imap_store_t *)ctx, NULL, imap_cleanup_p2, "LOGOUT" );
} else { } else {
imap_cancel_store( ctx ); imap_cancel_store( ctx );
} }
@ -1832,7 +1832,7 @@ imap_open_store_greeted( imap_store_t *ctx )
{ {
socket_expect_activity( &ctx->conn, 0 ); socket_expect_activity( &ctx->conn, 0 );
if (!ctx->caps) if (!ctx->caps)
imap_exec( ctx, 0, imap_open_store_p2, "CAPABILITY" ); imap_exec( ctx, NULL, imap_open_store_p2, "CAPABILITY" );
else else
imap_open_store_authenticate( ctx ); imap_open_store_authenticate( ctx );
} }
@ -1858,7 +1858,7 @@ imap_open_store_authenticate( imap_store_t *ctx )
#ifdef HAVE_LIBSSL #ifdef HAVE_LIBSSL
if (srvc->ssl_type == SSL_STARTTLS) { if (srvc->ssl_type == SSL_STARTTLS) {
if (CAP(STARTTLS)) { if (CAP(STARTTLS)) {
imap_exec( ctx, 0, imap_open_store_authenticate_p2, "STARTTLS" ); imap_exec( ctx, NULL, imap_open_store_authenticate_p2, "STARTTLS" );
return; return;
} else { } else {
error( "IMAP error: SSL support not available\n" ); error( "IMAP error: SSL support not available\n" );
@ -1898,7 +1898,7 @@ imap_open_store_tlsstarted2( int ok, void *aux )
if (!ok) if (!ok)
imap_open_store_ssl_bail( ctx ); imap_open_store_ssl_bail( ctx );
else else
imap_exec( ctx, 0, imap_open_store_authenticate_p3, "CAPABILITY" ); imap_exec( ctx, NULL, imap_open_store_authenticate_p3, "CAPABILITY" );
} }
static void static void
@ -1916,7 +1916,7 @@ ensure_user( imap_server_conf_t *srvc )
{ {
if (!srvc->user) { if (!srvc->user) {
error( "Skipping account %s, no user\n", srvc->name ); error( "Skipping account %s, no user\n", srvc->name );
return 0; return NULL;
} }
return srvc->user; return srvc->user;
} }
@ -1938,7 +1938,7 @@ ensure_password( imap_server_conf_t *srvc )
if (!(fp = popen( cmd, "r" ))) { if (!(fp = popen( cmd, "r" ))) {
pipeerr: pipeerr:
sys_error( "Skipping account %s, password command failed", srvc->name ); sys_error( "Skipping account %s, password command failed", srvc->name );
return 0; return NULL;
} }
if (!fgets( buffer, sizeof(buffer), fp )) if (!fgets( buffer, sizeof(buffer), fp ))
buffer[0] = 0; buffer[0] = 0;
@ -1949,11 +1949,11 @@ ensure_password( imap_server_conf_t *srvc )
error( "Skipping account %s, password command crashed\n", srvc->name ); error( "Skipping account %s, password command crashed\n", srvc->name );
else else
error( "Skipping account %s, password command exited with status %d\n", srvc->name, WEXITSTATUS( ret ) ); error( "Skipping account %s, password command exited with status %d\n", srvc->name, WEXITSTATUS( ret ) );
return 0; return NULL;
} }
if (!buffer[0]) { if (!buffer[0]) {
error( "Skipping account %s, password command produced no output\n", srvc->name ); error( "Skipping account %s, password command produced no output\n", srvc->name );
return 0; return NULL;
} }
buffer[strcspn( buffer, "\n" )] = 0; /* Strip trailing newline */ buffer[strcspn( buffer, "\n" )] = 0; /* Strip trailing newline */
free( srvc->pass ); /* From previous runs */ free( srvc->pass ); /* From previous runs */
@ -1970,7 +1970,7 @@ ensure_password( imap_server_conf_t *srvc )
} }
if (!*pass) { if (!*pass) {
error( "Skipping account %s, no password\n", srvc->name ); error( "Skipping account %s, no password\n", srvc->name );
return 0; return NULL;
} }
/* getpass() returns a pointer to a static buffer. Make a copy for long term storage. */ /* getpass() returns a pointer to a static buffer. Make a copy for long term storage. */
srvc->pass = nfstrdup( pass ); srvc->pass = nfstrdup( pass );
@ -2254,7 +2254,7 @@ imap_open_store_authenticate2( imap_store_t *ctx )
if (!ctx->conn.ssl) if (!ctx->conn.ssl)
#endif #endif
warn( "*** IMAP Warning *** Password is being sent in the clear\n" ); warn( "*** IMAP Warning *** Password is being sent in the clear\n" );
imap_exec( ctx, 0, imap_open_store_authenticate2_p2, imap_exec( ctx, NULL, imap_open_store_authenticate2_p2,
"LOGIN \"%\\s\" \"%\\s\"", srvc->user, srvc->pass ); "LOGIN \"%\\s\" \"%\\s\"", srvc->user, srvc->pass );
return; return;
} }
@ -2284,7 +2284,7 @@ imap_open_store_compress( imap_store_t *ctx )
{ {
#ifdef HAVE_LIBZ #ifdef HAVE_LIBZ
if (CAP(COMPRESS_DEFLATE)) { if (CAP(COMPRESS_DEFLATE)) {
imap_exec( ctx, 0, imap_open_store_compress_p2, "COMPRESS DEFLATE" ); imap_exec( ctx, NULL, imap_open_store_compress_p2, "COMPRESS DEFLATE" );
return; return;
} }
#endif #endif
@ -2316,7 +2316,7 @@ imap_open_store_namespace( imap_store_t *ctx )
if (((!ctx->prefix && cfg->use_namespace) || !cfg->delimiter) && CAP(NAMESPACE)) { if (((!ctx->prefix && cfg->use_namespace) || !cfg->delimiter) && CAP(NAMESPACE)) {
/* get NAMESPACE info */ /* get NAMESPACE info */
if (!ctx->got_namespace) if (!ctx->got_namespace)
imap_exec( ctx, 0, imap_open_store_namespace_p2, "NAMESPACE" ); imap_exec( ctx, NULL, imap_open_store_namespace_p2, "NAMESPACE" );
else else
imap_open_store_namespace2( ctx ); imap_open_store_namespace2( ctx );
return; return;
@ -2390,7 +2390,7 @@ imap_select_box( store_t *gctx, const char *name )
imap_store_t *ctx = (imap_store_t *)gctx; imap_store_t *ctx = (imap_store_t *)gctx;
free_generic_messages( ctx->msgs ); free_generic_messages( ctx->msgs );
ctx->msgs = 0; ctx->msgs = NULL;
ctx->msgapp = &ctx->msgs; ctx->msgapp = &ctx->msgs;
ctx->name = name; ctx->name = name;
@ -2400,7 +2400,7 @@ imap_select_box( store_t *gctx, const char *name )
static const char * static const char *
imap_get_box_path( store_t *gctx ATTR_UNUSED ) imap_get_box_path( store_t *gctx ATTR_UNUSED )
{ {
return 0; return NULL;
} }
typedef struct { typedef struct {
@ -2623,7 +2623,7 @@ imap_load_box( store_t *gctx, uint minuid, uint maxuid, uint newuid, uint seenui
if (!ctx->total_msgs) { if (!ctx->total_msgs) {
free( excs.data ); free( excs.data );
cb( DRV_OK, 0, 0, 0, aux ); cb( DRV_OK, NULL, 0, 0, aux );
} else { } else {
INIT_REFCOUNTED_STATE(imap_load_box_state_t, sts, cb, aux) INIT_REFCOUNTED_STATE(imap_load_box_state_t, sts, cb, aux)
for (uint i = 0; i < excs.size; ) { for (uint i = 0; i < excs.size; ) {
@ -2751,7 +2751,7 @@ imap_fetch_msg( store_t *ctx, message_t *msg, msg_data_t *data,
INIT_IMAP_CMD_X(imap_cmd_fetch_msg_t, cmd, cb, aux) INIT_IMAP_CMD_X(imap_cmd_fetch_msg_t, cmd, cb, aux)
cmd->gen.gen.param.uid = msg->uid; cmd->gen.gen.param.uid = msg->uid;
cmd->msg_data = data; cmd->msg_data = data;
data->data = 0; data->data = NULL;
imap_exec( (imap_store_t *)ctx, &cmd->gen.gen, imap_fetch_msg_p2, imap_exec( (imap_store_t *)ctx, &cmd->gen.gen, imap_fetch_msg_p2,
"UID FETCH %u (%s%sBODY.PEEK[])", msg->uid, "UID FETCH %u (%s%sBODY.PEEK[])", msg->uid,
!(msg->status & M_FLAGS) ? "FLAGS " : "", !(msg->status & M_FLAGS) ? "FLAGS " : "",
@ -3208,8 +3208,8 @@ imap_parse_store( conffile_t *cfg, store_conf_t **storep )
server->name = nfstrdup( cfg->val ); server->name = nfstrdup( cfg->val );
*serverapp = server; *serverapp = server;
serverapp = &server->next; serverapp = &server->next;
store = 0; store = NULL;
*storep = 0; *storep = NULL;
} else if (!strcasecmp( "IMAPStore", cfg->cmd )) { } else if (!strcasecmp( "IMAPStore", cfg->cmd )) {
store = nfcalloc( sizeof(*store) ); store = nfcalloc( sizeof(*store) );
store->gen.driver = &imap_driver; store->gen.driver = &imap_driver;
@ -3283,7 +3283,7 @@ imap_parse_store( conffile_t *cfg, store_conf_t **storep )
error( "%s:%d: Unrecognized IMAP extension '%s'\n", cfg->file, cfg->line, arg ); error( "%s:%d: Unrecognized IMAP extension '%s'\n", cfg->file, cfg->line, arg );
cfg->err = 1; cfg->err = 1;
gotcap: ; gotcap: ;
} while ((arg = get_arg( cfg, ARG_OPTIONAL, 0 ))); } while ((arg = get_arg( cfg, ARG_OPTIONAL, NULL )));
} }
#ifdef HAVE_LIBSSL #ifdef HAVE_LIBSSL
else if (!strcasecmp( "CertificateFile", cfg->cmd )) { else if (!strcasecmp( "CertificateFile", cfg->cmd )) {
@ -3343,7 +3343,7 @@ imap_parse_store( conffile_t *cfg, store_conf_t **storep )
error( "%s:%d: Unrecognized SSL version\n", cfg->file, cfg->line ); error( "%s:%d: Unrecognized SSL version\n", cfg->file, cfg->line );
cfg->err = 1; cfg->err = 1;
} }
} while ((arg = get_arg( cfg, ARG_OPTIONAL, 0 ))); } while ((arg = get_arg( cfg, ARG_OPTIONAL, NULL )));
} else if (!strcasecmp( "RequireSSL", cfg->cmd )) } else if (!strcasecmp( "RequireSSL", cfg->cmd ))
require_ssl = parse_bool( cfg ); require_ssl = parse_bool( cfg );
else if (!strcasecmp( "UseIMAPS", cfg->cmd )) else if (!strcasecmp( "UseIMAPS", cfg->cmd ))
@ -3366,7 +3366,7 @@ imap_parse_store( conffile_t *cfg, store_conf_t **storep )
arg = cfg->val; arg = cfg->val;
do do
add_string_list( &server->auth_mechs, arg ); add_string_list( &server->auth_mechs, arg );
while ((arg = get_arg( cfg, ARG_OPTIONAL, 0 ))); while ((arg = get_arg( cfg, ARG_OPTIONAL, NULL )));
} else if (!strcasecmp( "RequireCRAM", cfg->cmd )) } else if (!strcasecmp( "RequireCRAM", cfg->cmd ))
require_cram = parse_bool( cfg ); require_cram = parse_bool( cfg );
else if (!strcasecmp( "Tunnel", cfg->cmd )) else if (!strcasecmp( "Tunnel", cfg->cmd ))

View File

@ -152,7 +152,7 @@ maildir_join_path( maildir_store_conf_t *conf, int in_inbox, const char *box )
prefix = conf->inbox; prefix = conf->inbox;
} else { } else {
if (maildir_ensure_path( conf ) < 0) if (maildir_ensure_path( conf ) < 0)
return 0; return NULL;
prefix = conf->gen.path; prefix = conf->gen.path;
} }
pl = strlen( prefix ); pl = strlen( prefix );
@ -161,13 +161,13 @@ maildir_join_path( maildir_store_conf_t *conf, int in_inbox, const char *box )
if (conf->sub_style == SUB_UNSET) { if (conf->sub_style == SUB_UNSET) {
error( "Maildir error: accessing subfolder '%s', but store '%s' does not specify SubFolders style\n", error( "Maildir error: accessing subfolder '%s', but store '%s' does not specify SubFolders style\n",
box, conf->gen.name ); box, conf->gen.name );
return 0; return NULL;
} }
n++; n++;
} else if (c == '.' && conf->sub_style == SUB_MAILDIRPP) { } else if (c == '.' && conf->sub_style == SUB_MAILDIRPP) {
error( "Maildir error: store '%s', folder '%s': SubFolders style Maildir++ does not support dots in mailbox names\n", error( "Maildir error: store '%s', folder '%s': SubFolders style Maildir++ does not support dots in mailbox names\n",
conf->gen.name, box ); conf->gen.name, box );
return 0; return NULL;
} }
switch (conf->sub_style) { switch (conf->sub_style) {
case SUB_VERBATIM: case SUB_VERBATIM:
@ -419,13 +419,13 @@ maildir_list_recurse( maildir_store_t *ctx, int isBox, int flags,
pl += pathLen; pl += pathLen;
if (inbox && equals( path, pl, inbox, inboxLen )) { if (inbox && equals( path, pl, inbox, inboxLen )) {
// Inbox nested into Path. // Inbox nested into Path.
if (maildir_list_inbox( ctx, flags, 0 ) < 0) { if (maildir_list_inbox( ctx, flags, NULL ) < 0) {
closedir( dir ); closedir( dir );
return -1; return -1;
} }
} else if (basePath && equals( path, pl, basePath, basePathLen )) { } else if (basePath && equals( path, pl, basePath, basePathLen )) {
// Path nested into Inbox. // Path nested into Inbox.
if (maildir_list_path( ctx, flags, 0 ) < 0) { if (maildir_list_path( ctx, flags, NULL ) < 0) {
closedir( dir ); closedir( dir );
return -1; return -1;
} }
@ -477,7 +477,7 @@ maildir_list_inbox( maildir_store_t *ctx, int flags, const char *basePath )
add_string_list( &ctx->boxes, "INBOX" ); add_string_list( &ctx->boxes, "INBOX" );
return maildir_list_recurse( return maildir_list_recurse(
ctx, 1, flags, 0, 0, basePath, basePath ? strlen( basePath ) - 1 : 0, ctx, 1, flags, NULL, 0, basePath, basePath ? strlen( basePath ) - 1 : 0,
path, nfsnprintf( path, _POSIX_PATH_MAX, "%s/", ((maildir_store_conf_t *)ctx->gen.conf)->inbox ), path, nfsnprintf( path, _POSIX_PATH_MAX, "%s/", ((maildir_store_conf_t *)ctx->gen.conf)->inbox ),
name, nfsnprintf( name, _POSIX_PATH_MAX, "INBOX/" ) ); name, nfsnprintf( name, _POSIX_PATH_MAX, "INBOX/" ) );
} }
@ -494,7 +494,7 @@ maildir_list_path( maildir_store_t *ctx, int flags, const char *inbox )
if (maildir_ensure_path( (maildir_store_conf_t *)ctx->gen.conf ) < 0) if (maildir_ensure_path( (maildir_store_conf_t *)ctx->gen.conf ) < 0)
return -1; return -1;
return maildir_list_recurse( return maildir_list_recurse(
ctx, 0, flags, inbox, inbox ? strlen( inbox ) : 0, 0, 0, ctx, 0, flags, inbox, inbox ? strlen( inbox ) : 0, NULL, 0,
path, nfsnprintf( path, _POSIX_PATH_MAX, "%s", ctx->gen.conf->path ), path, nfsnprintf( path, _POSIX_PATH_MAX, "%s", ctx->gen.conf->path ),
name, 0 ); name, 0 );
} }
@ -513,7 +513,7 @@ maildir_list_store( store_t *gctx, int flags,
((flags & LIST_INBOX) ((flags & LIST_INBOX)
&& maildir_list_inbox( ctx, flags, gctx->conf->path ) < 0))) { && maildir_list_inbox( ctx, flags, gctx->conf->path ) < 0))) {
maildir_invoke_bad_callback( ctx ); maildir_invoke_bad_callback( ctx );
cb( DRV_CANCELED, 0, aux ); cb( DRV_CANCELED, NULL, aux );
} else { } else {
cb( DRV_OK, ctx->boxes, aux ); cb( DRV_OK, ctx->boxes, aux );
} }
@ -674,7 +674,7 @@ maildir_store_uidval( maildir_store_t *ctx )
uv[1] = ctx->nuid; uv[1] = ctx->nuid;
value.data = uv; value.data = uv;
value.size = sizeof(uv); value.size = sizeof(uv);
if ((ret = ctx->db->put( ctx->db, 0, &key, &value, 0 ))) { if ((ret = ctx->db->put( ctx->db, NULL, &key, &value, 0 ))) {
ctx->db->err( ctx->db, ret, "Maildir error: db->put()" ); ctx->db->err( ctx->db, ret, "Maildir error: db->put()" );
return DRV_BOX_BAD; return DRV_BOX_BAD;
} }
@ -699,13 +699,13 @@ maildir_store_uidval( maildir_store_t *ctx )
static int static int
maildir_init_uidval( maildir_store_t *ctx ) maildir_init_uidval( maildir_store_t *ctx )
{ {
ctx->uidvalidity = (uint)time( 0 ); ctx->uidvalidity = (uint)time( NULL );
ctx->nuid = 0; ctx->nuid = 0;
ctx->uvok = 0; ctx->uvok = 0;
#ifdef USE_DB #ifdef USE_DB
if (ctx->db) { if (ctx->db) {
u_int32_t count; u_int32_t count;
ctx->db->truncate( ctx->db, 0, &count, 0 ); ctx->db->truncate( ctx->db, NULL, &count, 0 );
} }
#endif /* USE_DB */ #endif /* USE_DB */
return maildir_store_uidval( ctx ); return maildir_store_uidval( ctx );
@ -749,18 +749,18 @@ maildir_uidval_lock( maildir_store_t *ctx )
sys_error( "Maildir error: cannot fstat UID database" ); sys_error( "Maildir error: cannot fstat UID database" );
return DRV_BOX_BAD; return DRV_BOX_BAD;
} }
if (db_create( &ctx->db, 0, 0 )) { if (db_create( &ctx->db, NULL, 0 )) {
fputs( "Maildir error: db_create() failed\n", stderr ); fputs( "Maildir error: db_create() failed\n", stderr );
return DRV_BOX_BAD; return DRV_BOX_BAD;
} }
if ((ret = (ctx->db->open)( ctx->db, 0, ctx->usedb, 0, DB_HASH, if ((ret = (ctx->db->open)( ctx->db, NULL, ctx->usedb, NULL, DB_HASH,
st.st_size ? 0 : DB_CREATE | DB_TRUNCATE, 0 ))) { st.st_size ? 0 : DB_CREATE | DB_TRUNCATE, 0 ))) {
ctx->db->err( ctx->db, ret, "Maildir error: db->open(%s)", ctx->usedb ); ctx->db->err( ctx->db, ret, "Maildir error: db->open(%s)", ctx->usedb );
return DRV_BOX_BAD; return DRV_BOX_BAD;
} }
key.data = (void *)"UIDVALIDITY"; key.data = (void *)"UIDVALIDITY";
key.size = 11; key.size = 11;
if ((ret = ctx->db->get( ctx->db, 0, &key, &value, 0 ))) { if ((ret = ctx->db->get( ctx->db, NULL, &key, &value, 0 ))) {
if (ret != DB_NOTFOUND) { if (ret != DB_NOTFOUND) {
ctx->db->err( ctx->db, ret, "Maildir error: db->get()" ); ctx->db->err( ctx->db, ret, "Maildir error: db->get()" );
return DRV_BOX_BAD; return DRV_BOX_BAD;
@ -798,7 +798,7 @@ maildir_uidval_unlock( maildir_store_t *ctx )
#ifdef USE_DB #ifdef USE_DB
if (ctx->db) { if (ctx->db) {
ctx->db->close( ctx->db, 0 ); ctx->db->close( ctx->db, 0 );
ctx->db = 0; ctx->db = NULL;
} }
#endif /* USE_DB */ #endif /* USE_DB */
lck.l_type = F_UNLCK; lck.l_type = F_UNLCK;
@ -835,7 +835,7 @@ maildir_set_uid( maildir_store_t *ctx, const char *name, uint *uid )
make_key( ((maildir_store_conf_t *)ctx->gen.conf)->info_stop, &key, name ); make_key( ((maildir_store_conf_t *)ctx->gen.conf)->info_stop, &key, name );
value.data = uid; value.data = uid;
value.size = sizeof(*uid); value.size = sizeof(*uid);
if ((ret = ctx->db->put( ctx->db, 0, &key, &value, 0 ))) { if ((ret = ctx->db->put( ctx->db, NULL, &key, &value, 0 ))) {
ctx->db->err( ctx->db, ret, "Maildir error: db->put()" ); ctx->db->err( ctx->db, ret, "Maildir error: db->put()" );
return DRV_BOX_BAD; return DRV_BOX_BAD;
} }
@ -932,11 +932,11 @@ maildir_scan( maildir_store_t *ctx, msg_t_array_alloc_t *msglist )
if (ctx->uvok || ctx->maxuid == UINT_MAX) { if (ctx->uvok || ctx->maxuid == UINT_MAX) {
#ifdef USE_DB #ifdef USE_DB
if (ctx->usedb) { if (ctx->usedb) {
if (db_create( &tdb, 0, 0 )) { if (db_create( &tdb, NULL, 0 )) {
fputs( "Maildir error: db_create() failed\n", stderr ); fputs( "Maildir error: db_create() failed\n", stderr );
return DRV_BOX_BAD; return DRV_BOX_BAD;
} }
if ((tdb->open)( tdb, 0, 0, 0, DB_HASH, DB_CREATE, 0 )) { if ((tdb->open)( tdb, NULL, NULL, NULL, DB_HASH, DB_CREATE, 0 )) {
fputs( "Maildir error: tdb->open() failed\n", stderr ); fputs( "Maildir error: tdb->open() failed\n", stderr );
bork: bork:
tdb->close( tdb, 0 ); tdb->close( tdb, 0 );
@ -946,7 +946,7 @@ maildir_scan( maildir_store_t *ctx, msg_t_array_alloc_t *msglist )
#endif /* USE_DB */ #endif /* USE_DB */
bl = nfsnprintf( buf, sizeof(buf) - 4, "%s/", ctx->path ); bl = nfsnprintf( buf, sizeof(buf) - 4, "%s/", ctx->path );
restat: restat:
now = time( 0 ); now = time( NULL );
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
memcpy( buf + bl, subdirs[i], 4 ); memcpy( buf + bl, subdirs[i], 4 );
if (stat( buf, &st )) { if (stat( buf, &st )) {
@ -987,7 +987,7 @@ maildir_scan( maildir_store_t *ctx, msg_t_array_alloc_t *msglist )
if (maildir_uidval_lock( ctx ) != DRV_OK) if (maildir_uidval_lock( ctx ) != DRV_OK)
goto mbork; goto mbork;
make_key( conf->info_stop, &key, e->d_name ); make_key( conf->info_stop, &key, e->d_name );
if ((ret = ctx->db->get( ctx->db, 0, &key, &value, 0 ))) { if ((ret = ctx->db->get( ctx->db, NULL, &key, &value, 0 ))) {
if (ret != DB_NOTFOUND) { if (ret != DB_NOTFOUND) {
ctx->db->err( ctx->db, ret, "Maildir error: db->get()" ); ctx->db->err( ctx->db, ret, "Maildir error: db->get()" );
mbork: mbork:
@ -998,7 +998,7 @@ maildir_scan( maildir_store_t *ctx, msg_t_array_alloc_t *msglist )
uid = UINT_MAX; uid = UINT_MAX;
} else { } else {
value.size = 0; value.size = 0;
if ((ret = tdb->put( tdb, 0, &key, &value, 0 ))) { if ((ret = tdb->put( tdb, NULL, &key, &value, 0 ))) {
tdb->err( tdb, ret, "Maildir error: tdb->put()" ); tdb->err( tdb, ret, "Maildir error: tdb->put()" );
goto mbork; goto mbork;
} }
@ -1016,7 +1016,7 @@ maildir_scan( maildir_store_t *ctx, msg_t_array_alloc_t *msglist )
continue; continue;
entry = msg_t_array_append( msglist ); entry = msg_t_array_append( msglist );
entry->base = nfstrdup( e->d_name ); entry->base = nfstrdup( e->d_name );
entry->msgid = 0; entry->msgid = NULL;
entry->uid = uid; entry->uid = uid;
entry->recent = (uchar)i; entry->recent = (uchar)i;
entry->size = 0; entry->size = 0;
@ -1045,7 +1045,7 @@ maildir_scan( maildir_store_t *ctx, msg_t_array_alloc_t *msglist )
if (ctx->usedb) { if (ctx->usedb) {
if (maildir_uidval_lock( ctx ) != DRV_OK) if (maildir_uidval_lock( ctx ) != DRV_OK)
; ;
else if ((ret = ctx->db->cursor( ctx->db, 0, &dbc, 0 ))) else if ((ret = ctx->db->cursor( ctx->db, NULL, &dbc, 0 )))
ctx->db->err( ctx->db, ret, "Maildir error: db->cursor()" ); ctx->db->err( ctx->db, ret, "Maildir error: db->cursor()" );
else { else {
for (;;) { for (;;) {
@ -1055,7 +1055,7 @@ maildir_scan( maildir_store_t *ctx, msg_t_array_alloc_t *msglist )
break; break;
} }
if (!equals( key.data, (int)key.size, "UIDVALIDITY", 11 ) && if (!equals( key.data, (int)key.size, "UIDVALIDITY", 11 ) &&
(ret = tdb->get( tdb, 0, &key, &value, 0 ))) { (ret = tdb->get( tdb, NULL, &key, &value, 0 ))) {
if (ret != DB_NOTFOUND) { if (ret != DB_NOTFOUND) {
tdb->err( tdb, ret, "Maildir error: tdb->get()" ); tdb->err( tdb, ret, "Maildir error: tdb->get()" );
break; break;
@ -1217,11 +1217,11 @@ static void
maildir_init_msg( maildir_store_t *ctx, maildir_message_t *msg, msg_t *entry ) maildir_init_msg( maildir_store_t *ctx, maildir_message_t *msg, msg_t *entry )
{ {
msg->base = entry->base; msg->base = entry->base;
entry->base = 0; /* prevent deletion */ entry->base = NULL; /* prevent deletion */
msg->gen.msgid = entry->msgid; msg->gen.msgid = entry->msgid;
entry->msgid = 0; /* prevent deletion */ entry->msgid = NULL; /* prevent deletion */
msg->gen.size = entry->size; msg->gen.size = entry->size;
msg->gen.srec = 0; msg->gen.srec = NULL;
memcpy( msg->gen.tuid, entry->tuid, TUIDL ); memcpy( msg->gen.tuid, entry->tuid, TUIDL );
if (entry->recent) if (entry->recent)
msg->gen.status |= M_RECENT; msg->gen.status |= M_RECENT;
@ -1251,12 +1251,12 @@ maildir_select_box( store_t *gctx, const char *name )
maildir_store_t *ctx = (maildir_store_t *)gctx; maildir_store_t *ctx = (maildir_store_t *)gctx;
maildir_cleanup( gctx ); maildir_cleanup( gctx );
ctx->msgs = 0; ctx->msgs = NULL;
ctx->excs.data = 0; ctx->excs.data = NULL;
ctx->uvfd = -1; ctx->uvfd = -1;
#ifdef USE_DB #ifdef USE_DB
ctx->db = 0; ctx->db = NULL;
ctx->usedb = 0; ctx->usedb = NULL;
#endif /* USE_DB */ #endif /* USE_DB */
ctx->fresh[0] = ctx->fresh[1] = 0; ctx->fresh[0] = ctx->fresh[1] = 0;
if (starts_with( name, -1, "INBOX", 5 ) && (!name[5] || name[5] == '/')) { if (starts_with( name, -1, "INBOX", 5 ) && (!name[5] || name[5] == '/')) {
@ -1300,7 +1300,7 @@ maildir_open_box( store_t *gctx,
return; return;
} }
#else #else
ctx->usedb = 0; ctx->usedb = NULL;
if ((ctx->uvfd = open( uvpath, O_RDWR, 0600 )) < 0) { if ((ctx->uvfd = open( uvpath, O_RDWR, 0600 )) < 0) {
nfsnprintf( uvpath, sizeof(uvpath), "%s/.isyncuidmap.db", ctx->path ); nfsnprintf( uvpath, sizeof(uvpath), "%s/.isyncuidmap.db", ctx->path );
if ((ctx->uvfd = open( uvpath, O_RDWR, 0600 )) < 0) { if ((ctx->uvfd = open( uvpath, O_RDWR, 0600 )) < 0) {
@ -1451,7 +1451,7 @@ maildir_load_box( store_t *gctx, uint minuid, uint maxuid, uint newuid, uint see
ctx->excs = excs; ctx->excs = excs;
if (maildir_scan( ctx, &msglist ) != DRV_OK) { if (maildir_scan( ctx, &msglist ) != DRV_OK) {
cb( DRV_BOX_BAD, 0, 0, 0, aux ); cb( DRV_BOX_BAD, NULL, 0, 0, aux );
return; return;
} }
msgapp = &ctx->msgs; msgapp = &ctx->msgs;
@ -1592,7 +1592,7 @@ maildir_store_msg( store_t *gctx, msg_data_t *data, int to_trash,
uint uid; uint uid;
char buf[_POSIX_PATH_MAX], nbuf[_POSIX_PATH_MAX], fbuf[NUM_FLAGS + 3], base[128]; char buf[_POSIX_PATH_MAX], nbuf[_POSIX_PATH_MAX], fbuf[NUM_FLAGS + 3], base[128];
bl = nfsnprintf( base, sizeof(base), "%lld.%d_%d.%s", (long long)time( 0 ), Pid, ++MaildirCount, Hostname ); bl = nfsnprintf( base, sizeof(base), "%lld.%d_%d.%s", (long long)time( NULL ), Pid, ++MaildirCount, Hostname );
if (!to_trash) { if (!to_trash) {
#ifdef USE_DB #ifdef USE_DB
if (ctx->usedb) { if (ctx->usedb) {
@ -1744,7 +1744,7 @@ maildir_purge_msg( maildir_store_t *ctx, const char *name )
if ((ret = maildir_uidval_lock( ctx )) != DRV_OK) if ((ret = maildir_uidval_lock( ctx )) != DRV_OK)
return ret; return ret;
make_key( ((maildir_store_conf_t *)ctx->gen.conf)->info_stop, &key, name ); make_key( ((maildir_store_conf_t *)ctx->gen.conf)->info_stop, &key, name );
if ((ret = ctx->db->del( ctx->db, 0, &key, 0 ))) { if ((ret = ctx->db->del( ctx->db, NULL, &key, 0 ))) {
ctx->db->err( ctx->db, ret, "Maildir error: db->del()" ); ctx->db->err( ctx->db, ret, "Maildir error: db->del()" );
return DRV_BOX_BAD; return DRV_BOX_BAD;
} }
@ -1767,7 +1767,7 @@ maildir_trash_msg( store_t *gctx, message_t *gmsg,
nfsnprintf( buf, sizeof(buf), "%s/%s/%s", ctx->path, subdirs[gmsg->status & M_RECENT], msg->base ); nfsnprintf( buf, sizeof(buf), "%s/%s/%s", ctx->path, subdirs[gmsg->status & M_RECENT], msg->base );
s = strstr( msg->base, ((maildir_store_conf_t *)gctx->conf)->info_prefix ); s = strstr( msg->base, ((maildir_store_conf_t *)gctx->conf)->info_prefix );
nfsnprintf( nbuf, sizeof(nbuf), "%s/%s/%lld.%d_%d.%s%s", ctx->trash, nfsnprintf( nbuf, sizeof(nbuf), "%s/%s/%lld.%d_%d.%s%s", ctx->trash,
subdirs[gmsg->status & M_RECENT], (long long)time( 0 ), Pid, ++MaildirCount, Hostname, s ? s : "" ); subdirs[gmsg->status & M_RECENT], (long long)time( NULL ), Pid, ++MaildirCount, Hostname, s ? s : "" );
if (!rename( buf, nbuf )) if (!rename( buf, nbuf ))
break; break;
if (!stat( buf, &st )) { if (!stat( buf, &st )) {

View File

@ -128,7 +128,7 @@ for (@ptypes) {
/^([\w* ]+)\(\*(\w+)\)\( (.*) \)$/ or die("Cannot parse prototype '$_'\n"); /^([\w* ]+)\(\*(\w+)\)\( (.*) \)$/ or die("Cannot parse prototype '$_'\n");
my ($cmd_type, $cmd_name, $cmd_args) = ($1, $2, $3); my ($cmd_type, $cmd_name, $cmd_args) = ($1, $2, $3);
if (defined($excluded{$cmd_name})) { if (defined($excluded{$cmd_name})) {
push @cmd_table, "0"; push @cmd_table, "NULL";
next; next;
} }
push @cmd_table, "proxy_$cmd_name"; push @cmd_table, "proxy_$cmd_name";

View File

@ -175,7 +175,7 @@ crashHandler( int n )
close( pip[1] ); close( pip[1] );
close( pip[0] ); close( pip[0] );
#endif #endif
waitpid( dpid, 0, 0 ); waitpid( dpid, NULL, 0 );
break; break;
} }
exit( 3 ); exit( 3 );
@ -262,7 +262,7 @@ static char **
filter_boxes( string_list_t *boxes, const char *prefix, string_list_t *patterns ) filter_boxes( string_list_t *boxes, const char *prefix, string_list_t *patterns )
{ {
string_list_t *cpat; string_list_t *cpat;
char **boxarr = 0; char **boxarr = NULL;
const char *ps; const char *ps;
uint not, fnot, pfxl, num = 0, rnum = 0; uint not, fnot, pfxl, num = 0, rnum = 0;
@ -287,7 +287,7 @@ filter_boxes( string_list_t *boxes, const char *prefix, string_list_t *patterns
if (num + 1 >= rnum) if (num + 1 >= rnum)
boxarr = nfrealloc( boxarr, (rnum = (rnum + 10) * 2) * sizeof(*boxarr) ); boxarr = nfrealloc( boxarr, (rnum = (rnum + 10) * 2) * sizeof(*boxarr) );
boxarr[num++] = nfstrdup( boxes->string + pfxl ); boxarr[num++] = nfstrdup( boxes->string + pfxl );
boxarr[num] = 0; boxarr[num] = NULL;
} }
} }
qsort( boxarr, num, sizeof(*boxarr), cmp_box_names ); qsort( boxarr, num, sizeof(*boxarr), cmp_box_names );
@ -348,7 +348,7 @@ add_named_channel( chan_ent_t ***chanapp, char *channame, int ops[] )
{ {
channel_conf_t *chan; channel_conf_t *chan;
chan_ent_t *ce; chan_ent_t *ce;
box_ent_t *boxes = 0, **mboxapp = &boxes, *mbox; box_ent_t *boxes = NULL, **mboxapp = &boxes, *mbox;
char *boxp, *nboxp; char *boxp, *nboxp;
size_t boxl; size_t boxl;
char boxlist = 0; char boxlist = 0;
@ -359,12 +359,12 @@ add_named_channel( chan_ent_t ***chanapp, char *channame, int ops[] )
if (!strcmp( chan->name, channame )) if (!strcmp( chan->name, channame ))
goto gotchan; goto gotchan;
error( "No channel or group named '%s' defined.\n", channame ); error( "No channel or group named '%s' defined.\n", channame );
return 0; return NULL;
gotchan: gotchan:
if (boxp) { if (boxp) {
if (!chan->patterns) { if (!chan->patterns) {
error( "Cannot override mailbox in channel '%s' - no Patterns.\n", channame ); error( "Cannot override mailbox in channel '%s' - no Patterns.\n", channame );
return 0; return NULL;
} }
boxlist = 1; boxlist = 1;
do { do {
@ -381,7 +381,7 @@ add_named_channel( chan_ent_t ***chanapp, char *channame, int ops[] )
else else
mbox->name = nfstrndup( "INBOX", 5 ); mbox->name = nfstrndup( "INBOX", 5 );
mbox->present[M] = mbox->present[S] = BOX_POSSIBLE; mbox->present[M] = mbox->present[S] = BOX_POSSIBLE;
mbox->next = 0; mbox->next = NULL;
*mboxapp = mbox; *mboxapp = mbox;
mboxapp = &mbox->next; mboxapp = &mbox->next;
boxes_total++; boxes_total++;
@ -426,11 +426,11 @@ int
main( int argc, char **argv ) main( int argc, char **argv )
{ {
main_vars_t mvars[1]; main_vars_t mvars[1];
chan_ent_t *chans = 0, **chanapp = &chans; chan_ent_t *chans = NULL, **chanapp = &chans;
group_conf_t *group; group_conf_t *group;
channel_conf_t *chan; channel_conf_t *chan;
string_list_t *channame; string_list_t *channame;
char *config = 0, *opt, *ochar; char *config = NULL, *opt, *ochar;
int oind, cops = 0, op, ops[2] = { 0, 0 }, pseudo = 0; int oind, cops = 0, op, ops[2] = { 0, 0 }, pseudo = 0;
tzset(); tzset();
@ -447,7 +447,7 @@ main( int argc, char **argv )
memset( mvars, 0, sizeof(*mvars) ); memset( mvars, 0, sizeof(*mvars) );
mvars->t[1] = 1; mvars->t[1] = 1;
for (oind = 1, ochar = 0; ; ) { for (oind = 1, ochar = NULL; ; ) {
if (!ochar || !*ochar) { if (!ochar || !*ochar) {
if (oind >= argc) if (oind >= argc)
break; break;
@ -846,7 +846,7 @@ sync_chans( main_vars_t *mvars, int ent )
if (mvars->skip) if (mvars->skip)
goto next2; goto next2;
mvars->state[M] = mvars->state[S] = ST_FRESH; mvars->state[M] = mvars->state[S] = ST_FRESH;
if ((DFlags & DEBUG_DRV) || (mvars->chan->stores[M]->driver->get_caps( 0 ) & mvars->chan->stores[S]->driver->get_caps( 0 ) & DRV_VERBOSE)) if ((DFlags & DEBUG_DRV) || (mvars->chan->stores[M]->driver->get_caps( NULL ) & mvars->chan->stores[S]->driver->get_caps( NULL ) & DRV_VERBOSE))
labels[M] = "M: ", labels[S] = "S: "; labels[M] = "M: ", labels[S] = "S: ";
else else
labels[M] = labels[S] = ""; labels[M] = labels[S] = "";
@ -881,8 +881,8 @@ sync_chans( main_vars_t *mvars, int ent )
boxes[S] = filter_boxes( mvars->boxes[S], mvars->chan->boxes[S], mvars->chan->patterns ); boxes[S] = filter_boxes( mvars->boxes[S], mvars->chan->boxes[S], mvars->chan->patterns );
mboxapp = &mvars->chanptr->boxes; mboxapp = &mvars->chanptr->boxes;
for (mb = sb = 0; ; ) { for (mb = sb = 0; ; ) {
char *mname = boxes[M] ? boxes[M][mb] : 0; char *mname = boxes[M] ? boxes[M][mb] : NULL;
char *sname = boxes[S] ? boxes[S][sb] : 0; char *sname = boxes[S] ? boxes[S][sb] : NULL;
if (!mname && !sname) if (!mname && !sname)
break; break;
mbox = nfmalloc( sizeof(*mbox) ); mbox = nfmalloc( sizeof(*mbox) );
@ -903,7 +903,7 @@ sync_chans( main_vars_t *mvars, int ent )
mbox->present[S] = BOX_PRESENT; mbox->present[S] = BOX_PRESENT;
sb++; sb++;
} }
mbox->next = 0; mbox->next = NULL;
*mboxapp = mbox; *mboxapp = mbox;
mboxapp = &mbox->next; mboxapp = &mbox->next;
boxes_total++; boxes_total++;
@ -945,7 +945,7 @@ sync_chans( main_vars_t *mvars, int ent )
mvars->cben = 0; mvars->cben = 0;
for (t = 0; t < 2; t++) { for (t = 0; t < 2; t++) {
free_string_list( mvars->boxes[t] ); free_string_list( mvars->boxes[t] );
mvars->boxes[t] = 0; mvars->boxes[t] = NULL;
if (mvars->state[t] == ST_FRESH) { if (mvars->state[t] == ST_FRESH) {
/* An unconnected store may be only cancelled. */ /* An unconnected store may be only cancelled. */
mvars->state[t] = ST_CLOSED; mvars->state[t] = ST_CLOSED;
@ -966,7 +966,7 @@ sync_chans( main_vars_t *mvars, int ent )
free( mbox->name ); free( mbox->name );
free( mbox ); free( mbox );
} }
mvars->chanptr->boxes = 0; mvars->chanptr->boxes = NULL;
mvars->chanptr->boxlist = 0; mvars->chanptr->boxlist = 0;
} }
next2: next2:

View File

@ -117,11 +117,11 @@ convert( const char *box, int altmap )
sys_error( "Cannot create %s", tdpath ); sys_error( "Cannot create %s", tdpath );
goto sbork; goto sbork;
} }
if (db_create( &db, 0, 0 )) { if (db_create( &db, NULL, 0 )) {
fputs( "Error: db_create() failed\n", stderr ); fputs( "Error: db_create() failed\n", stderr );
goto tbork; goto tbork;
} }
if ((ret = (db->open)( db, 0, dbpath, 0, DB_HASH, altmap ? DB_CREATE|DB_TRUNCATE : 0, 0 ))) { if ((ret = (db->open)( db, NULL, dbpath, NULL, DB_HASH, altmap ? DB_CREATE|DB_TRUNCATE : 0, 0 ))) {
db->err( db, ret, "Error: db->open(%s)", dbpath ); db->err( db, ret, "Error: db->open(%s)", dbpath );
dbork: dbork:
db->close( db, 0 ); db->close( db, 0 );
@ -143,12 +143,12 @@ convert( const char *box, int altmap )
} }
value.data = uv; value.data = uv;
value.size = sizeof(uv); value.size = sizeof(uv);
if ((ret = db->put( db, 0, &key, &value, 0 ))) { if ((ret = db->put( db, NULL, &key, &value, 0 ))) {
db->err( db, ret, "Error: cannot write UIDVALIDITY for '%s'", box ); db->err( db, ret, "Error: cannot write UIDVALIDITY for '%s'", box );
goto dbork; goto dbork;
} }
} else { } else {
if ((ret = db->get( db, 0, &key, &value, 0 ))) { if ((ret = db->get( db, NULL, &key, &value, 0 ))) {
db->err( db, ret, "Error: cannot read UIDVALIDITY of '%s'", box ); db->err( db, ret, "Error: cannot read UIDVALIDITY of '%s'", box );
goto dbork; goto dbork;
} }
@ -188,7 +188,7 @@ convert( const char *box, int altmap )
uid = atoi( p + 3 ); uid = atoi( p + 3 );
value.data = &uid; value.data = &uid;
value.size = sizeof(uid); value.size = sizeof(uid);
if ((ret = db->put( db, 0, &key, &value, 0 ))) { if ((ret = db->put( db, NULL, &key, &value, 0 ))) {
db->err( db, ret, "Error: cannot write UID for '%s'", box ); db->err( db, ret, "Error: cannot write UID for '%s'", box );
goto ebork; goto ebork;
} }
@ -197,7 +197,7 @@ convert( const char *box, int altmap )
s = strpbrk( e->d_name, ",:" ); s = strpbrk( e->d_name, ",:" );
key.data = e->d_name; key.data = e->d_name;
key.size = s ? (size_t)(s - e->d_name) : strlen( e->d_name ); key.size = s ? (size_t)(s - e->d_name) : strlen( e->d_name );
if ((ret = db->get( db, 0, &key, &value, 0 ))) { if ((ret = db->get( db, NULL, &key, &value, 0 ))) {
if (ret != DB_NOTFOUND) { if (ret != DB_NOTFOUND) {
db->err( db, ret, "Error: cannot read UID for '%s'", box ); db->err( db, ret, "Error: cannot read UID for '%s'", box );
goto ebork; goto ebork;

View File

@ -74,7 +74,7 @@ print_ssl_errors( const char *fmt, ... )
nfvasprintf( &action, fmt, va ); nfvasprintf( &action, fmt, va );
va_end( va ); va_end( va );
while ((err = ERR_get_error())) while ((err = ERR_get_error()))
error( "Error while %s: %s\n", action, ERR_error_string( err, 0 ) ); error( "Error while %s: %s\n", action, ERR_error_string( err, NULL ) );
free( action ); free( action );
} }
@ -85,7 +85,7 @@ print_ssl_socket_errors( const char *func, conn_t *conn )
int num = 0; int num = 0;
while ((err = ERR_get_error())) { while ((err = ERR_get_error())) {
error( "Socket error: secure %s %s: %s\n", func, conn->name, ERR_error_string( err, 0 ) ); error( "Socket error: secure %s %s: %s\n", func, conn->name, ERR_error_string( err, NULL ) );
num++; num++;
} }
return num; return num;
@ -273,7 +273,7 @@ DIAG_POP
return 0; return 0;
} }
if (conf->cert_file && !SSL_CTX_load_verify_locations( mconf->SSLContext, conf->cert_file, 0 )) { if (conf->cert_file && !SSL_CTX_load_verify_locations( mconf->SSLContext, conf->cert_file, NULL )) {
print_ssl_errors( "loading certificate file '%s'", conf->cert_file ); print_ssl_errors( "loading certificate file '%s'", conf->cert_file );
return 0; return 0;
} }
@ -281,7 +281,7 @@ DIAG_POP
if (mconf->system_certs && !SSL_CTX_set_default_verify_paths( mconf->SSLContext )) { if (mconf->system_certs && !SSL_CTX_set_default_verify_paths( mconf->SSLContext )) {
ulong err; ulong err;
while ((err = ERR_get_error())) while ((err = ERR_get_error()))
warn( "Warning: Unable to load default certificate files: %s\n", ERR_error_string( err, 0 ) ); warn( "Warning: Unable to load default certificate files: %s\n", ERR_error_string( err, NULL ) );
} }
SSL_CTX_set_verify( mconf->SSLContext, SSL_VERIFY_NONE, NULL ); SSL_CTX_set_verify( mconf->SSLContext, SSL_VERIFY_NONE, NULL );
@ -602,7 +602,7 @@ socket_connect_next( conn_t *conn )
{ {
sys_error( "Cannot connect to %s", conn->name ); sys_error( "Cannot connect to %s", conn->name );
free( conn->name ); free( conn->name );
conn->name = 0; conn->name = NULL;
conn->curr_addr = conn->curr_addr->ai_next; conn->curr_addr = conn->curr_addr->ai_next;
socket_connect_one( conn ); socket_connect_one( conn );
} }
@ -619,7 +619,7 @@ socket_connected( conn_t *conn )
{ {
if (conn->addrs) { if (conn->addrs) {
freeaddrinfo( conn->addrs ); freeaddrinfo( conn->addrs );
conn->addrs = 0; conn->addrs = NULL;
} }
conf_notifier( &conn->notify, 0, POLLIN ); conf_notifier( &conn->notify, 0, POLLIN );
socket_expect_activity( conn, 0 ); socket_expect_activity( conn, 0 );
@ -632,10 +632,10 @@ socket_cleanup_names( conn_t *conn )
{ {
if (conn->addrs) { if (conn->addrs) {
freeaddrinfo( conn->addrs ); freeaddrinfo( conn->addrs );
conn->addrs = 0; conn->addrs = NULL;
} }
free( conn->name ); free( conn->name );
conn->name = 0; conn->name = NULL;
} }
static void static void
@ -656,7 +656,7 @@ socket_close( conn_t *sock )
#ifdef HAVE_LIBSSL #ifdef HAVE_LIBSSL
if (sock->ssl) { if (sock->ssl) {
SSL_free( sock->ssl ); SSL_free( sock->ssl );
sock->ssl = 0; sock->ssl = NULL;
wipe_wakeup( &sock->ssl_fake ); wipe_wakeup( &sock->ssl_fake );
} }
#endif #endif
@ -664,17 +664,17 @@ socket_close( conn_t *sock )
if (sock->in_z) { if (sock->in_z) {
inflateEnd( sock->in_z ); inflateEnd( sock->in_z );
free( sock->in_z ); free( sock->in_z );
sock->in_z = 0; sock->in_z = NULL;
deflateEnd( sock->out_z ); deflateEnd( sock->out_z );
free( sock->out_z ); free( sock->out_z );
sock->out_z = 0; sock->out_z = NULL;
wipe_wakeup( &sock->z_fake ); wipe_wakeup( &sock->z_fake );
} }
#endif #endif
while (sock->write_buf) while (sock->write_buf)
dispose_chunk( sock ); dispose_chunk( sock );
free( sock->append_buf ); free( sock->append_buf );
sock->append_buf = 0; sock->append_buf = NULL;
} }
static int static int
@ -822,7 +822,7 @@ socket_read_line( conn_t *b )
} }
if (b->state == SCK_EOF) if (b->state == SCK_EOF)
return (void *)~0; return (void *)~0;
return 0; return NULL;
} }
n = (uint)(p + 1 - s); n = (uint)(p + 1 - s);
b->offset += n; b->offset += n;
@ -902,7 +902,7 @@ do_queued_write( conn_t *conn )
static void static void
do_append( conn_t *conn, buff_chunk_t *bc ) do_append( conn_t *conn, buff_chunk_t *bc )
{ {
bc->next = 0; bc->next = NULL;
conn->buffer_mem += bc->len; conn->buffer_mem += bc->len;
*conn->write_buf_append = bc; *conn->write_buf_append = bc;
conn->write_buf_append = &bc->next; conn->write_buf_append = &bc->next;
@ -942,7 +942,7 @@ do_flush( conn_t *conn )
bc->len = (uint)((char *)conn->out_z->next_out - bc->data); bc->len = (uint)((char *)conn->out_z->next_out - bc->data);
if (bc->len) { if (bc->len) {
do_append( conn, bc ); do_append( conn, bc );
bc = 0; bc = NULL;
buf_avail = 0; buf_avail = 0;
} else { } else {
buf_avail = conn->out_z->avail_out; buf_avail = conn->out_z->avail_out;
@ -955,7 +955,7 @@ do_flush( conn_t *conn )
#endif #endif
if (bc) { if (bc) {
do_append( conn, bc ); do_append( conn, bc );
conn->append_buf = 0; conn->append_buf = NULL;
#ifdef HAVE_LIBZ #ifdef HAVE_LIBZ
conn->append_avail = 0; conn->append_avail = 0;
#endif #endif
@ -1033,7 +1033,7 @@ socket_write( conn_t *conn, conn_iovec_t *iov, int iovcnt )
} }
if (!buf_avail) { if (!buf_avail) {
do_append( conn, bc ); do_append( conn, bc );
bc = 0; bc = NULL;
break; break;
} }
} }

View File

@ -134,7 +134,7 @@ static INLINE void socket_init( conn_t *conn,
conn->write_callback = write_callback; conn->write_callback = write_callback;
conn->callback_aux = aux; conn->callback_aux = aux;
conn->fd = -1; conn->fd = -1;
conn->name = 0; conn->name = NULL;
conn->write_buf_append = &conn->write_buf; conn->write_buf_append = &conn->write_buf;
} }
void socket_connect( conn_t *conn, void (*cb)( int ok, void *aux ) ); void socket_connect( conn_t *conn, void (*cb)( int ok, void *aux ) );

View File

@ -237,7 +237,7 @@ static void
match_tuids( sync_vars_t *svars, int t, message_t *msgs ) match_tuids( sync_vars_t *svars, int t, message_t *msgs )
{ {
sync_rec_t *srec; sync_rec_t *srec;
message_t *tmsg, *ntmsg = 0; message_t *tmsg, *ntmsg = NULL;
const char *diag; const char *diag;
int num_lost = 0; int num_lost = 0;
@ -870,7 +870,7 @@ load_state( sync_vars_t *svars )
"(got %s, expected " JOURNAL_VERSION ")\n", buf ); "(got %s, expected " JOURNAL_VERSION ")\n", buf );
goto jbail; goto jbail;
} }
srec = 0; srec = NULL;
line = 1; line = 1;
while (fgets( buf, sizeof(buf), jfp )) { while (fgets( buf, sizeof(buf), jfp )) {
line++; line++;
@ -1330,7 +1330,7 @@ box_opened2( sync_vars_t *svars, int t )
sync_ref( svars ); sync_ref( svars );
load_box( svars, M, minwuid, mexcs.array ); load_box( svars, M, minwuid, mexcs.array );
if (!check_cancel( svars )) if (!check_cancel( svars ))
load_box( svars, S, (svars->opts[S] & OPEN_OLD) ? 1 : UINT_MAX, (uint_array_t){ 0, 0 } ); load_box( svars, S, (svars->opts[S] & OPEN_OLD) ? 1 : UINT_MAX, (uint_array_t){ NULL, 0 } );
sync_deref( svars ); sync_deref( svars );
} }
@ -1748,7 +1748,7 @@ box_loaded( int sts, message_t *msgs, int total_msgs, int recent_msgs, void *aux
// but some are still propagated because they are important, we need to // but some are still propagated because they are important, we need to
// ensure explicitly that the bulk fetch limit is upped. // ensure explicitly that the bulk fetch limit is upped.
svars->mmaxxuid = srec->uid[M]; svars->mmaxxuid = srec->uid[M];
srec->msg[M]->srec = 0; srec->msg[M]->srec = NULL;
srec->status = S_DEAD; srec->status = S_DEAD;
} }
} }
@ -2063,7 +2063,7 @@ msgs_flags_set( sync_vars_t *svars, int t )
cv = nfmalloc( sizeof(*cv) ); cv = nfmalloc( sizeof(*cv) );
cv->cb = msg_rtrashed; cv->cb = msg_rtrashed;
cv->aux = INV_AUX; cv->aux = INV_AUX;
cv->srec = 0; cv->srec = NULL;
cv->msg = tmsg; cv->msg = tmsg;
copy_msg( cv ); copy_msg( cv );
if (check_cancel( svars )) if (check_cancel( svars ))

View File

@ -455,7 +455,7 @@ expand_strdup( const char *s )
if (*s == '~') { if (*s == '~') {
s++; s++;
if (!*s) { if (!*s) {
p = 0; p = NULL;
q = Home; q = Home;
} else if (*s == '/') { } else if (*s == '/') {
p = s; p = s;
@ -468,7 +468,7 @@ expand_strdup( const char *s )
} else } else
pw = getpwnam( s ); pw = getpwnam( s );
if (!pw) if (!pw)
return 0; return NULL;
q = pw->pw_dir; q = pw->pw_dir;
} }
nfasprintf( &r, "%s%s", q, p ? p : "" ); nfasprintf( &r, "%s%s", q, p ? p : "" );
@ -656,7 +656,7 @@ list_unlink( list_head_t *head )
assert( head->prev->next == head); assert( head->prev->next == head);
head->next->prev = head->prev; head->next->prev = head->prev;
head->prev->next = head->next; head->prev->next = head->next;
head->next = head->prev = 0; head->next = head->prev = NULL;
} }
static notifier_t *notifiers; static notifier_t *notifiers;
@ -714,7 +714,7 @@ wipe_notifier( notifier_t *sn )
for (snp = &notifiers; *snp != sn; snp = &(*snp)->next) for (snp = &notifiers; *snp != sn; snp = &(*snp)->next)
assert( *snp ); assert( *snp );
*snp = sn->next; *snp = sn->next;
sn->next = 0; sn->next = NULL;
changed = 1; changed = 1;
#ifdef HAVE_SYS_POLL_H #ifdef HAVE_SYS_POLL_H
@ -730,7 +730,7 @@ wipe_notifier( notifier_t *sn )
static time_t static time_t
get_now( void ) get_now( void )
{ {
return time( 0 ); return time( NULL );
} }
static list_head_t timers = { &timers, &timers }; static list_head_t timers = { &timers, &timers };
@ -740,7 +740,7 @@ init_wakeup( wakeup_t *tmr, void (*cb)( void * ), void *aux )
{ {
tmr->cb = cb; tmr->cb = cb;
tmr->aux = aux; tmr->aux = aux;
tmr->links.next = tmr->links.prev = 0; tmr->links.next = tmr->links.prev = NULL;
} }
void void