library/src/javascript/JSON/BP-JSON.cc
// attempt to destroy a json object
attempt to destroy a json object
attempt to destroy a json object
BP_ERROR_T BP_JSONDestroy(P_BP_JSON json)
{
	if(!json)
		return ERR_FAILURE;
	if(!json->system_hreg)
		return ERR_FAILURE;
	if(json->parse_state)
	{
		BP_JSONDestroyParseState(json->parse_state);
		json->parse_state = NULL;
	}
	if(json->json_in_hreg)
	{
		BP_DestroyHashTableRegistry(json->json_in_hreg);
		json->json_in_hreg = NULL;
	}
	if(json->json_out_hreg)
	{
		BP_DestroyHashTableRegistry(json->json_out_hreg);
		json->json_out_hreg = NULL;
	}
	if(json->json_out_prepare_tq)
	{
		BP_DestroyLinkL(json->json_out_prepare_tq, BP_TRUE);
		json->json_out_prepare_tq = NULL;
	}
	P_BP_HASH_TABLE_REGISTRY system_hreg = json->system_hreg;
	BP_DestroyHashTableRegistry(system_hreg);
	return ERR_SUCCESS;
}
BP_ERROR_T BP_JSONDestroy ( P_BP_JSON json ) { if ( ! json ) return ERR_FAILURE ; if ( ! json -> system_hreg ) return ERR_FAILURE ; if ( json -> parse_state ) { BP_JSONDestroyParseState ( json -> parse_state ) ; json -> parse_state = NULL ; } if ( json -> json_in_hreg ) { BP_DestroyHashTableRegistry ( json -> json_in_hreg ) ; json -> json_in_hreg = NULL ; } if ( json -> json_out_hreg ) { BP_DestroyHashTableRegistry ( json -> json_out_hreg ) ; json -> json_out_hreg = NULL ; } if ( json -> json_out_prepare_tq ) { BP_DestroyLinkL ( json -> json_out_prepare_tq , BP_TRUE ) ; json -> json_out_prepare_tq = NULL ; } P_BP_HASH_TABLE_REGISTRY system_hreg = json -> system_hreg ; BP_DestroyHashTableRegistry ( system_hreg ) ; return ERR_SUCCESS ; }
attempt to destroy a json object
attempt to destroy a json object
// destroy parse state if it exists // destroy json in registry if it exists // destroy json out registry if it exists // destroy the prepare linkl if it's set // destroy the reg // ht_free(system_hreg, json); // destroy system registry (destroys all other allocations including main structure) // return indicating success