library/src/network/httpd/BP-HTTPdRequests.cc
// Internal function to destroy post arguments.  Destroys data and closes
Internal function to destroy post arguments.  Destroys data and closes
Internal function to destroy post arguments . Destroys data and closes
BP_ERROR_T BP_HTTPdRequestDestroyPostArgs(P_BP_HTTPD_REQUEST request)
{
	if(!request)
		return ERR_FAILURE;
	if(!request->arg_hreg)
		return ERR_FAILURE;
	char * table_path[10] = {0};
	P_BP_HASH_TABLE_KEYED_ENTRY tmp_lookup = NULL;
	BP_HASH_TABLE_ENTER_CRITICAL_SECTION(request->arg_hreg);
	table_path[0] = "POST";
	table_path[1] = NULL;
	tmp_lookup = BP_HashRegLookupTableByPath(request->arg_hreg, table_path);
	if(!tmp_lookup)
		BP_HASH_TABLE_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC(request->arg_hreg, ERR_FAILURE);
	if(tmp_lookup->data)
	{
		tmp_lookup = (P_BP_HASH_TABLE_KEYED_ENTRY) tmp_lookup->data;
		P_BP_HASH_TABLE_KEYED_ENTRY entry = NULL;
		P_BP_HASH_TABLE_KEYED_ENTRY tmp   = NULL;
		HASH_ITER(hh, tmp_lookup, entry, tmp)
		{
			P_BP_HTTPD_REQUEST_VAR tmp_var = (P_BP_HTTPD_REQUEST_VAR) entry->data;
			if(tmp_var)
			{
				BP_HTTPdRequestVarDestroyMembers(tmp_var);
			}
		}
	}
	BP_HashRegDestroyTableByPath(request->arg_hreg, table_path);
	BP_HASH_TABLE_LEAVE_CRITICAL_SECTION(request->arg_hreg);
	return ERR_SUCCESS;
}
BP_ERROR_T BP_HTTPdRequestDestroyPostArgs ( P_BP_HTTPD_REQUEST request ) { if ( ! request ) return ERR_FAILURE ; if ( ! request -> arg_hreg ) return ERR_FAILURE ; char * table_path [ 10 ] = { 0 } ; P_BP_HASH_TABLE_KEYED_ENTRY tmp_lookup = NULL ; BP_HASH_TABLE_ENTER_CRITICAL_SECTION ( request -> arg_hreg ) ; table_path [ 0 ] = " " ; table_path [ 1 ] = NULL ; tmp_lookup = BP_HashRegLookupTableByPath ( request -> arg_hreg , table_path ) ; if ( ! tmp_lookup ) BP_HASH_TABLE_LEAVE_CRITICAL_SECTION_AND_RETURN_FROM_FUNC ( request -> arg_hreg , ERR_FAILURE ) ; if ( tmp_lookup -> data ) { tmp_lookup = ( P_BP_HASH_TABLE_KEYED_ENTRY ) tmp_lookup -> data ; P_BP_HASH_TABLE_KEYED_ENTRY entry = NULL ; P_BP_HASH_TABLE_KEYED_ENTRY tmp = NULL ; HASH_ITER ( hh , tmp_lookup , entry , tmp ) { P_BP_HTTPD_REQUEST_VAR tmp_var = ( P_BP_HTTPD_REQUEST_VAR ) entry -> data ; if ( tmp_var ) { BP_HTTPdRequestVarDestroyMembers ( tmp_var ) ; } } } BP_HashRegDestroyTableByPath ( request -> arg_hreg , table_path ) ; BP_HASH_TABLE_LEAVE_CRITICAL_SECTION ( request -> arg_hreg ) ; return ERR_SUCCESS ; }
Internal function to destroy post arguments.
Internal function to destroy post arguments .
// ensure we have a request // declare dynamic table path // declare the lookup pointer // enter critical section before making changes to the httpd hash // table registry. // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Attempt to Iterate Through the Registry %%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // set the top path to post // lookup the post table // ensure we can lookup the required value // destroy data entries if necessary // move the tmp lookup to the hash table children (since it's a table) // temporary iterator values used during the HASH_ITER loop below // iterate through all hashes and display // set variable // if the var is set, destroy its members // destroy table by path (clears out all allocated structures) // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // %%% Exit After All Are Destroyed %%%%%%%%%%%%%%%%%%%%%%%%%% // %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% // leave critical section // return indicating success