Initial commit.
[CMakeLuaTailorHgBridge.git] / CMakeLua / Utilities / cmcurl / hash.h
blobf867a8a67fb834614fefcdaaa2fdb0a496e11754
1 #ifndef __HASH_H
2 #define __HASH_H
3 /***************************************************************************
4 * _ _ ____ _
5 * Project ___| | | | _ \| |
6 * / __| | | | |_) | |
7 * | (__| |_| | _ <| |___
8 * \___|\___/|_| \_\_____|
10 * Copyright (C) 1998 - 2005, Daniel Stenberg, <daniel@haxx.se>, et al.
12 * This software is licensed as described in the file COPYING, which
13 * you should have received as part of this distribution. The terms
14 * are also available at http://curl.haxx.se/docs/copyright.html.
16 * You may opt to use, copy, modify, merge, publish, distribute and/or sell
17 * copies of the Software, and permit persons to whom the Software is
18 * furnished to do so, under the terms of the COPYING file.
20 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
21 * KIND, either express or implied.
23 * $Id: hash.h,v 1.2 2007/03/15 19:22:13 andy Exp $
24 ***************************************************************************/
26 #include "setup.h"
28 #include <stddef.h>
30 #include "llist.h"
32 typedef void (*curl_hash_dtor)(void *);
34 struct curl_hash {
35 struct curl_llist **table;
36 curl_hash_dtor dtor;
37 int slots;
38 size_t size;
41 struct curl_hash_element {
42 void *ptr;
43 char *key;
44 size_t key_len;
48 int Curl_hash_init(struct curl_hash *, int, curl_hash_dtor);
49 struct curl_hash *Curl_hash_alloc(int, curl_hash_dtor);
50 void *Curl_hash_add(struct curl_hash *, char *, size_t, void *);
51 int Curl_hash_delete(struct curl_hash *h, char *key, size_t key_len);
52 void *Curl_hash_pick(struct curl_hash *, char *, size_t);
53 void Curl_hash_apply(struct curl_hash *h, void *user,
54 void (*cb)(void *user, void *ptr));
55 int Curl_hash_count(struct curl_hash *h);
56 void Curl_hash_clean(struct curl_hash *h);
57 void Curl_hash_clean_with_criterium(struct curl_hash *h, void *user,
58 int (*comp)(void *, void *));
59 void Curl_hash_destroy(struct curl_hash *h);
61 #endif