Re: GHash small patch



Salmaso Raffaele <raffaele salmaso libero it> writes:

> 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;
> +

You probably want 

new_size = g_spaced_primes_closest (hash_table->nnodes);
new_size = CLAMP (new_size, HASH_TABLE_MIN_SIZE, HASH_TABLE_MAX_SIZE);

Søren



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