mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice-common
synced 2025-12-26 14:18:36 +00:00
marshallers: Avoid some useless pointers in SpiceMarshallerData
"buffers" and "marshallers" are always pointing to the static buffers inside the same structure. Use single array fields to avoid having initialize and have them. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Julien Rope <jrope@redhat.com>
This commit is contained in:
parent
87e2db9798
commit
48944f6f41
@ -116,16 +116,15 @@ struct SpiceMarshaller {
|
||||
struct SpiceMarshallerData {
|
||||
size_t total_size;
|
||||
size_t base;
|
||||
SpiceMarshaller *marshallers;
|
||||
SpiceMarshaller *last_marshaller;
|
||||
|
||||
size_t current_buffer_position;
|
||||
MarshallerBuffer *current_buffer;
|
||||
MarshallerItem *current_buffer_item;
|
||||
MarshallerBuffer *buffers;
|
||||
|
||||
SpiceMarshaller static_marshaller;
|
||||
MarshallerBuffer static_buffer;
|
||||
// first marshaller and buffer are statically allocated here
|
||||
SpiceMarshaller marshallers[1];
|
||||
MarshallerBuffer buffers[1];
|
||||
};
|
||||
|
||||
static void spice_marshaller_init(SpiceMarshaller *m,
|
||||
@ -149,16 +148,15 @@ SpiceMarshaller *spice_marshaller_new(void)
|
||||
|
||||
d = spice_new(SpiceMarshallerData, 1);
|
||||
|
||||
d->last_marshaller = d->marshallers = &d->static_marshaller;
|
||||
d->last_marshaller = d->marshallers;
|
||||
d->total_size = 0;
|
||||
d->base = 0;
|
||||
d->buffers = &d->static_buffer;
|
||||
d->buffers->next = NULL;
|
||||
d->current_buffer = d->buffers;
|
||||
d->current_buffer_position = 0;
|
||||
d->current_buffer_item = NULL;
|
||||
|
||||
m = &d->static_marshaller;
|
||||
m = d->marshallers;
|
||||
spice_marshaller_init(m, d);
|
||||
|
||||
return m;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user