library/src/datastructures/BP-HashTable.cc
// count via path query
// count by path query (does not recurse)
count via path query
count by path query (does not recurse)
count via path query count by path query ( does not recurse )
size_t BP_HashRegCountEntriesInTableByPathQuery
(
	P_BP_HASH_TABLE_REGISTRY   hreg,
	char *                     lookup_query,
	BP_HASH_TABLE_COUNT_POLICY count_policy
)
{
	BP_GLOBAL_HASH_TABLE_OVERRIDE(ERR_FAILURE);
	if(!lookup_query)
		return ERR_FAILURE;
	if(!BP_StringIsReasonablePrintableString(lookup_query, bpstrlen(lookup_query), BP_FALSE, BP_FALSE))
		return ERR_FAILURE;
	char ** path_lookup_array = BP_HashRegStringLookupToPathArray(lookup_query, bpstrlen(lookup_query));
	if(!path_lookup_array)
		return ERR_FAILURE;
	if(!path_lookup_array[0])
	{
		bpfree(path_lookup_array);
		return ERR_FAILURE;
	}
	size_t entry_count = BP_HashRegCountEntriesInTableByPath(hreg, path_lookup_array, count_policy);
	BP_DestroyPointerArrayNullTerminated((void **) path_lookup_array);
	bpfree(path_lookup_array);
	return entry_count;
}
size_t BP_HashRegCountEntriesInTableByPathQuery ( P_BP_HASH_TABLE_REGISTRY hreg , char * lookup_query , BP_HASH_TABLE_COUNT_POLICY count_policy ) { BP_GLOBAL_HASH_TABLE_OVERRIDE ( ERR_FAILURE ) ; if ( ! lookup_query ) return ERR_FAILURE ; if ( ! BP_StringIsReasonablePrintableString ( lookup_query , bpstrlen ( lookup_query ) , BP_FALSE , BP_FALSE ) ) return ERR_FAILURE ; char * * path_lookup_array = BP_HashRegStringLookupToPathArray ( lookup_query , bpstrlen ( lookup_query ) ) ; if ( ! path_lookup_array ) return ERR_FAILURE ; if ( ! path_lookup_array [ 0 ] ) { bpfree ( path_lookup_array ) ; return ERR_FAILURE ; } size_t entry_count = BP_HashRegCountEntriesInTableByPath ( hreg , path_lookup_array , count_policy ) ; BP_DestroyPointerArrayNullTerminated ( ( void * * ) path_lookup_array ) ; bpfree ( path_lookup_array ) ; return entry_count ; }
count via path query
count by path query (does not recurse)
count via path query count by path query ( does not recurse )
// macro to ov.erride hreg on null // validate that string is reasonable/printable // Create path array from lookup query.  This function will fail // if the lookup query cannot be parsed (bad characters etc) // if we can't convert the path, exit with failure code // ensure we have a first position // set the entry count // destroy the pointer array before exiting // destroy the array structure itself // return with the addition return code