library/src/blockclass/subclasses/BP_StringUtils.cc
// Joins a string on an internal allocated buffer (good for creating dynamic strings).  Be careful with overly long strings.
Joins a string on an internal allocated buffer (good for creating dynamic strings).  Be careful with overly long strings.
Joins a string on an internal allocated buffer ( good for creating dynamic strings ) . Be careful with overly long strings .
bool BP_StringUtils::BuildString(char * str_to_add)
{
	if(!str_to_add)
		return false;
	size_t build_str_len = 0;
	size_t add_str_len   = bpstrlen(str_to_add);
	if(this->build_str)
		build_str_len = bpstrlen(this->build_str);
	this->build_str = (char *) tq_realloc(this->tq, this->build_str, build_str_len + add_str_len + 10, BPLN);
	if(!this->build_str)
	{
		printf("\n [+] build string alloc failed for string: %s", str_to_add);
		return false;
	}
	memset(&this->build_str[build_str_len], 0x00, add_str_len+4);
	strncat(this->build_str, str_to_add, add_str_len);
	return true;
}
bool BP_StringUtils :: BuildString ( char * str_to_add ) { if ( ! str_to_add ) return false ; size_t build_str_len = 0 ; size_t add_str_len = bpstrlen ( str_to_add ) ; if ( this -> build_str ) build_str_len = bpstrlen ( this -> build_str ) ; this -> build_str = ( char * ) tq_realloc ( this -> tq , this -> build_str , build_str_len + add_str_len + 10 , BPLN ) ; if ( ! this -> build_str ) { printf ( " \n " , str_to_add ) ; return false ; } memset ( & this -> build_str [ build_str_len ] , 0x00 , add_str_len + 4 ) ; strncat ( this -> build_str , str_to_add , add_str_len ) ; return true ; }
Joins a string on an internal allocated buffer (good for creating dynamic strings).
Joins a string on an internal allocated buffer ( good for creating dynamic strings ) .
// set build and add string lengths // bpreallocate space // zero out memory // copy in string up till length // return indicating success