Compare commits
1 Commits
8b9b012bcc
...
3b813da1cf
| Author | SHA1 | Date | |
|---|---|---|---|
| 3b813da1cf |
@@ -4,6 +4,7 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
//buckets of fun
|
//buckets of fun
|
||||||
Toy_Bucket* Toy_allocateBucket(unsigned int capacity) {
|
Toy_Bucket* Toy_allocateBucket(unsigned int capacity) {
|
||||||
@@ -16,6 +17,8 @@ Toy_Bucket* Toy_allocateBucket(unsigned int capacity) {
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
memset(bucket, 0, sizeof(Toy_Bucket) + capacity); //zero the memory, to avoid broken header metadata
|
||||||
|
|
||||||
//initialize the bucket
|
//initialize the bucket
|
||||||
bucket->next = NULL;
|
bucket->next = NULL;
|
||||||
bucket->capacity = capacity;
|
bucket->capacity = capacity;
|
||||||
|
|||||||
Reference in New Issue
Block a user