GHash small patch



A very little patch to avoid 3 function call when not needed.

--- ghash.c	Mon Dec 17 15:26:02 2001
+++ ghash-new.c	Fri Mar 15 09:09:56 2002
@@ -585,9 +585,12 @@
   gint new_size;
   gint i;
 
-  new_size = CLAMP(g_spaced_primes_closest (hash_table->nnodes),
-		   HASH_TABLE_MIN_SIZE,
-		   HASH_TABLE_MAX_SIZE);
+  new_size = g_spaced_primes_closest (hash_table->nnodes);
+  if (new_size < HASH_TABLE_MIN_SIZE)
+	  new_size = HASH_TABLE_MIN_SIZE;
+  else if (new_size > HASH_TABLE_MAX_SIZE)
+	  new_size = HASH_TABLE_MAX_SIZE;
+
   new_nodes = g_new0 (GHashNode*, new_size);
   
   for (i = 0; i < hash_table->size; i++)

-- 
+---- | Un OS per domarli, Un OS per trovarli,             |  -o)
+---+ | Un OS per ghermirli e nel buio incatenarli         |  /\\
 O  | | Nella terra di Redmond, ove l'ombra cupa scende... | _\_V
                    raffaele punto salmaso presso libero punto it



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]