tagstruct: Distinguish pa_tagstruct_new() use cases

pa_tagstruct_new() is called either with no data, i.e. (NULL, 0)
to create a dynamic tagstruct or with a pointer to fixed data

introduce a new function pa_tagstruct_new_fixed() for the latter case

Signed-off-by: Peter Meerwald <pmeerw@pmeerw.net>
This commit is contained in:
Peter Meerwald 2014-10-23 16:09:45 +02:00 committed by Peter Meerwald
parent 7c223a6565
commit 037fdf485f
11 changed files with 70 additions and 57 deletions

View file

@ -195,7 +195,7 @@ static bool entry_write(struct userdata *u, const char *name, const struct entry
pa_assert(name);
pa_assert(e);
t = pa_tagstruct_new(NULL, 0);
t = pa_tagstruct_new();
pa_tagstruct_putu8(t, e->version);
pa_tagstruct_puts(t, e->profile);
pa_tagstruct_putu32(t, pa_hashmap_size(e->ports));
@ -273,7 +273,7 @@ static struct entry* entry_read(struct userdata *u, const char *name) {
return NULL;
}
t = pa_tagstruct_new(data.data, data.size);
t = pa_tagstruct_new_fixed(data.data, data.size);
e = entry_new();
if (pa_tagstruct_getu8(t, &e->version) < 0 ||