library/src/utility/BP-StringUtilities.cc
// HASH REGISTRY VERSION
// Pushes an array onto a heap allocated array of char*s.
// HASH REGISTRY VERSION
HASH REGISTRY VERSION
Pushes an array onto a heap allocated array of char*s.
HASH REGISTRY VERSION
HASH REGISTRY VERSION Pushes an array onto a heap allocated array of char * s . HASH REGISTRY VERSION
BP_ERROR_T BP_ArrayPushDupStringHREG(P_BP_HASH_TABLE_REGISTRY hreg, char * value, char *** stack, size_t *stack_n)
{
	if(!hreg)
		return ERR_FAILURE;
	if(!stack_n)
		return ERR_FAILURE;
	if(!stack)
		return ERR_FAILURE;
	BP_HASH_TABLE_ENTER_CRITICAL_SECTION(hreg);
	size_t new_stack_size = (*stack_n+2) * sizeof(char *);
	stack[0] = (char **) ht_realloc(hreg, *stack, new_stack_size);
	stack[0][*stack_n] = ht_strdup(hreg, value);
	stack[0][*stack_n+1] = NULL;
	*stack_n = *stack_n + 1;
	BP_HASH_TABLE_LEAVE_CRITICAL_SECTION(hreg);
	return ERR_SUCCESS;
}
BP_ERROR_T BP_ArrayPushDupStringHREG ( P_BP_HASH_TABLE_REGISTRY hreg , char * value , char * * * stack , size_t * stack_n ) { if ( ! hreg ) return ERR_FAILURE ; if ( ! stack_n ) return ERR_FAILURE ; if ( ! stack ) return ERR_FAILURE ; BP_HASH_TABLE_ENTER_CRITICAL_SECTION ( hreg ) ; size_t new_stack_size = ( * stack_n + 2 ) * sizeof ( char * ) ; stack [ 0 ] = ( char * * ) ht_realloc ( hreg , * stack , new_stack_size ) ; stack [ 0 ] [ * stack_n ] = ht_strdup ( hreg , value ) ; stack [ 0 ] [ * stack_n + 1 ] = NULL ; * stack_n = * stack_n + 1 ; BP_HASH_TABLE_LEAVE_CRITICAL_SECTION ( hreg ) ; return ERR_SUCCESS ; }
HASH REGISTRY VERSION
Pushes an array onto a heap allocated array of char*s.
HASH REGISTRY VERSION
HASH REGISTRY VERSION Pushes an array onto a heap allocated array of char * s . HASH REGISTRY VERSION
// ensure we have a registry // ensure we have a pointer to the stack // we need a pointer to a char **. // enter critical section // calculate the new stack size based on provided inputs // create new stack // set the value in the stack // null terminate the array // increment the stack counter // leave critical section // return indicating success