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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux