-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.h
37 lines (26 loc) · 771 Bytes
/
index.h
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
34
35
36
37
#ifndef _INDEX_H
#define _INDEX_H
#define _GNU_SOURCE
#include <stdint.h>
#include <stdbool.h>
#include <unistd.h>
#include <sys/time.h>
#define MAX(a,b) ({ a > b ? a : b; })
typedef struct timeval timeval;
typedef struct Index {
size_t max_string_size;
size_t symbols;
size_t nodes;
size_t words;
void* head;
} Index_t;
timeval utils_get_time();
double utils_get_time_duration_ms(timeval start);
size_t utils_trim_line(char* line, size_t size);
Index_t* index_create();
Index_t* index_create_from_file(char* filename, bool dump);
void index_destroy(Index_t* index);
void index_insert(Index_t* index, const char* string, size_t size);
bool index_find(Index_t* index, const char* string, size_t size);
void index_dump(Index_t* index);
#endif