[pulseaudio-discuss] [PATCH RFC 04/17] tagstruct: Add type _APPENDED

Alexander E. Patrakov patrakov at gmail.com
Mon Oct 27 02:03:25 PDT 2014


25.10.2014 03:21, Peter Meerwald wrote:
> @@ -94,7 +99,13 @@ static void extend(pa_tagstruct*t, size_t l) {
>       if (t->length+l <= t->allocated)
>           return;
>
> -    t->data = pa_xrealloc(t->data, t->allocated = t->length+l+100);
> +    if (t->type == PA_TAGSTRUCT_DYNAMIC)
> +        t->data = pa_xrealloc(t->data, t->allocated = t->length+l+100);
> +    else if (t->type == PA_TAGSTRUCT_APPENDED) {
> +        t->type = PA_TAGSTRUCT_DYNAMIC;
> +        t->data = pa_xmalloc(t->allocated = t->length+l+100);
> +        memcpy(t->data, t->per_type.appended, t->length);
> +    }
>   }
>
>   void pa_tagstruct_puts(pa_tagstruct*t, const char *s) {
>

While you are at it, could you please move the (pre-existing) magic 
number 100 into a #define?

-- 
Alexander E. Patrakov


More information about the pulseaudio-discuss mailing list