diff --git a/src/common.h b/src/common.h index f1eab8c..b5f3c74 100644 --- a/src/common.h +++ b/src/common.h @@ -174,7 +174,7 @@ time_t timegm( struct tm *tm ); #endif void *nfmalloc( size_t sz ); -void *nfcalloc( size_t sz ); +void *nfzalloc( size_t sz ); void *nfrealloc( void *mem, size_t sz ); char *nfstrndup( const char *str, size_t nchars ); char *nfstrdup( const char *str ); diff --git a/src/config.c b/src/config.c index e896bdd..4cb8361 100644 --- a/src/config.c +++ b/src/config.c @@ -395,7 +395,7 @@ load_config( const char *where ) } } if (!strcasecmp( "Channel", cfile.cmd )) { - channel = nfcalloc( sizeof(*channel) ); + channel = nfzalloc( sizeof(*channel) ); channel->name = nfstrdup( cfile.val ); channel->max_messages = global_conf.max_messages; channel->expire_unread = global_conf.expire_unread; diff --git a/src/drv_imap.c b/src/drv_imap.c index 9ef51e0..849de54 100644 --- a/src/drv_imap.c +++ b/src/drv_imap.c @@ -1208,7 +1208,7 @@ parse_fetch_rsp( imap_store_t *ctx, list_t *list, char *s ATTR_UNUSED ) // Workaround for server not sending UIDNEXT and/or APPENDUID. ctx->uidnext = uid + 1; } else if (ctx->fetch_sts == FetchMsgs) { - cur = nfcalloc( sizeof(*cur) ); + cur = nfzalloc( sizeof(*cur) ); *ctx->msgapp = cur; ctx->msgapp = &cur->next; cur->uid = uid; @@ -1933,7 +1933,7 @@ imap_alloc_store( store_conf_t *conf, const char *label ) } /* Finally, schedule opening a new server connection. */ - ctx = nfcalloc( sizeof(*ctx) ); + ctx = nfzalloc( sizeof(*ctx) ); ctx->driver = &imap_driver; ctx->ref_count = 1; socket_init( &ctx->conn, &srvc->sconf, @@ -3502,7 +3502,7 @@ imap_parse_store( conffile_t *cfg, store_conf_t **storep ) int require_cram = -1; if (!strcasecmp( "IMAPAccount", cfg->cmd )) { - server = nfcalloc( sizeof(*server) ); + server = nfzalloc( sizeof(*server) ); name = server->name = nfstrdup( cfg->val ); *serverapp = server; serverapp = &server->next; @@ -3510,7 +3510,7 @@ imap_parse_store( conffile_t *cfg, store_conf_t **storep ) *storep = NULL; type = "IMAP account"; } else if (!strcasecmp( "IMAPStore", cfg->cmd )) { - store = nfcalloc( sizeof(*store) ); + store = nfzalloc( sizeof(*store) ); store->driver = &imap_driver; name = store->name = nfstrdup( cfg->val ); store->use_namespace = 1; diff --git a/src/drv_maildir.c b/src/drv_maildir.c index d74a4f7..25451d5 100644 --- a/src/drv_maildir.c +++ b/src/drv_maildir.c @@ -208,7 +208,7 @@ maildir_alloc_store( store_conf_t *gconf, const char *label ATTR_UNUSED ) { maildir_store_t *ctx; - ctx = nfcalloc( sizeof(*ctx) ); + ctx = nfzalloc( sizeof(*ctx) ); ctx->driver = &maildir_driver; ctx->gen.conf = gconf; ctx->uvfd = -1; @@ -1870,7 +1870,7 @@ maildir_parse_store( conffile_t *cfg, store_conf_t **storep ) if (strcasecmp( "MaildirStore", cfg->cmd )) return 0; - store = nfcalloc( sizeof(*store) ); + store = nfzalloc( sizeof(*store) ); store->info_delimiter = FieldDelimiter; store->driver = &maildir_driver; store->name = nfstrdup( cfg->val ); diff --git a/src/drv_proxy.c b/src/drv_proxy.c index 54902ff..bbbd47d 100644 --- a/src/drv_proxy.c +++ b/src/drv_proxy.c @@ -389,7 +389,7 @@ proxy_alloc_store( store_t *real_ctx, const char *label ) { proxy_store_t *ctx; - ctx = nfcalloc( sizeof(*ctx) ); + ctx = nfzalloc( sizeof(*ctx) ); ctx->driver = &proxy_driver; ctx->gen.conf = real_ctx->conf; ctx->ref_count = 1; diff --git a/src/main.c b/src/main.c index e093610..3a9936f 100644 --- a/src/main.c +++ b/src/main.c @@ -284,7 +284,7 @@ typedef struct chan_ent { static chan_ent_t * add_channel( chan_ent_t ***chanapp, channel_conf_t *chan, int ops[] ) { - chan_ent_t *ce = nfcalloc( sizeof(*ce) ); + chan_ent_t *ce = nfzalloc( sizeof(*ce) ); ce->conf = chan; merge_actions( chan, ops, XOP_HAVE_TYPE, OP_MASK_TYPE, OP_MASK_TYPE ); diff --git a/src/socket.c b/src/socket.c index 3b3288c..f6e3f7f 100644 --- a/src/socket.c +++ b/src/socket.c @@ -382,7 +382,7 @@ socket_start_deflate( conn_t *conn ) { int result; - conn->in_z = nfcalloc( sizeof(*conn->in_z) ); + conn->in_z = nfzalloc( sizeof(*conn->in_z) ); result = inflateInit2( conn->in_z, -15 /* Use raw deflate */ @@ -392,7 +392,7 @@ socket_start_deflate( conn_t *conn ) abort(); } - conn->out_z = nfcalloc( sizeof(*conn->out_z) ); + conn->out_z = nfzalloc( sizeof(*conn->out_z) ); result = deflateInit2( conn->out_z, Z_DEFAULT_COMPRESSION, /* Compression level */ @@ -454,7 +454,7 @@ init_addrinfo( struct hostent *he ) uint naddr = 0; for (char **addr = he->h_addr_list; *addr; addr++) naddr++; - struct addr_info *caddr = nfcalloc( naddr * sizeof(struct addrinfo) ); + struct addr_info *caddr = nfzalloc( naddr * sizeof(struct addrinfo) ); struct addr_info *ret, **caddrp = &ret; for (char **addr = he->h_addr_list; *addr; addr++, caddr++) { caddr->ai_addr->sin_family = AF_INET; diff --git a/src/sync.c b/src/sync.c index 382804f..d9b2b1a 100644 --- a/src/sync.c +++ b/src/sync.c @@ -662,7 +662,7 @@ static sync_rec_t * upgrade_srec( sync_vars_t *svars, sync_rec_t *srec ) { // Create an entry and append it to the current one. - sync_rec_t *nsrec = nfcalloc( sizeof(*nsrec) ); + sync_rec_t *nsrec = nfzalloc( sizeof(*nsrec) ); nsrec->next = srec->next; srec->next = nsrec; if (svars->srecadd == &srec->next) @@ -870,7 +870,7 @@ load_state( sync_vars_t *svars ) error( "Error: invalid sync state entry at %s:%d\n", svars->dname, line ); goto jbail; } - srec = nfcalloc( sizeof(*srec) ); + srec = nfzalloc( sizeof(*srec) ); srec->uid[F] = t1; srec->uid[N] = t2; s = fbuf; @@ -991,7 +991,7 @@ load_state( sync_vars_t *svars ) svars->uidval[F] = t1; svars->uidval[N] = t2; } else if (c == '+') { - srec = nfcalloc( sizeof(*srec) ); + srec = nfzalloc( sizeof(*srec) ); srec->uid[F] = t1; srec->uid[N] = t2; debug( " new entry(%u,%u)\n", t1, t2 ); @@ -1105,7 +1105,7 @@ sync_boxes( store_t *ctx[], const char * const names[], int present[], channel_c sync_vars_t *svars; int t; - svars = nfcalloc( sizeof(*svars) ); + svars = nfzalloc( sizeof(*svars) ); svars->t[1] = 1; svars->ref_count = 1; svars->cb = cb; @@ -1504,7 +1504,7 @@ box_loaded( int sts, message_t *msgs, int total_msgs, int recent_msgs, void *aux debug( "matching messages on %s against sync records\n", str_fn[t] ); hashsz = bucketsForSize( svars->nsrecs * 3 ); - srecmap = nfcalloc( hashsz * sizeof(*srecmap) ); + srecmap = nfzalloc( hashsz * sizeof(*srecmap) ); for (srec = svars->srecs; srec; srec = srec->next) { if (srec->status & S_DEAD) continue; @@ -1787,7 +1787,7 @@ box_loaded( int sts, message_t *msgs, int total_msgs, int recent_msgs, void *aux continue; } - srec = nfcalloc( sizeof(*srec) ); + srec = nfzalloc( sizeof(*srec) ); *svars->srecadd = srec; svars->srecadd = &srec->next; svars->nsrecs++; diff --git a/src/util.c b/src/util.c index 01e9e80..9e3c846 100644 --- a/src/util.c +++ b/src/util.c @@ -405,7 +405,7 @@ nfmalloc( size_t sz ) } void * -nfcalloc( size_t sz ) +nfzalloc( size_t sz ) { void *ret;