library/src/utility/BP-GenericFastWeightedBalancer.cc
// push an item onto the stack
push an item onto the stack
push an item onto the stack
BP_ERROR_T BP_BalancerPushItemOnStack(P_BP_WEIGHTED_BALANCER balancer, P_BP_WEIGHT_HIT_ENTRY item)
{
	if(!balancer || !item)
		return ERR_FAILURE;
	if(!balancer->gc)
		return ERR_FAILURE;
	balancer->entry_n++;
	balancer->entries = (P_BP_WEIGHT_HIT_ENTRY) BP_realloc(balancer->gc, NULL,(void *) balancer->entries, sizeof(BP_WEIGHT_HIT_ENTRY)*balancer->entry_n);
	memcpy((void *) &balancer->entries[balancer->entry_n-1], item, sizeof(BP_WEIGHT_HIT_ENTRY));
	balancer->requires_update = 1;
	return ERR_SUCCESS;
}
BP_ERROR_T BP_BalancerPushItemOnStack ( P_BP_WEIGHTED_BALANCER balancer , P_BP_WEIGHT_HIT_ENTRY item ) { if ( ! balancer || ! item ) return ERR_FAILURE ; if ( ! balancer -> gc ) return ERR_FAILURE ; balancer -> entry_n ++ ; balancer -> entries = ( P_BP_WEIGHT_HIT_ENTRY ) BP_realloc ( balancer -> gc , NULL , ( void * ) balancer -> entries , sizeof ( BP_WEIGHT_HIT_ENTRY ) * balancer -> entry_n ) ; memcpy ( ( void * ) & balancer -> entries [ balancer -> entry_n - 1 ] , item , sizeof ( BP_WEIGHT_HIT_ENTRY ) ) ; balancer -> requires_update = 1 ; return ERR_SUCCESS ; }
push an item onto the stack
push an item onto the stack
// check pointers // require a garbage collector // increase the entry count // allocate space // copy in structure // mark that table requires analysis and exit