library/src/blockclass/BP-BlockClass.cc
// add a warning to the error stack
add a warning to the error stack
add a warning to the error stack
int Block::AddWarningToStack(char *warningMsg)
{
	BP_BLOCK_ENTER_CRITICAL_SECTION;
	if(!this->msg_logging_enabled)
		BP_BLOCK_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(ERR_FAILURE);
	if(this->display_warnings_immediately)
		printf("\nBlock Warning: %s", warningMsg);
	if (warningMsg == NULL)
		this->AddErrorToStack((char *) "Parameter passed to Block::AddWarningToStack() was NULL.");
	this->warningCount++;
	this->warningStrings = (char **) tq_realloc(this->tq, this->warningStrings, sizeof(char *) * this->warningCount, BPLN);
	this->warningStrings[this->warningCount - 1] = tq_strndup(this->tq, warningMsg, BP_CLASS_MAX_WARNING_STR_LEN, BPLN);
	BP_BLOCK_LEAVE_CRITICAL_SECTION;
	return ERR_SUCCESS;
}
int Block :: AddWarningToStack ( char * warningMsg ) { BP_BLOCK_ENTER_CRITICAL_SECTION ; if ( ! this -> msg_logging_enabled ) BP_BLOCK_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( ERR_FAILURE ) ; if ( this -> display_warnings_immediately ) printf ( " \n " , warningMsg ) ; if ( warningMsg == NULL ) this -> AddErrorToStack ( ( char * ) " " ) ; this -> warningCount ++ ; this -> warningStrings = ( char * * ) tq_realloc ( this -> tq , this -> warningStrings , sizeof ( char * ) * this -> warningCount , BPLN ) ; this -> warningStrings [ this -> warningCount - 1 ] = tq_strndup ( this -> tq , warningMsg , BP_CLASS_MAX_WARNING_STR_LEN , BPLN ) ; BP_BLOCK_LEAVE_CRITICAL_SECTION ; return ERR_SUCCESS ; }
add a warning to the error stack
add a warning to the error stack
// enter critical section // display errors immediately // add error if parameter is null // increment the warning count // bprealloc the buffer to the proper size // set the index // leave critical section // return indicating success