45 #define HASH_TABLE_SIZE 127
46 #define HASH_TABLE_INITVAL 77557755
133 uint8_t *
teoMapAdd(
teoMap *map,
const uint8_t *key,
size_t key_length,
const uint8_t *data,
147 inline uint8_t *teoMapAddStr(
teoMap *map,
const char *key,
const uint8_t *data,
148 size_t data_length) {
149 return teoMapAdd(map, (
const uint8_t*)key, strlen(key) + 1, data, data_length);
153 size_t *data_length);
165 inline uint8_t *teoMapGetStr(
teoMap *map,
const char *key,
size_t *data_length) {
166 return teoMapGet(map, (
const uint8_t*)key, strlen(key) + 1, data_length);
179 inline int teoMapDeleteStr(
teoMap *map,
const char *key) {
180 return teoMapDelete(map, (
const uint8_t*)key, strlen(key) + 1);
199 return map_it ? map_it->
tmv : NULL;
210 size_t *key_length) {
223 size_t *data_length) {
teoMap * map
Definition: map.h:70
uint8_t * teoMapGet(teoMap *map, const uint8_t *key, size_t key_length, size_t *data_length)
Get key data from hash table.
Definition: map.c:345
uint32_t collisions
Definition: map.h:53
teoQueue ** q
Definition: map.h:51
size_t data_length
Definition: map.h:62
size_t hash_map_size
Definition: map.h:54
struct teoMapIterator teoMapIterator
size_t key_length
Definition: map.h:61
int(* teoMapForeachFunction)(teoMap *m, int idx, teoMapElementData *d, void *user_data)
Definition: map.h:228
teoMap * teoMapNew(size_t size, int auto_resize_f)
Create new map.
Definition: map.c:65
teoMapElementData * tmv
Definition: map.h:72
int teoMapDelete(teoMap *map, const uint8_t *key, size_t key_length)
Delete keys element from map.
Definition: map.c:373
teoMapIterator * teoMapIteratorReverseNew(teoMap *map)
Create new map reverse iterator.
Definition: map.c:432
teoMapIterator * teoMapIteratorNew(teoMap *map)
Create new map iterator.
Definition: map.c:402
teoMapElementData * teoMapIteratorNext(teoMapIterator *map_it)
Get next maps element.
Definition: map.c:477
int teoMapForeach(teoMap *m, teoMapForeachFunction callback, void *user_data)
Loop through map and call callback function with index and data in parameters.
Definition: map.c:537
size_t length
Definition: map.h:50
size_t teoMapSize(teoMap *map)
Get number of elements in TR-UPD map.
Definition: map.c:54
uint8_t * teoMapAdd(teoMap *map, const uint8_t *key, size_t key_length, const uint8_t *data, size_t data_length)
Add (or update) key data to the map.
Definition: map.c:282
uint32_t hash
Definition: map.h:60
void teoMapClear(teoMap *map)
Definition: map.c:171
uint8_t data[]
Definition: map.h:63
void teoMapDestroy(teoMap *map)
Destroy map.
Definition: map.c:161
uint32_t idx
Definition: map.h:69
int teoMapIteratorFree(teoMapIterator *map_it)
Destroy map iterator.
Definition: map.c:462
int auto_resize_f
Definition: map.h:52
uint8_t * teoMapGetFirst(teoMap *map, size_t *data_length)
Get first available element from hash table.
Definition: map.c:246
teoQueueIterator it
Definition: map.h:71
void teoMapIteratorReverseReset(teoMapIterator *map_it, teoMap *map)
Reset map iterator.
Definition: map.c:446
void teoMapIteratorReset(teoMapIterator *map_it, teoMap *map)
Reset map iterator.
Definition: map.c:416
teoMapElementData * teoMapIteratorPrev(teoMapIterator *map_it)
Get previous maps element.
Definition: map.c:506
struct teoMapElementData teoMapElementData