From 26a032fffa6c6e6f092ed3d14c2b5f08e5c736d6 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Tue, 9 Nov 2021 18:41:17 +0100 Subject: [PATCH] string: Rename para_calloc() -> zalloc(). Reword the documentation a bit since the function has never been a wrapper for calloc(3). No code changes. --- aacdec_filter.c | 2 +- afh_recv.c | 2 +- alsa_mix.c | 2 +- alsa_write.c | 2 +- amp_filter.c | 2 +- audiod.c | 6 +++--- audiod_command.c | 2 +- buffer_tree.c | 8 ++++---- check_wav.c | 2 +- client_common.c | 2 +- compress_filter.c | 2 +- dccp_send.c | 2 +- fec.c | 2 +- fecdec_filter.c | 4 ++-- file_write.c | 2 +- filter.c | 2 +- flac_afh.c | 2 +- flacdec_filter.c | 2 +- grab_client.c | 2 +- http_recv.c | 2 +- imdct.c | 2 +- mood.c | 2 +- mp.c | 2 +- mp3dec_filter.c | 2 +- ogg_afh_common.c | 2 +- oggdec_filter.c | 2 +- opusdec_filter.c | 2 +- oss_write.c | 2 +- play.c | 2 +- prebuffer_filter.c | 2 +- resample_filter.c | 2 +- ringbuffer.c | 4 ++-- send_common.c | 2 +- sideband.c | 4 ++-- signal.c | 2 +- spxdec_filter.c | 2 +- string.c | 8 +++----- string.h | 2 +- sync_filter.c | 2 +- udp_send.c | 4 ++-- vss.c | 2 +- wma_afh.c | 2 +- wmadec_filter.c | 2 +- write.c | 2 +- 44 files changed, 55 insertions(+), 57 deletions(-) diff --git a/aacdec_filter.c b/aacdec_filter.c index 694e399a..64baa48c 100644 --- a/aacdec_filter.c +++ b/aacdec_filter.c @@ -52,7 +52,7 @@ static int aacdec_execute(struct btr_node *btrn, const char *cmd, char **result) static void aacdec_open(struct filter_node *fn) { NeAACDecConfigurationPtr c; - struct private_aacdec_data *padd = para_calloc(sizeof(*padd)); + struct private_aacdec_data *padd = zalloc(sizeof(*padd)); padd->handle = NeAACDecOpen(); c = NeAACDecGetCurrentConfiguration(padd->handle); diff --git a/afh_recv.c b/afh_recv.c index e7f85a1b..e9d24e41 100644 --- a/afh_recv.c +++ b/afh_recv.c @@ -75,7 +75,7 @@ static int afh_recv_open(struct receiver_node *rn) if (!fn || *fn == '\0') return -E_AFH_RECV_BAD_FILENAME; - rn->private_data = pard = para_calloc(sizeof(*pard)); + rn->private_data = pard = zalloc(sizeof(*pard)); afhi = &pard->afhi; ret = mmap_full_file(fn, O_RDONLY, &pard->map, &pard->map_size, &pard->fd); diff --git a/alsa_mix.c b/alsa_mix.c index 1d81e5d9..af4adc46 100644 --- a/alsa_mix.c +++ b/alsa_mix.c @@ -52,7 +52,7 @@ static int alsa_mix_open(const char *dev, struct mixer_handle **handle) PARA_INFO_LOG("snd_mixer_{open,attach,register,load}\n"); *handle = NULL; - h = para_calloc(sizeof(*h)); + h = zalloc(sizeof(*h)); h->card = para_strdup(dev? dev : "hw:0"); ret = snd_mixer_open(&h->mixer, 0); if (ret < 0) { diff --git a/alsa_write.c b/alsa_write.c index bbbf8b65..1dee5ac8 100644 --- a/alsa_write.c +++ b/alsa_write.c @@ -296,7 +296,7 @@ again: if (bytes == 0) /* no data available */ return 0; - pad = wn->private_data = para_calloc(sizeof(*pad)); + pad = wn->private_data = zalloc(sizeof(*pad)); ret = get_btr_sample_rate(btrn, &val); if (ret < 0) goto err; diff --git a/amp_filter.c b/amp_filter.c index 54ff0ade..3f0aa11e 100644 --- a/amp_filter.c +++ b/amp_filter.c @@ -29,7 +29,7 @@ static void amp_close(struct filter_node *fn) static void amp_open(struct filter_node *fn) { - struct private_amp_data *pad = para_calloc(sizeof(*pad)); + struct private_amp_data *pad = zalloc(sizeof(*pad)); unsigned given = FILTER_CMD_OPT_GIVEN(AMP, AMP, fn->lpr); uint32_t amp_arg = FILTER_CMD_OPT_UINT32_VAL(AMP, AMP, fn->lpr); diff --git a/audiod.c b/audiod.c index 305fcf3f..2a59d56a 100644 --- a/audiod.c +++ b/audiod.c @@ -564,7 +564,7 @@ static void open_filters(struct slot_info *s) return; PARA_INFO_LOG("opening %s filters\n", audio_formats[s->format]); assert(s->fns == NULL); - s->fns = para_calloc(nf * sizeof(struct filter_node)); + s->fns = zalloc(nf * sizeof(struct filter_node)); parent = s->receiver_node->btrn; for (i = 0; i < nf; i++) { char buf[20]; @@ -602,7 +602,7 @@ static void open_writers(struct slot_info *s) struct btr_node *parent = s->fns[a->num_filters - 1].btrn; assert(s->wns == NULL); - s->wns = para_calloc(PARA_MAX(1U, a->num_writers) + s->wns = zalloc(PARA_MAX(1U, a->num_writers) * sizeof(struct writer_node)); for (i = 0; i < a->num_writers; i++) { wn = s->wns + i; @@ -629,7 +629,7 @@ static int open_receiver(int format) if (ret < 0) return ret; slot_num = ret; - rn = para_calloc(sizeof(*rn)); + rn = zalloc(sizeof(*rn)); rn->receiver = r; rn->lpr = a->receiver_lpr; rn->btrn = btr_new_node(&(struct btr_node_description) diff --git a/audiod_command.c b/audiod_command.c index bb54dfab..89fdc1ac 100644 --- a/audiod_command.c +++ b/audiod_command.c @@ -114,7 +114,7 @@ static int stat_client_add(int fd, uint64_t mask, int parser_friendly) ret = dup(fd); if (ret < 0) return -ERRNO_TO_PARA_ERROR(errno); - new_client = para_calloc(sizeof(*new_client)); + new_client = zalloc(sizeof(*new_client)); new_client->fd = ret; PARA_INFO_LOG("adding client on fd %d\n", new_client->fd); new_client->item_mask = mask; diff --git a/buffer_tree.c b/buffer_tree.c index b80e707a..4c17e824 100644 --- a/buffer_tree.c +++ b/buffer_tree.c @@ -307,7 +307,7 @@ out: */ static struct btr_buffer *new_btrb(char *buf, size_t size) { - struct btr_buffer *btrb = para_calloc(sizeof(*btrb)); + struct btr_buffer *btrb = zalloc(sizeof(*btrb)); btrb->buf = buf; btrb->size = size; @@ -354,7 +354,7 @@ static void add_btrb_to_children(struct btr_buffer *btrb, if (btrn->start.tv_sec == 0) btrn->start = *now; FOR_EACH_CHILD(ch, btrn) { - struct btr_buffer_reference *br = para_calloc(sizeof(*br)); + struct btr_buffer_reference *br = zalloc(sizeof(*br)); br->btrb = btrb; br->consumed = consumed; list_add_tail(&br->node, &ch->input_queue); @@ -1012,7 +1012,7 @@ next: buf1, sz1, buf2, sz2, buf, sz); memcpy(buf, buf1, sz1); memcpy(buf + sz1, buf2, sz2); - br = para_calloc(sizeof(*br)); + br = zalloc(sizeof(*br)); br->btrb = new_btrb(buf, sz); br->btrb->refcount = 1; br->consumed = 0; @@ -1073,7 +1073,7 @@ static int merge_input(struct btr_node *btrn) memcpy(buf, bufs[0], szs[0]); memcpy(buf + szs[0], bufs[1], szs[1]); - br = para_calloc(sizeof(*br)); + br = zalloc(sizeof(*br)); br->btrb = new_btrb(buf, sz); br->btrb->refcount = 1; diff --git a/check_wav.c b/check_wav.c index 89ebdacc..c24a402e 100644 --- a/check_wav.c +++ b/check_wav.c @@ -207,7 +207,7 @@ struct check_wav_context *check_wav_init(struct btr_node *parent, struct btr_node *child, struct wav_params *params, struct btr_node **cw_btrn) { - struct check_wav_context *cwc = para_calloc(sizeof(*cwc)); + struct check_wav_context *cwc = zalloc(sizeof(*cwc)); cwc->state = CWS_NEED_HEADER; cwc->min_iqs = WAV_HEADER_LEN; diff --git a/client_common.c b/client_common.c index 68c3747b..a4f48a27 100644 --- a/client_common.c +++ b/client_common.c @@ -584,7 +584,7 @@ int client_parse_config(int argc, char *argv[], struct client_task **ct_ptr, PARA_INFO_LOG("user: %s\n", user); PARA_INFO_LOG("key file: %s\n", kf); PARA_INFO_LOG("loglevel: %d\n", ll); - ct = para_calloc(sizeof(*ct)); + ct = zalloc(sizeof(*ct)); ct->scc.fd = -1; ct->lpr = lpr; ct->key_file = kf; diff --git a/compress_filter.c b/compress_filter.c index 7bd30271..dd892ca2 100644 --- a/compress_filter.c +++ b/compress_filter.c @@ -116,7 +116,7 @@ err: static void compress_open(struct filter_node *fn) { - struct private_compress_data *pcd = para_calloc(sizeof(*pcd)); + struct private_compress_data *pcd = zalloc(sizeof(*pcd)); uint32_t inertia = U32_OPTVAL(INERTIA, fn->lpr); uint32_t aggressiveness = U32_OPTVAL(AGGRESSIVENESS, fn->lpr); diff --git a/dccp_send.c b/dccp_send.c index bca7ad67..47517707 100644 --- a/dccp_send.c +++ b/dccp_send.c @@ -148,7 +148,7 @@ static void dccp_post_select(fd_set *rfds, __a_unused fd_set *wfds) shutdown_client(sc, dss); return; } - dfc = para_calloc(sizeof(*dfc)); + dfc = zalloc(sizeof(*dfc)); sc->private_data = dfc; k = OPT_UINT32_VAL(DCCP_DATA_SLICES_PER_GROUP); n = OPT_UINT32_VAL(DCCP_SLICES_PER_GROUP); diff --git a/fec.c b/fec.c index 056b923e..ce2bc4fd 100644 --- a/fec.c +++ b/fec.c @@ -610,7 +610,7 @@ int fec_decode(struct fec_parms *parms, unsigned char **data, int *idx, slice = alloc(k * sizeof(unsigned char *)); for (row = 0; row < k; row++) { if (idx[row] >= k) { - slice[row] = para_calloc(sz); + slice[row] = zalloc(sz); for (col = 0; col < k; col++) addmul(slice[row], data[col], m_dec[row * k + col], sz); diff --git a/fecdec_filter.c b/fecdec_filter.c index d7162adc..8efb2af7 100644 --- a/fecdec_filter.c +++ b/fecdec_filter.c @@ -226,7 +226,7 @@ static int add_slice(char *buf, struct fecdec_group *fg) if (fg->num_slices == 0) { fg->num_slices = fg->h.slices_per_group; fg->idx = alloc(fg->num_slices * sizeof(int)); - fg->data = para_calloc(fg->num_slices * sizeof(unsigned char *)); + fg->data = zalloc(fg->num_slices * sizeof(unsigned char *)); } r = fg->num_received_slices; /* Check if we already have this slice. */ @@ -471,7 +471,7 @@ out: static void fecdec_open(struct filter_node *fn) { struct private_fecdec_data *pfd; - pfd = para_calloc(sizeof(*pfd)); + pfd = zalloc(sizeof(*pfd)); fn->private_data = pfd; fn->min_iqs = FEC_HEADER_SIZE; } diff --git a/file_write.c b/file_write.c index 9a5ed5d7..eb615153 100644 --- a/file_write.c +++ b/file_write.c @@ -64,7 +64,7 @@ static int prepare_output_file(struct writer_node *wn) close(fd); return ret; } - pfwd = wn->private_data = para_calloc(sizeof(*pfwd)); + pfwd = wn->private_data = zalloc(sizeof(*pfwd)); pfwd->fd = fd; return 1; } diff --git a/filter.c b/filter.c index 05d1d4d3..04640692 100644 --- a/filter.c +++ b/filter.c @@ -127,7 +127,7 @@ int main(int argc, char *argv[]) struct filter_node *fn; struct task_info ti; - fn = fns[i] = para_calloc(sizeof(*fn)); + fn = fns[i] = zalloc(sizeof(*fn)); fn->filter_num = filter_setup(fa, &fn->conf, &filter_lpr); name = filter_name(fn->filter_num); fn->lpr = filter_lpr; diff --git a/flac_afh.c b/flac_afh.c index 6e236839..730f954b 100644 --- a/flac_afh.c +++ b/flac_afh.c @@ -481,7 +481,7 @@ static int flac_rewrite_tags(const char *map, size_t map_bytes, FLAC__Metadata_Iterator *iter; FLAC__StreamMetadata *b = NULL; FLAC__bool ok; - struct private_flac_afh_data *pfad = para_calloc(sizeof(*pfad)); + struct private_flac_afh_data *pfad = zalloc(sizeof(*pfad)); pfad->map = map; pfad->map_bytes = map_bytes; diff --git a/flacdec_filter.c b/flacdec_filter.c index f859c840..d3a481cf 100644 --- a/flacdec_filter.c +++ b/flacdec_filter.c @@ -286,7 +286,7 @@ static void flacdec_close(struct filter_node *fn) static void flacdec_open(struct filter_node *fn) { - struct private_flacdec_data *pfd = para_calloc(sizeof(*pfd)); + struct private_flacdec_data *pfd = zalloc(sizeof(*pfd)); fn->private_data = pfd; fn->min_iqs = 0; } diff --git a/grab_client.c b/grab_client.c index 83706493..8191e114 100644 --- a/grab_client.c +++ b/grab_client.c @@ -261,7 +261,7 @@ static int gc_check_args(struct lls_parse_result *lpr, struct grab_client *gc) int grab_client_new(int fd, struct lls_parse_result *lpr, struct sched *s) { int ret; - struct grab_client *gc = para_calloc(sizeof(struct grab_client)); + struct grab_client *gc = zalloc(sizeof(struct grab_client)); ret = gc_check_args(lpr, gc); if (ret < 0) diff --git a/http_recv.c b/http_recv.c index 1fb60bad..8f9f1af1 100644 --- a/http_recv.c +++ b/http_recv.c @@ -160,7 +160,7 @@ static int http_recv_open(struct receiver_node *rn) close(fd); return ret; } - rn->private_data = phd = para_calloc(sizeof(struct private_http_recv_data)); + rn->private_data = phd = zalloc(sizeof(struct private_http_recv_data)); rn->fd = fd; phd->status = HTTP_CONNECTED; rn->btrp = btr_pool_new("http_recv", 320 * 1024); diff --git a/imdct.c b/imdct.c index 518d4782..d49ae852 100644 --- a/imdct.c +++ b/imdct.c @@ -366,7 +366,7 @@ int imdct_init(int nbits, struct mdct_context **result) double alpha; struct mdct_context *s; - s = para_calloc(sizeof(*s)); + s = zalloc(sizeof(*s)); n = 1 << nbits; s->nbits = nbits; s->n = n; diff --git a/mood.c b/mood.c index b3f007b6..161d8df0 100644 --- a/mood.c +++ b/mood.c @@ -138,7 +138,7 @@ static void destroy_mood(struct mood *m) static struct mood *alloc_new_mood(const char *name) { - struct mood *m = para_calloc(sizeof(struct mood)); + struct mood *m = zalloc(sizeof(struct mood)); if (name) m->name = para_strdup(name); return m; diff --git a/mp.c b/mp.c index f85ded85..fb5a0c07 100644 --- a/mp.c +++ b/mp.c @@ -518,7 +518,7 @@ int mp_init(const char *definition, int nbytes, struct mp_context **result, *errmsg = NULL; return 0; } - ctx = para_calloc(sizeof(*ctx)); + ctx = zalloc(sizeof(*ctx)); ctx->errmsg = NULL; ctx->ast = NULL; diff --git a/mp3dec_filter.c b/mp3dec_filter.c index 69112c76..9403a71d 100644 --- a/mp3dec_filter.c +++ b/mp3dec_filter.c @@ -166,7 +166,7 @@ err: static void mp3dec_open(struct filter_node *fn) { - struct private_mp3dec_data *pmd = para_calloc(sizeof(*pmd)); + struct private_mp3dec_data *pmd = zalloc(sizeof(*pmd)); fn->private_data = pmd; mad_stream_init(&pmd->stream); diff --git a/ogg_afh_common.c b/ogg_afh_common.c index 155a1899..3909a291 100644 --- a/ogg_afh_common.c +++ b/ogg_afh_common.c @@ -367,7 +367,7 @@ struct oac_custom_header { */ struct oac_custom_header *oac_custom_header_new(void) { - return para_calloc(sizeof(struct oac_custom_header)); + return zalloc(sizeof(struct oac_custom_header)); } /** diff --git a/oggdec_filter.c b/oggdec_filter.c index 143648c8..b05691c3 100644 --- a/oggdec_filter.c +++ b/oggdec_filter.c @@ -88,7 +88,7 @@ static const ov_callbacks ovc = { static void ogg_open(struct filter_node *fn) { - fn->private_data = para_calloc(sizeof(struct private_oggdec_data)); + fn->private_data = zalloc(sizeof(struct private_oggdec_data)); fn->min_iqs = 8000; } diff --git a/opusdec_filter.c b/opusdec_filter.c index 7878b422..942cce37 100644 --- a/opusdec_filter.c +++ b/opusdec_filter.c @@ -86,7 +86,7 @@ static int opusdec_execute(struct btr_node *btrn, const char *cmd, static void opusdec_open(struct filter_node *fn) { - struct opusdec_context *ctx = para_calloc(sizeof(*ctx)); + struct opusdec_context *ctx = zalloc(sizeof(*ctx)); ogg_sync_init(&ctx->oy); fn->private_data = ctx; diff --git a/oss_write.c b/oss_write.c index 0565167c..2afad677 100644 --- a/oss_write.c +++ b/oss_write.c @@ -101,7 +101,7 @@ static int oss_init(struct writer_node *wn, unsigned sample_rate, { int ret, format; unsigned ch, rate; - struct private_oss_write_data *powd = para_calloc(sizeof(*powd)); + struct private_oss_write_data *powd = zalloc(sizeof(*powd)); const char *dev = WRITE_CMD_OPT_STRING_VAL(OSS, DEVICE, wn->lpr); PARA_INFO_LOG("opening %s\n", dev); diff --git a/play.c b/play.c index 7c411850..d46c16cd 100644 --- a/play.c +++ b/play.c @@ -1259,7 +1259,7 @@ int main(int argc, char *argv[]) session_open(); num_inputs = lls_num_inputs(play_lpr); init_shuffle_map(); - pt->invalid = para_calloc(sizeof(*pt->invalid) * num_inputs); + pt->invalid = zalloc(sizeof(*pt->invalid) * num_inputs); pt->rq = CRT_FILE_CHANGE; pt->playing = true; pt->task = task_register(&(struct task_info){ diff --git a/prebuffer_filter.c b/prebuffer_filter.c index 9a801900..ef66ffa1 100644 --- a/prebuffer_filter.c +++ b/prebuffer_filter.c @@ -80,7 +80,7 @@ fail: static void prebuffer_open(struct filter_node *fn) { - struct private_prebuffer_data *ppd = para_calloc(sizeof(*ppd)); + struct private_prebuffer_data *ppd = zalloc(sizeof(*ppd)); fn->private_data = ppd; } diff --git a/resample_filter.c b/resample_filter.c index acbf1b41..6540c3e9 100644 --- a/resample_filter.c +++ b/resample_filter.c @@ -51,7 +51,7 @@ static void resample_close(struct filter_node *fn) static void resample_open(struct filter_node *fn) { - struct resample_context *ctx = para_calloc(sizeof(*ctx)); + struct resample_context *ctx = zalloc(sizeof(*ctx)); struct btr_node *btrn = fn->btrn; struct wav_params wp; diff --git a/ringbuffer.c b/ringbuffer.c index 76e2d7af..0e706f0f 100644 --- a/ringbuffer.c +++ b/ringbuffer.c @@ -41,8 +41,8 @@ struct ringbuffer */ struct ringbuffer *ringbuffer_new(unsigned size) { - struct ringbuffer *rb = para_calloc(sizeof(struct ringbuffer)); - rb->entries = para_calloc(size * sizeof(void *)); + struct ringbuffer *rb = zalloc(sizeof(struct ringbuffer)); + rb->entries = zalloc(size * sizeof(void *)); rb->size = size; return rb; } diff --git a/send_common.c b/send_common.c index 4574c697..492f275d 100644 --- a/send_common.c +++ b/send_common.c @@ -391,7 +391,7 @@ struct sender_client *accept_sender_client(struct sender_status *ss, fd_set *rfd if (ret < 0) goto close_fd_and_warn; ss->num_clients++; - sc = para_calloc(sizeof(*sc)); + sc = zalloc(sizeof(*sc)); sc->fd = fd; sc->name = para_strdup(remote_name(fd)); sc->cq = cq_new(MAX_CQ_BYTES); diff --git a/sideband.c b/sideband.c index cd549ddc..d4876234 100644 --- a/sideband.c +++ b/sideband.c @@ -37,7 +37,7 @@ struct sb_context { struct sb_context *sb_new_recv(size_t max_size, sb_transformation t, void *trafo_context) { - struct sb_context *c = para_calloc(sizeof(*c)); + struct sb_context *c = zalloc(sizeof(*c)); c->max_size = max_size; c->trafo = t; @@ -62,7 +62,7 @@ struct sb_context *sb_new_recv(size_t max_size, sb_transformation t, struct sb_context *sb_new_send(struct sb_buffer *sbb, bool dont_free, sb_transformation t, void *trafo_context) { - struct sb_context *c = para_calloc(sizeof(*c)); + struct sb_context *c = zalloc(sizeof(*c)); struct iovec src, dst, *srcp, *dstp; assert(sbb); diff --git a/signal.c b/signal.c index 32d6ab66..4e876cfe 100644 --- a/signal.c +++ b/signal.c @@ -48,7 +48,7 @@ struct signal_task *signal_init_or_die(void) ret = mark_fd_nonblocking(signal_pipe[1]); if (ret < 0) goto err_out; - st = para_calloc(sizeof(*st)); + st = zalloc(sizeof(*st)); st->fd = signal_pipe[0]; return st; err_out: diff --git a/spxdec_filter.c b/spxdec_filter.c index 1a4fe9a7..18b50267 100644 --- a/spxdec_filter.c +++ b/spxdec_filter.c @@ -81,7 +81,7 @@ struct private_spxdec_data { static void spxdec_open(struct filter_node *fn) { - struct private_spxdec_data *psd = para_calloc(sizeof(*psd)); + struct private_spxdec_data *psd = zalloc(sizeof(*psd)); fn->private_data = psd; fn->min_iqs = 200; diff --git a/string.c b/string.c index b75d0af3..bbc322eb 100644 --- a/string.c +++ b/string.c @@ -70,18 +70,16 @@ __must_check __malloc void *alloc(size_t size) } /** - * Paraslash's version of calloc(). + * Allocate and initialize memory. * * \param size The desired new size. * - * A wrapper for calloc(3) which exits on errors. - * * \return A pointer to the allocated and zeroed-out memory, which is suitably * aligned for any kind of variable. * - * \sa calloc(3) + * \sa \ref alloc(), calloc(3). */ -__must_check __malloc void *para_calloc(size_t size) +__must_check __malloc void *zalloc(size_t size) { void *ret = alloc(size); diff --git a/string.h b/string.h index 02e31577..29dc388f 100644 --- a/string.h +++ b/string.h @@ -69,7 +69,7 @@ int for_each_line(unsigned flags, char *buf, size_t size, __must_check void *para_realloc(void *p, size_t size); __must_check __malloc void *alloc(size_t size); -__must_check __malloc void *para_calloc(size_t size); +__must_check __malloc void *zalloc(size_t size); __must_check __malloc char *para_strdup(const char *s); __printf_2_0 unsigned xvasprintf(char **result, const char *fmt, va_list ap); diff --git a/sync_filter.c b/sync_filter.c index 6fdf8e46..9c1767e4 100644 --- a/sync_filter.c +++ b/sync_filter.c @@ -102,7 +102,7 @@ static void sync_open(struct filter_node *fn) unsigned buddy_given; const struct lls_opt_result *r_b; - ctx = fn->private_data = para_calloc(sizeof(*ctx)); + ctx = fn->private_data = zalloc(sizeof(*ctx)); init_list_head(&ctx->buddies); /* create socket to listen for incoming packets */ diff --git a/udp_send.c b/udp_send.c index 68d75e3c..baeec439 100644 --- a/udp_send.c +++ b/udp_send.c @@ -326,8 +326,8 @@ static int udp_com_add(struct sender_command_data *scd) sc->name); return -E_TARGET_EXISTS; } - ut = para_calloc(sizeof(*ut)); - sc = para_calloc(sizeof(*sc)); + ut = zalloc(sizeof(*ut)); + sc = zalloc(sizeof(*sc)); ut->fcp.slices_per_group = scd->slices_per_group; ut->fcp.data_slices_per_group = scd->data_slices_per_group; ut->fcp.init_fec = udp_init_fec; diff --git a/vss.c b/vss.c index 00dff8a8..c6c57845 100644 --- a/vss.c +++ b/vss.c @@ -671,7 +671,7 @@ size_t vss_get_fec_eof_packet(const char **buf) struct fec_client *vss_add_fec_client(struct sender_client *sc, struct fec_client_parms *fcp) { - struct fec_client *fc = para_calloc(sizeof(*fc)); + struct fec_client *fc = zalloc(sizeof(*fc)); fc->sc = sc; fc->fcp = fcp; diff --git a/wma_afh.c b/wma_afh.c index f2afae3b..a6fbecca 100644 --- a/wma_afh.c +++ b/wma_afh.c @@ -318,7 +318,7 @@ static int convert_utf8_to_utf16(char *src, char **dst) int ret; if (!src || !*src) { - *dst = para_calloc(2); + *dst = zalloc(2); return 0; } /* diff --git a/wmadec_filter.c b/wmadec_filter.c index 88f69896..1f308785 100644 --- a/wmadec_filter.c +++ b/wmadec_filter.c @@ -428,7 +428,7 @@ static int wma_decode_init(char *initial_buf, int len, struct private_wmadec_dat int ret, i; PARA_NOTICE_LOG("initial buf: %d bytes\n", len); - pwd = para_calloc(sizeof(*pwd)); + pwd = zalloc(sizeof(*pwd)); ret = read_asf_header(initial_buf, len, &pwd->ahi); if (ret <= 0) { free(pwd); diff --git a/write.c b/write.c index acfb9460..9e0f22bd 100644 --- a/write.c +++ b/write.c @@ -89,7 +89,7 @@ static int setup_and_schedule(struct lls_parse_result *lpr) }, &s); n = writer_given? writer_given : 1; - wns = para_calloc(n * sizeof(*wns)); + wns = zalloc(n * sizeof(*wns)); for (i = 0; i < n; i++) { const char *arg = i < writer_given? lls_string_val(i, OPT_RESULT(WRITER, lpr)) : NULL; -- 2.39.2