1 #ifndef EL__UTIL_FASTFIND_H
2 #define EL__UTIL_FASTFIND_H
4 /** Whether to use these routines or not. */
13 struct fastfind_key_value
{
20 FF_CASE_AWARE
= 1, /**< honour case when comparing */
21 FF_COMPRESS
= 2, /**< compress nodes if possible */
24 struct fastfind_index
{
25 /** Description useful for debugging mode. */
26 unsigned char *comment
;
29 /** Get next struct fastfind_key_value in line. */
30 struct fastfind_key_value
*(*next
)(void);
31 /** Internal reference */
35 #define INIT_FASTFIND_INDEX(comment, reset, next) \
36 { (comment), (reset), (next) }
38 /** Initialize and index a list of keys.
39 * Keys are iterated using:
40 * @param index index info
41 * @param flags control case sensitivity, compression
43 * This function must be called once and only once per list.
44 * Failure is not an option, so call it at startup.
45 * @relates fastfind_index */
46 struct fastfind_index
*fastfind_index(struct fastfind_index
*index
, enum fastfind_flags flags
);
48 /* The main reason of all that stuff is here. */
49 /** Search the index for @a key with length @a key_len using the
50 * @a index' handle created with fastfind_index().
51 * @relates fastfind_index */
52 void *fastfind_search(struct fastfind_index
*index
,
53 const unsigned char *key
, int key_len
);
55 /** Fastfind cleanup. It frees the given @a index.
56 * Must be called once per list.
57 * @relates fastfind_index */
58 void fastfind_done(struct fastfind_index
*index
);
62 #endif /* EL__UTIL_FASTFIND_H */