library/src/datastructures/BP-LinkedList.cc
// Attempts to print all string elements out to standard out, mostly for
// debugging/development testing.
Attempts to print all string elements out to standard out, mostly for
debugging/development testing.
Attempts to print all string elements out to standard out mostly for debugging / development testing .
BP_ERROR_T BP_LinkLPrintStringElementsToStdout(P_BP_LINKL head)
{
	if(!head)
		return ERR_FAILURE;
	if(!head->total_size)
		return ERR_FAILURE;
	P_BP_LINKL_DATA first_item = TAILQ_FIRST(&head->head);
	if(!first_item)
		return ERR_FAILURE;
	size_t string_index = 0;
	TAILQ_FOREACH(first_item, &head->head, linkl_data)
	{
		if(string_index == 0)
			printf("\n [+] Displaying String Elements for List %p", head);
		if
		(
			first_item->data_type != BP_MEMPROF_ALLOC_TYPE_STRDUP   &&
			first_item->data_type != BP_MEMPROF_ALLOC_TYPE_STRNDUP
		)
		{
			string_index++;
			continue;
		}
		printf("\n\t [%u] - %s", string_index, (char *) first_item->data);
		string_index++;
	}
	return ERR_SUCCESS;
}
BP_ERROR_T BP_LinkLPrintStringElementsToStdout ( P_BP_LINKL head ) { if ( ! head ) return ERR_FAILURE ; if ( ! head -> total_size ) return ERR_FAILURE ; P_BP_LINKL_DATA first_item = TAILQ_FIRST ( & head -> head ) ; if ( ! first_item ) return ERR_FAILURE ; size_t string_index = 0 ; TAILQ_FOREACH ( first_item , & head -> head , linkl_data ) { if ( string_index == 0 ) printf ( " \n " , head ) ; if ( first_item -> data_type != BP_MEMPROF_ALLOC_TYPE_STRDUP && first_item -> data_type != BP_MEMPROF_ALLOC_TYPE_STRNDUP ) { string_index ++ ; continue ; } printf ( " \n \t " , string_index , ( char * ) first_item -> data ) ; string_index ++ ; } return ERR_SUCCESS ; }
Attempts to print all string elements out to standard out, mostly for
debugging/development testing.
Attempts to print all string elements out to standard out mostly for debugging / development testing .
// ensure we have a head // ensure the list has a total size // attempt to get the first item // ensure we have a first item // string index used to display // looks for a pointer in the item // display header if we don't have a string index // only work with strndup/strdup types // increase the string index // display string index // increase the string index // return indicating success