File: cxsa_hash_table.h

package info (click to toggle)
libclass-xsaccessor-perl 1.13-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 520 kB
  • sloc: perl: 841; ansic: 359; makefile: 6
file content (33 lines) | stat: -rw-r--r-- 966 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef cxsa_hash_table_h_
#define cxsa_hash_table_h_

#include "cxsa_memory.h"

#include "EXTERN.h"
#include "ppport.h"
#include "perl.h"

typedef struct HashTableEntry {
    struct HashTableEntry* next;
    const char* key;
    STRLEN len;
    void * value;
} HashTableEntry;

typedef struct {
    struct HashTableEntry** array;
    UV size;
    UV items;
    NV threshold;
} HashTable;

/* void * CXSA_HashTable_delete(HashTable* table, const char* key, STRLEN len); */
void * CXSA_HashTable_fetch(HashTable* table, const char* key, STRLEN len);
void * CXSA_HashTable_store(HashTable* table, const char* key, STRLEN len, void * value);
HashTableEntry* CXSA_HashTable_find(HashTable* table, const char* key, STRLEN len);
HashTable* CXSA_HashTable_new(UV size, NV threshold);
void CXSA_HashTable_clear(HashTable* table, bool do_release_values);
void CXSA_HashTable_free(HashTable* table, bool do_release_values);
void CXSA_HashTable_grow(HashTable* table);

#endif