library/src/datastructures/BP-HashTable.cc
// Add a table to the registry by a provided path.
Add a table to the registry by a provided path.
Add a table to the registry by a provided path .
BP_ERROR_T BP_HashRegAddTableByPathQuery
(
	P_BP_HASH_TABLE_REGISTRY hreg,
	char *lookup_query
)
{
	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;
	}
	printf("\n Path Lookup: '%s'\n", lookup_query);
	BP_DisplayStringArray(" path_lookup_arr[]: ", 1, 1, path_lookup_array);
	BP_ERROR_T ret_code = BP_HashRegAddTableByPath
	(
		hreg,
		path_lookup_array
	);
	BP_DestroyPointerArrayNullTerminated((void **) path_lookup_array);
	bpfree(path_lookup_array);
	return ret_code;
}
BP_ERROR_T BP_HashRegAddTableByPathQuery ( P_BP_HASH_TABLE_REGISTRY hreg , char * lookup_query ) { 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 ; } printf ( " \n \n " , lookup_query ) ; BP_DisplayStringArray ( " " , 1 , 1 , path_lookup_array ) ; BP_ERROR_T ret_code = BP_HashRegAddTableByPath ( hreg , path_lookup_array ) ; BP_DestroyPointerArrayNullTerminated ( ( void * * ) path_lookup_array ) ; bpfree ( path_lookup_array ) ; return ret_code ; }
Add a table to the registry by a provided path.
Add a table to the registry by a provided path .
// macro to override 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 // display the path lookup array // Add a table to the registry by a provided path. // destroy the pointer array before exiting // destroy the array structure itself // return with the addition return code