Пример #1
0
__attribute__ ((visibility("default"))) void *
realloc(void* mem, size_t size)
{
	if (mem == NULL)
		num_alloc++;
	return sys_realloc(mem, size);
}
Пример #2
0
static void mt_addindex(mt_divider_t* divider,unsigned int index)
{
	if(divider->numquery>=divider->maxquery)
	{
		divider->maxquery=2*divider->maxquery+1;
		divider->query=sys_realloc(divider->query,sizeof(unsigned int)*divider->maxquery);
	}

	divider->query[divider->numquery]=index;
	divider->numquery++;
}
Пример #3
0
static void mt_addcollider(mt_dividernode_t* node,unsigned int index)
{
	unsigned int i;
	
	//Grow this array if needed
	if(node->numcolliders>=node->maxcolliders)
	{
		node->maxcolliders=node->maxcolliders*2+1;
		node->colliders=sys_realloc(node->colliders,node->maxcolliders*sizeof(unsigned int));
	}

	//Insert sort the new collider in the array
	for(i=node->numcolliders;i>0&&node->colliders[i-1]>index;i--)
		node->colliders[i]=node->colliders[i-1];

	node->colliders[i]=index;
	node->numcolliders++;
}
Пример #4
0
void mt_resizedivider(mt_divider_t* divider,unsigned int numcolliders)
{
	int prime,factor;
	unsigned int i;

	//Reallocate colliders
	divider->colliders=sys_realloc(divider->colliders,sizeof(mt_collider_t)*numcolliders);
	divider->numcolliders=numcolliders;

	factor=numcolliders/4;
	prime=mt_nextprime(numcolliders/4+1);

	//Recursively clear the divider
	mt_clearnode(divider->root);

	//We have removed all the colliders from the divider, we need to set the node pointers to 0
	for(i=0;i<divider->numcolliders;i++)
		divider->colliders[i].node=0;
}
Пример #5
0
void ui_menuset(ui_widget_t* widget,unsigned int index,void* param)
{
	ui_menudata_t* data=(ui_menudata_t*)widget->data;
	switch(index)
	{
		case UI_MENU_SELECTION:
			data->selected=(int)param;
			break;
		case UI_MENU_TYPE:
			data->type=(unsigned int)param;
			break;
		case UI_MENU_ITEMCOUNT:
			data->numitems=(unsigned int)param;
			data->positions=(int*)sys_realloc(data->positions,sizeof(int)*(data->numitems+1));
			memset(data->positions,0,sizeof(int)*(data->numitems+1));
			break;
		case UI_MENU_ITEMS:
			data->items=(ui_menuitem_t*)param;
			break;
	}
}
Пример #6
0
void* realloc(void* ptr, size_t size) {
      return sys_realloc(ptr, size);
}