library/src/utility/BP-StringUtilities.cc
// Pushes an array onto a heap allocated array of char*s.
Pushes an array onto a heap allocated array of char*s.
Pushes an array onto a heap allocated array of char * s .
BP_ERROR_T BP_ArrayPushDupString(char * value, char *** stack, size_t *stack_n)
{
	if(!stack_n)
		return ERR_FAILURE;
	size_t new_stack_size = (*stack_n+1) * sizeof(char *);
	stack[0] = (char **) bprealloc(*stack, new_stack_size);
	stack[0][*stack_n] = bpstrdup(value);
	*stack_n = *stack_n + 1;
	return ERR_SUCCESS;
}
BP_ERROR_T BP_ArrayPushDupString ( char * value , char * * * stack , size_t * stack_n ) { if ( ! stack_n ) return ERR_FAILURE ; size_t new_stack_size = ( * stack_n + 1 ) * sizeof ( char * ) ; stack [ 0 ] = ( char * * ) bprealloc ( * stack , new_stack_size ) ; stack [ 0 ] [ * stack_n ] = bpstrdup ( value ) ; * stack_n = * stack_n + 1 ; return ERR_SUCCESS ; }
Pushes an array onto a heap allocated array of char*s.
Pushes an array onto a heap allocated array of char * s .
// ensure we have a pointer to the stack // calculate the new stack size based on provided inputs // create new stack // set the value in the gadget stack // increment the stack counter // return indicating success