diff options
author | John Mark Bell <jmb@netsurf-browser.org> | 2008-11-30 16:35:19 +0000 |
---|---|---|
committer | John Mark Bell <jmb@netsurf-browser.org> | 2008-11-30 16:35:19 +0000 |
commit | aa0aa44aaab4b0693400dc4307822ac493014224 (patch) | |
tree | 0fbce8307517d84a2f1eb1a295778e8dd6fff6d4 /include/parserutils | |
parent | 7712c61effc3ef39d0b9eaf060049d11441884bf (diff) | |
download | libparserutils-aa0aa44aaab4b0693400dc4307822ac493014224.tar.gz libparserutils-aa0aa44aaab4b0693400dc4307822ac493014224.tar.bz2 |
New datastructures:
+ Chunked array
+ Hash table (open addressing)
Constify parameter to parserutils_stack_push
svn path=/trunk/libparserutils/; revision=5850
Diffstat (limited to 'include/parserutils')
-rw-r--r-- | include/parserutils/utils/hash.h | 31 | ||||
-rw-r--r-- | include/parserutils/utils/stack.h | 3 |
2 files changed, 33 insertions, 1 deletions
diff --git a/include/parserutils/utils/hash.h b/include/parserutils/utils/hash.h new file mode 100644 index 0000000..129c6f6 --- /dev/null +++ b/include/parserutils/utils/hash.h @@ -0,0 +1,31 @@ +/* + * This file is part of LibParserUtils. + * Licensed under the MIT License, + * http://www.opensource.org/licenses/mit-license.php + * Copyright 2008 John-Mark Bell <jmb@netsurf-browser.org> + */ + +#ifndef parserutils_utils_hash_h_ +#define parserutils_utils_hash_h_ + +#include <parserutils/errors.h> +#include <parserutils/functypes.h> + +typedef struct parserutils_hash_entry { + size_t len; + const uint8_t *data; +} parserutils_hash_entry; + +struct parserutils_hash; +typedef struct parserutils_hash parserutils_hash; + +parserutils_error parserutils_hash_create(parserutils_alloc alloc, void *pw, + parserutils_hash **hash); +parserutils_error parserutils_hash_destroy(parserutils_hash *hash); + +parserutils_error parserutils_hash_insert(parserutils_hash *hash, + const uint8_t *data, size_t len, + const parserutils_hash_entry **inserted); + +#endif + diff --git a/include/parserutils/utils/stack.h b/include/parserutils/utils/stack.h index 26262eb..58a3c19 100644 --- a/include/parserutils/utils/stack.h +++ b/include/parserutils/utils/stack.h @@ -20,7 +20,8 @@ parserutils_error parserutils_stack_create(size_t item_size, size_t chunk_size, parserutils_alloc alloc, void *pw, parserutils_stack **stack); parserutils_error parserutils_stack_destroy(parserutils_stack *stack); -parserutils_error parserutils_stack_push(parserutils_stack *stack, void *item); +parserutils_error parserutils_stack_push(parserutils_stack *stack, + const void *item); parserutils_error parserutils_stack_pop(parserutils_stack *stack, void *item); void *parserutils_stack_get_current(parserutils_stack *stack); |