diff options
author | Jason Ekstrand <[email protected]> | 2017-10-11 09:44:33 -0700 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2017-10-12 21:47:06 -0700 |
commit | 49bb9f785af8349f3245bc223cb7e0e40b9fa243 (patch) | |
tree | c4d2ef614b9de4a62d480d0493a1cd857e15ff4e /src/compiler/blob.c | |
parent | 0e3bd56c6ea783dbc93fce71cec98ab859782a81 (diff) |
compiler/blob: Switch to init/finish instead of create/destroy
There's no reason why that tiny bit of memory needs to be on the heap.
We always put blob_reader on the stack, so why not do the same with the
writable blob.
Reviewed-by: Nicolai Hähnle <[email protected]>
Reviewed-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src/compiler/blob.c')
-rw-r--r-- | src/compiler/blob.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/src/compiler/blob.c b/src/compiler/blob.c index 65e1376e160..2e20a11dc0c 100644 --- a/src/compiler/blob.c +++ b/src/compiler/blob.c @@ -99,19 +99,13 @@ align_blob_reader(struct blob_reader *blob, size_t alignment) blob->current = blob->data + ALIGN(blob->current - blob->data, alignment); } -struct blob * -blob_create() +void +blob_init(struct blob *blob) { - struct blob *blob = (struct blob *) malloc(sizeof(struct blob)); - if (blob == NULL) - return NULL; - blob->data = NULL; blob->allocated = 0; blob->size = 0; blob->out_of_memory = false; - - return blob; } bool |