Line
Link Here
|
0 |
-- a/src/search.h |
0 |
++ b/src/search.h |
Lines 31-39
Link Here
|
31 |
#include "uthash.h" |
31 |
#include "uthash.h" |
32 |
#include "util.h" |
32 |
#include "util.h" |
33 |
|
33 |
|
34 |
size_t alpha_skip_lookup[256]; |
34 |
extern size_t alpha_skip_lookup[256]; |
35 |
size_t *find_skip_lookup; |
35 |
extern size_t *find_skip_lookup; |
36 |
uint8_t h_table[H_SIZE] __attribute__((aligned(64))); |
36 |
extern uint8_t h_table[H_SIZE] __attribute__((aligned(64))); |
37 |
|
37 |
|
38 |
struct work_queue_t { |
38 |
struct work_queue_t { |
39 |
char *path; |
39 |
char *path; |
Lines 41-52
Link Here
|
41 |
}; |
41 |
}; |
42 |
typedef struct work_queue_t work_queue_t; |
42 |
typedef struct work_queue_t work_queue_t; |
43 |
|
43 |
|
44 |
work_queue_t *work_queue; |
44 |
extern work_queue_t *work_queue; |
45 |
work_queue_t *work_queue_tail; |
45 |
extern work_queue_t *work_queue_tail; |
46 |
int done_adding_files; |
46 |
extern int done_adding_files; |
47 |
pthread_cond_t files_ready; |
47 |
extern pthread_cond_t files_ready; |
48 |
pthread_mutex_t stats_mtx; |
48 |
extern pthread_mutex_t stats_mtx; |
49 |
pthread_mutex_t work_queue_mtx; |
49 |
extern pthread_mutex_t work_queue_mtx; |
50 |
|
50 |
|
51 |
|
51 |
|
52 |
/* For symlink loop detection */ |
52 |
/* For symlink loop detection */ |
Lines 64-70
Link Here
|
64 |
UT_hash_handle hh; |
64 |
UT_hash_handle hh; |
65 |
} symdir_t; |
65 |
} symdir_t; |
66 |
|
66 |
|
67 |
symdir_t *symhash; |
67 |
extern symdir_t *symhash; |
68 |
|
68 |
|
69 |
void search_buf(const char *buf, const size_t buf_len, |
69 |
void search_buf(const char *buf, const size_t buf_len, |
70 |
const char *dir_full_path); |
70 |
const char *dir_full_path); |
71 |
-- a/src/search.c |
71 |
++ b/src/search.c |
Lines 2-7
Link Here
|
2 |
#include "print.h" |
2 |
#include "print.h" |
3 |
#include "scandir.h" |
3 |
#include "scandir.h" |
4 |
|
4 |
|
|
|
5 |
size_t alpha_skip_lookup[256]; |
6 |
size_t *find_skip_lookup; |
7 |
uint8_t h_table[H_SIZE] __attribute__((aligned(64))); |
8 |
|
9 |
work_queue_t *work_queue; |
10 |
work_queue_t *work_queue_tail; |
11 |
int done_adding_files; |
12 |
pthread_cond_t files_ready; |
13 |
pthread_mutex_t stats_mtx; |
14 |
pthread_mutex_t work_queue_mtx; |
15 |
|
16 |
symdir_t *symhash; |
17 |
|
5 |
void search_buf(const char *buf, const size_t buf_len, |
18 |
void search_buf(const char *buf, const size_t buf_len, |
6 |
const char *dir_full_path) { |
19 |
const char *dir_full_path) { |
7 |
int binary = -1; /* 1 = yes, 0 = no, -1 = don't know */ |
20 |
int binary = -1; /* 1 = yes, 0 = no, -1 = don't know */ |
8 |
-- a/src/log.c |
21 |
++ b/src/log.c |
Lines 4-9
Link Here
|
4 |
#include "log.h" |
4 |
#include "log.h" |
5 |
#include "util.h" |
5 |
#include "util.h" |
6 |
|
6 |
|
|
|
7 |
pthread_mutex_t print_mtx; |
8 |
|
7 |
static enum log_level log_threshold = LOG_LEVEL_ERR; |
9 |
static enum log_level log_threshold = LOG_LEVEL_ERR; |
8 |
|
10 |
|
9 |
void set_log_level(enum log_level threshold) { |
11 |
void set_log_level(enum log_level threshold) { |
10 |
-- a/src/log.h |
12 |
++ b/src/log.h |
Lines 9-15
Link Here
|
9 |
#include <pthread.h> |
9 |
#include <pthread.h> |
10 |
#endif |
10 |
#endif |
11 |
|
11 |
|
12 |
pthread_mutex_t print_mtx; |
12 |
extern pthread_mutex_t print_mtx; |
13 |
|
13 |
|
14 |
enum log_level { |
14 |
enum log_level { |
15 |
LOG_LEVEL_DEBUG = 10, |
15 |
LOG_LEVEL_DEBUG = 10, |
16 |
-- a/src/options.h |
16 |
++ b/src/options.h |
Lines 91-97
Link Here
|
91 |
} cli_options; |
91 |
} cli_options; |
92 |
|
92 |
|
93 |
/* global options. parse_options gives it sane values, everything else reads from it */ |
93 |
/* global options. parse_options gives it sane values, everything else reads from it */ |
94 |
cli_options opts; |
94 |
extern cli_options opts; |
95 |
|
95 |
|
96 |
typedef struct option option_t; |
96 |
typedef struct option option_t; |
97 |
|
97 |
|
98 |
-- a/src/options.c |
98 |
++ b/src/options.c |
Lines 16-21
Link Here
|
16 |
#include "print.h" |
16 |
#include "print.h" |
17 |
#include "util.h" |
17 |
#include "util.h" |
18 |
|
18 |
|
|
|
19 |
cli_options opts; |
20 |
|
19 |
const char *color_line_number = "\033[1;33m"; /* bold yellow */ |
21 |
const char *color_line_number = "\033[1;33m"; /* bold yellow */ |
20 |
const char *color_match = "\033[30;43m"; /* black with yellow background */ |
22 |
const char *color_match = "\033[30;43m"; /* black with yellow background */ |
21 |
const char *color_path = "\033[1;32m"; /* bold green */ |
23 |
const char *color_path = "\033[1;32m"; /* bold green */ |
22 |
-- a/src/util.h |
24 |
++ b/src/util.h |
Lines 12-18
Link Here
|
12 |
#include "log.h" |
12 |
#include "log.h" |
13 |
#include "options.h" |
13 |
#include "options.h" |
14 |
|
14 |
|
15 |
FILE *out_fd; |
15 |
extern FILE *out_fd; |
16 |
|
16 |
|
17 |
#ifndef TRUE |
17 |
#ifndef TRUE |
18 |
#define TRUE 1 |
18 |
#define TRUE 1 |
Lines 51-57
Link Here
|
51 |
} ag_stats; |
51 |
} ag_stats; |
52 |
|
52 |
|
53 |
|
53 |
|
54 |
ag_stats stats; |
54 |
extern ag_stats stats; |
55 |
|
55 |
|
56 |
/* Union to translate between chars and words without violating strict aliasing */ |
56 |
/* Union to translate between chars and words without violating strict aliasing */ |
57 |
typedef union { |
57 |
typedef union { |
58 |
-- a/src/util.c |
58 |
++ b/src/util.c |
Lines 15-20
Link Here
|
15 |
#define getc_unlocked(x) getc(x) |
15 |
#define getc_unlocked(x) getc(x) |
16 |
#endif |
16 |
#endif |
17 |
|
17 |
|
|
|
18 |
FILE *out_fd; |
19 |
|
20 |
ag_stats stats; |
21 |
|
18 |
#define CHECK_AND_RETURN(ptr) \ |
22 |
#define CHECK_AND_RETURN(ptr) \ |
19 |
if (ptr == NULL) { \ |
23 |
if (ptr == NULL) { \ |
20 |
die("Memory allocation failed."); \ |
24 |
die("Memory allocation failed."); \ |
21 |
-- a/src/ignore.c |
25 |
++ b/src/ignore.c |
Lines 22-27
Link Here
|
22 |
|
22 |
|
23 |
/* TODO: build a huge-ass list of files we want to ignore by default (build cache stuff, pyc files, etc) */ |
23 |
/* TODO: build a huge-ass list of files we want to ignore by default (build cache stuff, pyc files, etc) */ |
24 |
|
24 |
|
|
|
25 |
ignores *root_ignores; |
26 |
|
25 |
const char *evil_hardcoded_ignore_files[] = { |
27 |
const char *evil_hardcoded_ignore_files[] = { |
26 |
".", |
28 |
".", |
27 |
"..", |
29 |
"..", |
28 |
-- a/src/ignore.h |
30 |
++ b/src/ignore.h |
Lines 29-35
Link Here
|
29 |
}; |
29 |
}; |
30 |
typedef struct ignores ignores; |
30 |
typedef struct ignores ignores; |
31 |
|
31 |
|
32 |
ignores *root_ignores; |
32 |
extern ignores *root_ignores; |
33 |
|
33 |
|
34 |
extern const char *evil_hardcoded_ignore_files[]; |
34 |
extern const char *evil_hardcoded_ignore_files[]; |
35 |
extern const char *ignore_pattern_files[]; |
35 |
extern const char *ignore_pattern_files[]; |