xaizek / vifm (License: GPLv2+) (since 2018-12-07)
Vifm is a file manager with curses interface, which provides Vi[m]-like environment for managing objects within file systems, extended with some useful ideas from mutt.
Commit adf697e49324f745882e75b3d7c9eb7fd89b173c

Inline filetype.c:assoc_programs()
No need to have this code in a separate function.
Author: xaizek
Author date (UTC): 2025-07-10 14:03
Committer name: xaizek
Committer date (UTC): 2025-07-10 14:03
Parent(s): ed6d989dc5270ebf0defcfb510692e0e3880cf47
Signing key: 99DC5E4DB05F6BE2
Tree: 464aa275e4df61fbeba9529fbb81fd728bd2d7c8
File Lines added Lines deleted
src/filetype.c 2 12
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 } }
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/vifm

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/vifm

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master