File src/filetype.c changed (mode: 100644) (index fb00685bf..a5bd21293) |
37 |
37 |
static const char * find_existing_cmd(const assoc_list_t *record_list, |
static const char * find_existing_cmd(const assoc_list_t *record_list, |
38 |
38 |
const char file[]); |
const char file[]); |
39 |
39 |
static assoc_record_t find_existing_cmd_record(const assoc_records_t *records); |
static assoc_record_t find_existing_cmd_record(const assoc_records_t *records); |
40 |
|
static void assoc_programs(matchers_t *matchers, |
|
41 |
|
const assoc_records_t *programs, int for_x, int in_x); |
|
42 |
40 |
static assoc_records_t parse_command_list(const char cmds[], int with_descr); |
static assoc_records_t parse_command_list(const char cmds[], int with_descr); |
43 |
41 |
static void register_assoc(assoc_t assoc, int for_x, int in_x); |
static void register_assoc(assoc_t assoc, int for_x, int in_x); |
44 |
42 |
static assoc_records_t clone_all_matching_records(const char file[], |
static assoc_records_t clone_all_matching_records(const char file[], |
|
... |
... |
ft_set_programs(matchers_t *matchers, const char programs[], int for_x, |
198 |
196 |
int in_x) |
int in_x) |
199 |
197 |
{ |
{ |
200 |
198 |
assoc_records_t prog_records = parse_command_list(programs, 1); |
assoc_records_t prog_records = parse_command_list(programs, 1); |
201 |
|
assoc_programs(matchers, &prog_records, for_x, in_x); |
|
202 |
|
ft_assoc_records_free(&prog_records); |
|
203 |
|
} |
|
204 |
199 |
|
|
205 |
|
/* Associates pattern with the list of programs either for X or non-X |
|
206 |
|
* associations and depending on current execution environment. */ |
|
207 |
|
static void |
|
208 |
|
assoc_programs(matchers_t *matchers, const assoc_records_t *programs, int for_x, |
|
209 |
|
int in_x) |
|
210 |
|
{ |
|
211 |
200 |
const assoc_t assoc = { |
const assoc_t assoc = { |
212 |
201 |
.matchers = matchers, |
.matchers = matchers, |
213 |
|
.records = clone_assoc_records(programs, matchers_get_expr(matchers), |
|
|
202 |
|
.records = clone_assoc_records(&prog_records, matchers_get_expr(matchers), |
214 |
203 |
for_x ? &xfiletypes : &filetypes), |
for_x ? &xfiletypes : &filetypes), |
215 |
204 |
}; |
}; |
|
205 |
|
ft_assoc_records_free(&prog_records); |
216 |
206 |
|
|
217 |
207 |
register_assoc(assoc, for_x, in_x); |
register_assoc(assoc, for_x, in_x); |
218 |
208 |
} |
} |