All pastes #611196 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-07-09 20:26 UTC
rendered paste body
/*!******************************
		 * 				*
		 * 	search the entry	*
		 * 				*
		 * ******************************/
		if (
		    	TRUE != g_tree_lookup_extended(Storing_B_Tree, key_one->str, NULL, NULL)
				  &&
			TRUE != g_tree_lookup_extended(Storing_B_Tree, key_two->str, NULL, NULL)
		   )
		{
			/*! if doesn't exist, create it and init the GArray 
			 * as a value for this entry
			 */
			GArray *value;
			
			/*! Creates a new GArray.to store connections packets
			 * 
			\param[in] zero_terminated : TRUE if the array should have an extra element at the end which is set to 0.
			\param[in] clear_ : TRUE if GArray elements should be automatically cleared to 0 when they are allocated.
			\param[in] element_size : the size of each element in bytes.
			\return the new GArray.
			*/
			value = g_array_new(TRUE, TRUE, 2000);
			
			g_array_append_val(value, m);
			
			/*! add it to the tree
			 */
			g_tree_insert(Storing_B_Tree, key_one->str, *value);
			g_print("STORING FUNCTION : entry created and packet %s stored in memory\n",key_one->str);
		}
		else {
			/*! entry exist, get the adress of the array from the B-Tree value
			 */
			GArray *value;
			
			if (TRUE != g_tree_lookup_extended(redirected_connections, key_one->str, NULL,(gpointer *) value)) 
			{
				/*! if key_one is not the good key, try with key_two */
				g_tree_lookup_extended(redirected_connections, key_two->str, NULL,(gpointer *) value);
			}
			
			g_print("%d\n",value);
			
			/*! store the value at the end of the GArray table
			 */
			g_array_append_val(value, m);
			
			g_print("STORING FUNCTION : packet %s stored in memory in existing entry\n",key_one->str);
		}