3 objstr_t *objstrCreate(unsigned int size) {
4 objstr_t *tmp = calloc(1, (sizeof(objstr_t) + size));
7 tmp->top = tmp + 1; //points to end of objstr_t structure!
11 //free entire list, starting at store
12 void objstrDelete(objstr_t *store)
24 void *objstrAlloc(objstr_t *store, unsigned int size)
29 if (((unsigned int)store->top - (unsigned int)store - sizeof(objstr_t) + size) <= store->size)
36 if (store->next == NULL)
37 { //end of list, all full
38 if (size > DEFAULT_OBJ_STORE_SIZE) //in case of large objects
40 store->next = (objstr_t *)calloc(1,(sizeof(objstr_t) + size));
41 if (store->next == NULL)
48 store->next = calloc(1,(sizeof(objstr_t) + DEFAULT_OBJ_STORE_SIZE));
49 if (store->next == NULL)
53 store->size = DEFAULT_OBJ_STORE_SIZE;
55 store->top = (void *)((unsigned int)store + sizeof(objstr_t) + size);
56 return (void *)((unsigned int)store + sizeof(objstr_t));
58 else //try the next one