Main Page | Modules | Directories | File List

hash.h

00001 /* libmb
00002  * Copyright (C) 2002 Matthew Allum
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public
00015  * License along with this library; if not, write to the
00016  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00017  * Boston, MA 02111-1307, USA.
00018  */
00019 
00020 #include <stdio.h>
00021 #include <stdlib.h>
00022 #include <string.h>
00023 
00024 #define HASHSIZE 101
00025 
00026 struct hash {
00027   struct nlist **hashtab;
00028   int size;
00029 };
00030 
00031 struct nlist {
00032    struct nlist *next;
00033    char *key;
00034    unsigned char *value;
00035 };
00036 
00037 struct hash* hash_new(int size);
00038 unsigned int hashfunc(struct hash *h, char *s);
00039 struct nlist *hash_lookup(struct hash *h, char *s);
00040 struct nlist *hash_add(struct hash *h, char *key, char *val);
00041 void hash_empty();
00042 void hash_destroy(struct hash *h);

Generated on Tue Jan 11 08:51:10 2005 for LibMB by  doxygen 1.4.0