3 objstr_t *objstrCreate(unsigned int size)
5 objstr_t *tmp = calloc(1, (sizeof(objstr_t) + size));
8 tmp->top = tmp + 1; //points to end of objstr_t structure!
12 //free entire list, starting at store
13 void objstrDelete(objstr_t *store)
25 void *objstrAlloc(objstr_t *store, unsigned int size)
30 if (((unsigned int)store->top - (unsigned int)store - sizeof(objstr_t) + size) <= store->size)
37 if (store->next == NULL)
38 { //end of list, all full
39 if (size > DEFAULT_OBJ_STORE_SIZE) //in case of large objects
41 store->next = (objstr_t *)calloc(1,(sizeof(objstr_t) + size));
42 if (store->next == NULL)
49 store->next = calloc(1,(sizeof(objstr_t) + DEFAULT_OBJ_STORE_SIZE));
50 if (store->next == NULL)
54 store->size = DEFAULT_OBJ_STORE_SIZE;
56 store->top = (void *)((unsigned int)store + sizeof(objstr_t) + size);
57 return (void *)((unsigned int)store + sizeof(objstr_t));
59 else //try the next one