pod: don't call deref in reserve bytes

We already know that we could succesfully allocate enough space for the
bytes because we checked that before so simply move to the body of the
new bytes pod. We don't need to do the extensive checks we do in deref.
This commit is contained in:
Wim Taymans 2025-07-24 18:35:21 +02:00
parent 0c33101a42
commit 0f6b365138

View file

@ -347,7 +347,7 @@ spa_pod_builder_reserve_bytes(struct spa_pod_builder *builder, uint32_t len)
uint32_t offset = builder->state.offset;
if (spa_pod_builder_bytes(builder, NULL, len) < 0)
return NULL;
return SPA_POD_BODY(spa_pod_builder_deref(builder, offset));
return SPA_PTROFF(builder->data, offset + sizeof(struct spa_pod), void);
}
#define SPA_POD_INIT_Pointer(type,value) ((struct spa_pod_pointer){ { sizeof(struct spa_pod_pointer_body), SPA_TYPE_Pointer }, { (type), 0, (value) } })