Wed, 12 Mar 2003 16:47:49 +0000
[gaim-migrate @ 5040]
Removed wgaim_created_backwin
| 3127 | 1 | /* -------------------------------------------------------------------------- |
| 2 | * | |
| 3 | * License | |
| 2086 | 4 | * |
| 3127 | 5 | * The contents of this file are subject to the Jabber Open Source License |
| 6 | * Version 1.0 (the "JOSL"). You may not copy or use this file, in either | |
| 7 | * source code or executable form, except in compliance with the JOSL. You | |
| 8 | * may obtain a copy of the JOSL at http://www.jabber.org/ or at | |
| 9 | * http://www.opensource.org/. | |
| 2086 | 10 | * |
| 3127 | 11 | * Software distributed under the JOSL is distributed on an "AS IS" basis, |
| 12 | * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the JOSL | |
| 13 | * for the specific language governing rights and limitations under the | |
| 14 | * JOSL. | |
| 2086 | 15 | * |
| 3127 | 16 | * Copyrights |
| 17 | * | |
| 18 | * Portions created by or assigned to Jabber.com, Inc. are | |
| 19 | * Copyright (c) 1999-2002 Jabber.com, Inc. All Rights Reserved. Contact | |
| 20 | * information for Jabber.com, Inc. is available at http://www.jabber.com/. | |
| 21 | * | |
| 22 | * Portions Copyright (c) 1998-1999 Jeremie Miller. | |
| 23 | * | |
| 24 | * Acknowledgements | |
| 25 | * | |
| 26 | * Special thanks to the Jabber Open Source Contributors for their | |
| 27 | * suggestions and support of Jabber. | |
| 28 | * | |
| 29 | * Alternatively, the contents of this file may be used under the terms of the | |
| 30 | * GNU General Public License Version 2 or later (the "GPL"), in which case | |
| 31 | * the provisions of the GPL are applicable instead of those above. If you | |
| 32 | * wish to allow use of your version of this file only under the terms of the | |
| 33 | * GPL and not to allow others to use your version of this file under the JOSL, | |
| 34 | * indicate your decision by deleting the provisions above and replace them | |
| 35 | * with the notice and other provisions required by the GPL. If you do not | |
| 36 | * delete the provisions above, a recipient may use your version of this file | |
| 37 | * under either the JOSL or the GPL. | |
| 38 | * | |
| 39 | * | |
| 40 | * --------------------------------------------------------------------------*/ | |
| 2086 | 41 | |
| 3127 | 42 | #include "lib.h" |
| 2086 | 43 | |
| 3127 | 44 | /*** stubs that hook back to new xhash */ |
| 2086 | 45 | |
| 3127 | 46 | HASHTABLE ghash_create(int buckets, KEYHASHFUNC hash, KEYCOMPAREFUNC cmp) |
| 2086 | 47 | { |
| 3127 | 48 | return xhash_new(buckets); |
| 2086 | 49 | } |
| 50 | ||
| 3127 | 51 | HASHTABLE ghash_create_pool(pool p, int buckets, KEYHASHFUNC hash, KEYCOMPAREFUNC cmp) |
| 2086 | 52 | { |
| 3127 | 53 | xht h = xhash_new(buckets); |
| 54 | pool_cleanup(p, (pool_cleaner)xhash_free, h); | |
| 55 | return h; | |
| 56 | } | |
| 2086 | 57 | |
| 58 | void ghash_destroy(HASHTABLE tbl) | |
| 59 | { | |
| 3127 | 60 | xhash_free(tbl); |
| 61 | } | |
| 2086 | 62 | |
| 63 | void *ghash_get(HASHTABLE tbl, const void *key) | |
| 64 | { | |
| 3127 | 65 | return xhash_get(tbl, key); |
| 66 | } | |
| 2086 | 67 | |
| 68 | int ghash_put(HASHTABLE tbl, const void *key, void *value) | |
| 69 | { | |
| 3127 | 70 | xhash_put(tbl, key, value); |
| 71 | return 1; | |
| 72 | } | |
| 2086 | 73 | |
| 74 | int ghash_remove(HASHTABLE tbl, const void *key) | |
| 75 | { | |
| 3127 | 76 | xhash_zap(tbl, key); |
| 77 | return 1; | |
| 78 | } | |
| 2086 | 79 | |
| 80 | ||
| 81 | int ghash_walk(HASHTABLE tbl, TABLEWALKFUNC func, void *user_data) | |
| 3127 | 82 | { |
| 83 | int i; | |
| 84 | xhn n; | |
| 85 | xht h = (xht)tbl; | |
| 2086 | 86 | |
| 3127 | 87 | for(i = 0; i < h->prime; i++) |
| 88 | for(n = &h->zen[i]; n != NULL; n = n->next) | |
| 89 | if(n->key != NULL && n->val != NULL) | |
| 90 | (*func)(user_data, n->key, n->val); | |
| 2086 | 91 | |
| 3127 | 92 | return 1; |
| 93 | } | |
| 2086 | 94 | |
| 95 | ||
| 3127 | 96 | int _xhasher(const char *key); |
| 2086 | 97 | int str_hash_code(const char *s) |
| 98 | { | |
| 3127 | 99 | return _xhasher(s); |
| 100 | } | |
| 2086 | 101 |