Re: Little speed improvements



On 2001.06.18 07:54:25 +0100 Emmanuel wrote:
> 	Hi all,
> I'm still reading through the different sources of Balsa, just two more 
> small speed improvements attached in libmutt/hash.c and /libmutt/lib.c.
> Bye
> Manu
> --- hash.c	Fri Jan  3 15:18:25 1997
> +++ hash.c.corr	Sun Jun 17 17:25:08 2001
> @@ -38,7 +38,7 @@
>    h = (h >= 0) ? h : h + n;
>  #endif
>  
> -  return (h % n);
> +  return h;
>  }
> 

This breaks the hash function. It lets you return hash keys larger than your
hash size.

 
>  HASH *hash_create (int nelem)
> 
> --- lib.c	Tue Feb 13 10:31:05 2001
> +++ lib.c.corr	Mon Jun 18 08:33:33 2001
> @@ -207,7 +207,7 @@
>  {
>    for (; t; t = t->next)
>    {
> -    if (!mutt_strncasecmp (s, t->data, mutt_strlen (t->data)) || *t->data
> == '*')
> +    if (*t->data == '*' || !mutt_strncasecmp (s, t->data, mutt_strlen
> (t->data)))
>        return 1;
>    }
>    return 0;
> 

here you're right but i personaly try to keep changes to libmutt as small 
as possible to help with the mutt syncs.
i leave to pawel.

cheers

-- 
Carlos Morgado - chbm(at)chbm(dot)nu - http://chbm.nu/ -- gpgkey: 0x1FC57F0A
http://wwwkeys.pgp.net/ FP:0A27 35D3 C448 3641 0573 6876 2A37 4BB2 1FC5 7F0A
Software is like sex; it's better when it's free. - Linus Torvalds




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