mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 06:58:05 +02:00
util: add blob_finish_get_buffer
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
This commit is contained in:
parent
b1f38aed84
commit
ad56022b0d
2 changed files with 14 additions and 0 deletions
|
|
@ -125,6 +125,17 @@ blob_init_fixed(struct blob *blob, void *data, size_t size)
|
|||
blob->out_of_memory = false;
|
||||
}
|
||||
|
||||
void
|
||||
blob_finish_get_buffer(struct blob *blob, void **buffer, size_t *size)
|
||||
{
|
||||
*buffer = blob->data;
|
||||
*size = blob->size;
|
||||
blob->data = NULL;
|
||||
|
||||
/* Trim the buffer. */
|
||||
*buffer = realloc(*buffer, *size);
|
||||
}
|
||||
|
||||
bool
|
||||
blob_overwrite_bytes(struct blob *blob,
|
||||
size_t offset,
|
||||
|
|
|
|||
|
|
@ -117,6 +117,9 @@ blob_finish(struct blob *blob)
|
|||
free(blob->data);
|
||||
}
|
||||
|
||||
void
|
||||
blob_finish_get_buffer(struct blob *blob, void **buffer, size_t *size);
|
||||
|
||||
/**
|
||||
* Add some unstructured, fixed-size data to a blob.
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue