-/* $Id: reckeys.c,v 1.3 2005-11-09 11:51:29 adam Exp $
- Copyright (C) 1995-2005
+/* $Id: reckeys.c,v 1.7 2006-08-14 10:40:15 adam Exp $
+ Copyright (C) 1995-2006
Index Data ApS
This file is part of the Zebra server.
for more details.
You should have received a copy of the GNU General Public License
-along with Zebra; see the file LICENSE.zebra. If not, write to the
-Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-02111-1307, USA.
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
*/
#include <stdio.h>
struct zebra_rec_key_entry **zebra_rec_keys_mk_hash(zebra_rec_keys_t p,
const char *buf,
- size_t len)
+ size_t len,
+ const struct it_key *key)
{
unsigned h = 0;
size_t i;
+ int j;
for (i = 0; i<len; i++)
h = h * 65509 + buf[i];
+ for (j = 0; j<key->len; j++)
+ h = h * 65509 + CAST_ZINT_TO_INT(key->mem[j]);
return &p->entries[h % (unsigned) p->hash_size];
}
p->decode_handle = iscz1_start();
p->nmem = nmem_create();
- p->hash_size = 127;
+ p->hash_size = 1023;
p->entries = 0;
init_hash(p);
const char *str, size_t slen,
const struct it_key *key)
{
- struct zebra_rec_key_entry **kep = zebra_rec_keys_mk_hash(keys, str, slen);
+ struct zebra_rec_key_entry **kep = zebra_rec_keys_mk_hash(keys,
+ str, slen, key);
while (*kep)
{
struct zebra_rec_key_entry *e = *kep;
}
return 1;
}
+/*
+ * Local variables:
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ * vim: shiftwidth=4 tabstop=8 expandtab
+ */
+