示例#1
0
文件: Error.c 项目: DarkLotus/uoai
void PushErrorHandler(ErrorHandler handler)
{
	if(!ErrorHandlerStack)
		ErrorHandlerStack=LL_create();

	LL_push(ErrorHandlerStack,(void *)handler);

	return;
}
示例#2
0
文件: cache.c 项目: akosik/cachetests
//Create a new cache object with the given capacity
cache_t create_cache(uint64_t maxmem, uint8_t* hash, uint8_t* add, uint8_t* remove)
{
  cache_t cache = malloc(sizeof(cache_obj));
  cache->cache = malloc(sizeof(cache_real_obj));
  cache_real_obj *ret = cache->cache;
  ret->hasher = &hash;
  ret->size = maxmem;
  ret->num_buckets = 512;
  ret->buckets = calloc(512,sizeof(linked_list_t));
  int i=0;
  for (i; i < 512; i++) ret->buckets[i] = LL_create();
  cache->cache->slab_manager = initialize(maxmem);
  printf("Created a new cache with size %lu\n",ret->size);
  return cache;
}
示例#3
0
文件: Error.c 项目: DarkLotus/uoai
void PushError(Error * topush)
{
	LinkedListEnum * llenum;
	ErrorHandler curhandler;

	if(!ErrorStack)
		ErrorStack=LL_create();

	LL_push(ErrorStack,(void *)topush);

	if(ErrorHandlerStack)
	{
		llenum=LL_newenum(ErrorHandlerStack);
		curhandler=(ErrorHandler)LL_end(llenum);
		while(curhandler)
		{
			curhandler();
			curhandler=(ErrorHandler)LL_previous(llenum);
		}
		LL_enumdelete(llenum);
	}

	return;
}