~elementary-os/ubuntu-package-imports/evince-xenial

« back to all changes in this revision

Viewing changes to backend/dvi/mdvi-lib/hash.h

  • Committer: RabbitBot
  • Date: 2016-02-14 17:15:54 UTC
  • Revision ID: rabbitbot@elementary.io-20160214171554-hwytsmdwuuuzb1qd
Initial import, version 3.18.2-1ubuntu1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef MDVI_HASH
 
2
#define MDVI_HASH
 
3
 
 
4
/* Hash tables */
 
5
 
 
6
 
 
7
typedef struct _DviHashBucket DviHashBucket;
 
8
typedef struct _DviHashTable DviHashTable;
 
9
 
 
10
/*
 
11
 * Hash tables
 
12
 */
 
13
 
 
14
typedef Uchar   *DviHashKey;
 
15
#define MDVI_KEY(x)     ((DviHashKey)(x))
 
16
 
 
17
typedef Ulong   (*DviHashFunc) __PROTO((DviHashKey key));
 
18
typedef int     (*DviHashComp) __PROTO((DviHashKey key1, DviHashKey key2));
 
19
typedef void    (*DviHashFree) __PROTO((DviHashKey key, void *data));
 
20
 
 
21
 
 
22
struct _DviHashTable {
 
23
        DviHashBucket   **buckets;
 
24
        int     nbucks;
 
25
        int     nkeys;
 
26
        DviHashFunc hash_func;
 
27
        DviHashComp hash_comp;
 
28
        DviHashFree hash_free;
 
29
};
 
30
#define MDVI_EMPTY_HASH_TABLE {NULL, 0, 0, NULL, NULL, NULL}
 
31
 
 
32
#define MDVI_HASH_REPLACE       0
 
33
#define MDVI_HASH_UNIQUE        1
 
34
#define MDVI_HASH_UNCHECKED     2
 
35
 
 
36
extern void mdvi_hash_init __PROTO((DviHashTable *));
 
37
extern void mdvi_hash_create __PROTO((DviHashTable *, int));
 
38
extern int  mdvi_hash_add __PROTO((DviHashTable *, DviHashKey, void *, int));
 
39
extern int  mdvi_hash_destroy_key __PROTO((DviHashTable *, DviHashKey));
 
40
extern void mdvi_hash_reset __PROTO((DviHashTable *, int));
 
41
extern void *mdvi_hash_lookup __PROTO((DviHashTable *, DviHashKey));
 
42
extern void *mdvi_hash_remove __PROTO((DviHashTable *, DviHashKey));
 
43
extern void *mdvi_hash_remove_ptr __PROTO((DviHashTable *, DviHashKey));
 
44
 
 
45
#define mdvi_hash_flush(h)      mdvi_hash_reset((h), 1)
 
46
#define mdvi_hash_destroy(h)    mdvi_hash_reset((h), 0)
 
47
 
 
48
#endif
 
49