2 extern objstr_t *prefetchcache;
4 objstr_t *objstrCreate(unsigned int size) {
6 if((tmp = calloc(1, (sizeof(objstr_t) + size))) == NULL) {
7 printf("%s() Calloc error at line %d, %s\n", __func__, __LINE__, __FILE__);
12 tmp->top = tmp + 1; //points to end of objstr_t structure!
16 //free entire list, starting at store
17 void objstrDelete(objstr_t *store)
29 void *objstrAlloc(objstr_t *store, unsigned int size)
34 if (((unsigned int)store->top - (unsigned int)store - sizeof(objstr_t) + size) <= store->size)
41 if (store->next == NULL)
42 { //end of list, all full
43 if (size > DEFAULT_OBJ_STORE_SIZE) //in case of large objects
45 if((store->next = (objstr_t *)calloc(1,(sizeof(objstr_t) + size))) == NULL) {
46 printf("%s() Calloc error at line %d, %s\n", __func__, __LINE__, __FILE__);
49 if (store->next == NULL)
56 if((store->next = calloc(1,(sizeof(objstr_t) + DEFAULT_OBJ_STORE_SIZE))) == NULL) {
57 printf("%s() Calloc error at line %d, %s\n", __func__, __LINE__, __FILE__);
60 if (store->next == NULL)
64 store->size = DEFAULT_OBJ_STORE_SIZE;
66 store->top = (void *)((unsigned int)store + sizeof(objstr_t) + size);
67 return (void *)((unsigned int)store + sizeof(objstr_t));
69 else //try the next one