[pulseaudio-discuss] [PATCH 1/3] memblockq: Use pa_xnew0() to avoid manual zeroing.
Tanu Kaskinen
tanuk at iki.fi
Sun Dec 16 02:11:28 PST 2012
On Sat, 2012-04-28 at 18:54 +0300, Tanu Kaskinen wrote:
> ---
> src/pulsecore/memblockq.c | 10 ++--------
> 1 file changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/src/pulsecore/memblockq.c b/src/pulsecore/memblockq.c
> index 18066f7..2b79455 100644
> --- a/src/pulsecore/memblockq.c
> +++ b/src/pulsecore/memblockq.c
> @@ -76,11 +76,8 @@ pa_memblockq* pa_memblockq_new(
> pa_assert(sample_spec);
> pa_assert(name);
>
> - bq = pa_xnew(pa_memblockq, 1);
> + bq = pa_xnew0(pa_memblockq, 1);
> bq->name = pa_xstrdup(name);
> - bq->blocks = bq->blocks_tail = NULL;
> - bq->current_read = bq->current_write = NULL;
> - bq->n_blocks = 0;
>
> bq->sample_spec = *sample_spec;
> bq->base = pa_frame_size(sample_spec);
> @@ -89,8 +86,6 @@ pa_memblockq* pa_memblockq_new(
> pa_log_debug("memblockq requested: maxlength=%lu, tlength=%lu, base=%lu, prebuf=%lu, minreq=%lu maxrewind=%lu",
> (unsigned long) maxlength, (unsigned long) tlength, (unsigned long) bq->base, (unsigned long) prebuf, (unsigned long) minreq, (unsigned long) maxrewind);
>
> - bq->missing = bq->requested = 0;
> - bq->maxlength = bq->tlength = bq->prebuf = bq->minreq = bq->maxrewind = 0;
> bq->in_prebuf = TRUE;
>
> pa_memblockq_set_maxlength(bq, maxlength);
> @@ -105,8 +100,7 @@ pa_memblockq* pa_memblockq_new(
> if (silence) {
> bq->silence = *silence;
> pa_memblock_ref(bq->silence.memblock);
> - } else
> - pa_memchunk_reset(&bq->silence);
> + }
>
> bq->mcalign = pa_mcalign_new(bq->base);
>
This is now applied.
--
Tanu
More information about the pulseaudio-discuss
mailing list