comparison src/fns.c @ 90737:95d0cdf160ea

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 586-614) - Update from CVS - Update from erc--emacs--22 - Merge from gnus--rel--5.10 - Merge from erc--main--0 - Make byte compiler correctly write circular constants * gnus--rel--5.10 (patch 186-196) - Update from CVS - Merge from emacs--devo--0 Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-162
author Miles Bader <miles@gnu.org>
date Fri, 26 Jan 2007 06:16:11 +0000
parents f1d13e615070 3d45362f1d38
children 648e6c714c7d
comparison
equal deleted inserted replaced
90736:ef1369583937 90737:95d0cdf160ea
1 /* Random utility Lisp functions. 1 /* Random utility Lisp functions.
2 Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997, 2 Copyright (C) 1985, 1986, 1987, 1993, 1994, 1995, 1997,
3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 3 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4 2005, 2006 Free Software Foundation, Inc. 4 2005, 2006, 2007 Free Software Foundation, Inc.
5 5
6 This file is part of GNU Emacs. 6 This file is part of GNU Emacs.
7 7
8 GNU Emacs is free software; you can redistribute it and/or modify 8 GNU Emacs is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by 9 it under the terms of the GNU General Public License as published by
4039 { 4039 {
4040 if (NILP (h->next_free)) 4040 if (NILP (h->next_free))
4041 { 4041 {
4042 int old_size = HASH_TABLE_SIZE (h); 4042 int old_size = HASH_TABLE_SIZE (h);
4043 int i, new_size, index_size; 4043 int i, new_size, index_size;
4044 EMACS_INT nsize;
4044 4045
4045 if (INTEGERP (h->rehash_size)) 4046 if (INTEGERP (h->rehash_size))
4046 new_size = old_size + XFASTINT (h->rehash_size); 4047 new_size = old_size + XFASTINT (h->rehash_size);
4047 else 4048 else
4048 new_size = old_size * XFLOATINT (h->rehash_size); 4049 new_size = old_size * XFLOATINT (h->rehash_size);
4049 new_size = max (old_size + 1, new_size); 4050 new_size = max (old_size + 1, new_size);
4050 index_size = next_almost_prime ((int) 4051 index_size = next_almost_prime ((int)
4051 (new_size 4052 (new_size
4052 / XFLOATINT (h->rehash_threshold))); 4053 / XFLOATINT (h->rehash_threshold)));
4053 if (max (index_size, 2 * new_size) > MOST_POSITIVE_FIXNUM) 4054 /* Assignment to EMACS_INT stops GCC whining about limited range
4055 of data type. */
4056 nsize = max (index_size, 2 * new_size);
4057 if (nsize > MOST_POSITIVE_FIXNUM)
4054 error ("Hash table too large to resize"); 4058 error ("Hash table too large to resize");
4055 4059
4056 h->key_and_value = larger_vector (h->key_and_value, 2 * new_size, Qnil); 4060 h->key_and_value = larger_vector (h->key_and_value, 2 * new_size, Qnil);
4057 h->next = larger_vector (h->next, new_size, Qnil); 4061 h->next = larger_vector (h->next, new_size, Qnil);
4058 h->hash = larger_vector (h->hash, new_size, Qnil); 4062 h->hash = larger_vector (h->hash, new_size, Qnil);