diff options
| author | Franklin Wei <git@fwei.tk> | 2015-12-26 21:02:54 -0500 |
|---|---|---|
| committer | Franklin Wei <git@fwei.tk> | 2015-12-26 21:03:15 -0500 |
| commit | 0a2f9197058cc5248ec8e4bed7c361397c8d1c79 (patch) | |
| tree | b4ac31dcaa64bdfded9cdb2450bf936904802d08 /src/hash.h | |
| parent | f7041112f179aa79b6e315e7d57afbf76d3cd8bb (diff) | |
| download | netcosm-0a2f9197058cc5248ec8e4bed7c361397c8d1c79.zip netcosm-0a2f9197058cc5248ec8e4bed7c361397c8d1c79.tar.gz netcosm-0a2f9197058cc5248ec8e4bed7c361397c8d1c79.tar.bz2 netcosm-0a2f9197058cc5248ec8e4bed7c361397c8d1c79.tar.xz | |
stuff mostly works, need to fix error on client exit
Diffstat (limited to 'src/hash.h')
| -rw-r--r-- | src/hash.h | 23 |
1 files changed, 22 insertions, 1 deletions
@@ -1,3 +1,21 @@ +/* + * NetCosm - a MUD server + * Copyright (C) 2015 Franklin Wei + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + #include <stdbool.h> #include <stddef.h> @@ -9,6 +27,9 @@ int compare_strings(const void*, const void*); void *hash_init(size_t tabsz, unsigned (*hash_fn)(const void*), int (*compare_key)(const void*, const void*)); +void hash_setfreedata_cb(void*, void (*cb)(void *data)); +void hash_setfreekey_cb(void*, void (*cb)(void *key)); + void hash_free(void*); /* insert a pair, returns null if not already found, otherwise @@ -18,7 +39,7 @@ void *hash_insert(void*, const void *key, const void *data); /* returns NULL if not found */ void *hash_lookup(void*, const void *key); -bool hash_remove(void *ptr, void *key); +bool hash_remove(void *ptr, const void *key); /* use like you would strtok_r */ /* allocates a buffer that's freed once all elements are processed */ |