File src/filetype.c changed (mode: 100644) (index fda3eb77f..fb00685bf) |
... |
... |
static void register_assoc(assoc_t assoc, int for_x, int in_x); |
44 |
44 |
static assoc_records_t clone_all_matching_records(const char file[], |
static assoc_records_t clone_all_matching_records(const char file[], |
45 |
45 |
const assoc_list_t *record_list); |
const assoc_list_t *record_list); |
46 |
46 |
static int add_assoc(assoc_list_t *assoc_list, assoc_t assoc); |
static int add_assoc(assoc_list_t *assoc_list, assoc_t assoc); |
47 |
|
static void assoc_viewers(matchers_t *matchers, const assoc_records_t *viewers); |
|
48 |
47 |
static assoc_records_t clone_assoc_records(const assoc_records_t *records, |
static assoc_records_t clone_assoc_records(const assoc_records_t *records, |
49 |
48 |
const char pattern[], const assoc_list_t *dst); |
const char pattern[], const assoc_list_t *dst); |
50 |
49 |
static void reset_all_lists(void); |
static void reset_all_lists(void); |
|
... |
... |
void |
300 |
299 |
ft_set_viewers(matchers_t *matchers, const char viewers[]) |
ft_set_viewers(matchers_t *matchers, const char viewers[]) |
301 |
300 |
{ |
{ |
302 |
301 |
assoc_records_t view_records = parse_command_list(viewers, 0); |
assoc_records_t view_records = parse_command_list(viewers, 0); |
303 |
|
assoc_viewers(matchers, &view_records); |
|
304 |
|
ft_assoc_records_free(&view_records); |
|
305 |
|
} |
|
306 |
302 |
|
|
307 |
|
/* Associates pattern with the list of viewers. */ |
|
308 |
|
static void |
|
309 |
|
assoc_viewers(matchers_t *matchers, const assoc_records_t *viewers) |
|
310 |
|
{ |
|
311 |
303 |
const assoc_t assoc = { |
const assoc_t assoc = { |
312 |
304 |
.matchers = matchers, |
.matchers = matchers, |
313 |
|
.records = clone_assoc_records(viewers, matchers_get_expr(matchers), |
|
|
305 |
|
.records = clone_assoc_records(&view_records, matchers_get_expr(matchers), |
314 |
306 |
&fileviewers), |
&fileviewers), |
315 |
307 |
}; |
}; |
|
308 |
|
ft_assoc_records_free(&view_records); |
316 |
309 |
|
|
317 |
310 |
(void)add_assoc(&fileviewers, assoc); |
(void)add_assoc(&fileviewers, assoc); |
318 |
311 |
} |
} |