PulkoMandy | 17fc759 | 2022-07-28 18:27:54 +0200 | [diff] [blame] | 1 | /* |
| 2 | * (c) Thomas Pornin 1998, 1999, 2000 |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted provided that the following conditions |
| 6 | * are met: |
| 7 | * 1. Redistributions of source code must retain the above copyright |
| 8 | * notice, this list of conditions and the following disclaimer. |
| 9 | * 2. Redistributions in binary form must reproduce the above copyright |
| 10 | * notice, this list of conditions and the following disclaimer in the |
| 11 | * documentation and/or other materials provided with the distribution. |
| 12 | * 4. The name of the authors may not be used to endorse or promote |
| 13 | * products derived from this software without specific prior written |
| 14 | * permission. |
| 15 | * |
| 16 | * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR |
| 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE |
| 20 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT |
| 22 | * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR |
| 23 | * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, |
| 24 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE |
| 25 | * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, |
| 26 | * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | * |
| 28 | */ |
| 29 | |
| 30 | #ifndef UCPP__HASH__ |
| 31 | #define UCPP__HASH__ |
| 32 | |
| 33 | struct hash_item; |
| 34 | |
| 35 | struct HT { |
| 36 | struct hash_item **lists; |
| 37 | int nb_lists; |
| 38 | int (*cmpdata)(void *, void *); |
| 39 | int (*hash)(void *); |
| 40 | void (*deldata)(void *); |
| 41 | }; |
| 42 | |
| 43 | int hash_string(char *); |
| 44 | struct HT *newHT(int, int (*)(void *, void *), int (*)(void *), |
| 45 | void (*)(void *)); |
| 46 | void *putHT(struct HT *, void *); |
| 47 | void *forceputHT(struct HT *, void *); |
| 48 | void *getHT(struct HT *, void *); |
| 49 | int delHT(struct HT *, void *); |
| 50 | struct HT *copyHT(struct HT *); |
| 51 | void killHT(struct HT *); |
| 52 | void saveHT(struct HT *, void **); |
| 53 | void restoreHT(struct HT *, void **); |
| 54 | void scanHT(struct HT *, void (*)(void *)); |
| 55 | int hash_struct(void *); |
| 56 | int cmp_struct(void *, void *); |
| 57 | |
| 58 | #endif |