library/src/datastructures/BP-HashTable.cc
// Will search a traversal path and return an ENTRY based on a path query.
Will search a traversal path and return an ENTRY based on a path query.
Will search a traversal path and return an ENTRY based on a path query .
P_BP_HASH_TABLE_KEYED_ENTRY BP_HashRegLookupTableEntryByPathQuery
(
	P_BP_HASH_TABLE_REGISTRY      hreg,
	char *                        entry_path_lookup_query
)
{
	if(!entry_path_lookup_query)
		return NULL;
	if(!BP_StringIsReasonablePrintableString(entry_path_lookup_query, bpstrlen(entry_path_lookup_query), BP_FALSE, BP_FALSE))
		return NULL;
	char ** path_lookup_array = BP_HashRegStringLookupToPathArray(entry_path_lookup_query, bpstrlen(entry_path_lookup_query));
	if(!path_lookup_array)
		return NULL;
	if(!path_lookup_array[0])
	{
		bpfree(path_lookup_array);
		return NULL;
	}
	P_BP_HASH_TABLE_KEYED_ENTRY lookup_entry = BP_HashRegLookupTableEntryByPath(hreg, path_lookup_array);
	if(!lookup_entry)
	{
		BP_DestroyPointerArrayNullTerminated((void **) path_lookup_array);
		bpfree(path_lookup_array);
		return NULL;
	}
	BP_DestroyPointerArrayNullTerminated((void **) path_lookup_array);
	bpfree(path_lookup_array);
	return lookup_entry;
}
P_BP_HASH_TABLE_KEYED_ENTRY BP_HashRegLookupTableEntryByPathQuery ( P_BP_HASH_TABLE_REGISTRY hreg , char * entry_path_lookup_query ) { if ( ! entry_path_lookup_query ) return NULL ; if ( ! BP_StringIsReasonablePrintableString ( entry_path_lookup_query , bpstrlen ( entry_path_lookup_query ) , BP_FALSE , BP_FALSE ) ) return NULL ; char * * path_lookup_array = BP_HashRegStringLookupToPathArray ( entry_path_lookup_query , bpstrlen ( entry_path_lookup_query ) ) ; if ( ! path_lookup_array ) return NULL ; if ( ! path_lookup_array [ 0 ] ) { bpfree ( path_lookup_array ) ; return NULL ; } P_BP_HASH_TABLE_KEYED_ENTRY lookup_entry = BP_HashRegLookupTableEntryByPath ( hreg , path_lookup_array ) ; if ( ! lookup_entry ) { BP_DestroyPointerArrayNullTerminated ( ( void * * ) path_lookup_array ) ; bpfree ( path_lookup_array ) ; return NULL ; } BP_DestroyPointerArrayNullTerminated ( ( void * * ) path_lookup_array ) ; bpfree ( path_lookup_array ) ; return lookup_entry ; }
Will search a traversal path and return an ENTRY based on a path query.
Will search a traversal path and return an ENTRY based on a path query .
// do not do hreg check here, it is done via macro in the function which is called below // ensure we have a lookup query // ensure lookup query is reasonable/printable string // create path array from lookup query // check to ensure we've created a lookup array // ensure we have a first element // gather lookup query // destroy the path lookup array entries // destroy array structure // return the lookup entry