library/src/blockclass/BP-BlockClass.cc
// add an element to error array
add an element to error array
add an element to error array
int Block::AddErrorToStack(char *errorMsg)
{
	BP_BLOCK_ENTER_CRITICAL_SECTION;
	if(!this->msg_logging_enabled)
		return ERR_FAILURE;
	if(this->display_errors_immediately)
		printf("\nBlock Error: %s", errorMsg);
	if (errorMsg == NULL)
		this->AddErrorToStack((char *) "Parameter passed to Block::AddErrorToStack() was NULL.");
	this->errorCount++;
	this->errorStrings = (char **) tq_realloc(this->tq, this->errorStrings, sizeof(char *) * this->errorCount, BPLN);
	this->errorStrings[this->errorCount - 1] = tq_strndup(this->tq, errorMsg, BP_CLASS_MAX_ERROR_STR_LEN, BPLN);
	BP_BLOCK_LEAVE_CRITICAL_SECTION;
	return ERR_SUCCESS;
}
int Block :: AddErrorToStack ( char * errorMsg ) { BP_BLOCK_ENTER_CRITICAL_SECTION ; if ( ! this -> msg_logging_enabled ) return ERR_FAILURE ; if ( this -> display_errors_immediately ) printf ( " \n " , errorMsg ) ; if ( errorMsg == NULL ) this -> AddErrorToStack ( ( char * ) " " ) ; this -> errorCount ++ ; this -> errorStrings = ( char * * ) tq_realloc ( this -> tq , this -> errorStrings , sizeof ( char * ) * this -> errorCount , BPLN ) ; this -> errorStrings [ this -> errorCount - 1 ] = tq_strndup ( this -> tq , errorMsg , BP_CLASS_MAX_ERROR_STR_LEN , BPLN ) ; BP_BLOCK_LEAVE_CRITICAL_SECTION ; return ERR_SUCCESS ; }
add an element to error array
add an element to error array
// enter critical section // display errors immediately // add error if parameter is null // increment the error count // bprealloc the buffer to the proper size // set the index // leave the critical section // return indicating success