summaryrefslogtreecommitdiff
path: root/src/til.c
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2023-06-02 19:09:25 -0700
committerVito Caputo <vcaputo@pengaru.com>2023-06-03 07:42:02 -0700
commit6ef13be4e8d27f237406d6485d8dfe623db03a5f (patch)
tree87b7f6b19ad8c67d28b02e3ac9333318b87a857f /src/til.c
parent401cfce3ebb205e46b4582fc6be1a0d42e213d31 (diff)
til: add exclusions to til_get_module_names()
There's often a need to exclude specific modules, though it's often a hacky kludge. It's something relied upon currently for preventing dangerous recursion scenarios, which will likely get fixed up more robustly in the future.
Diffstat (limited to 'src/til.c')
-rw-r--r--src/til.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/til.c b/src/til.c
index d006926..66f4870 100644
--- a/src/til.c
+++ b/src/til.c
@@ -167,7 +167,7 @@ void til_get_modules(const til_module_t ***res_modules, size_t *res_n_modules)
}
-char * til_get_module_names(unsigned flags_excluded)
+char * til_get_module_names(unsigned flags_excluded, const char **exclusions)
{
const til_module_t **modules;
size_t n_modules;
@@ -183,10 +183,21 @@ char * til_get_module_names(unsigned flags_excluded)
til_get_modules(&modules, &n_modules);
for (size_t i = 0, j = 0; i < n_modules; i++) {
const til_module_t *mod = modules[i];
+ const char **exclusion = exclusions;
if ((mod->flags & flags_excluded))
continue;
+ while (*exclusion) {
+ if (!strcmp(*exclusion, mod->name))
+ break;
+
+ exclusion++;
+ }
+
+ if (*exclusion)
+ continue;
+
fprintf(fp, "%s%s", j ? "," : "", mod->name);
j++;
}
© All Rights Reserved