aboutsummaryrefslogtreecommitdiffstats
path: root/src/repo/s6rc_repo_removeinternals.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/repo/s6rc_repo_removeinternals.c')
-rw-r--r--src/repo/s6rc_repo_removeinternals.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/repo/s6rc_repo_removeinternals.c b/src/repo/s6rc_repo_removeinternals.c
new file mode 100644
index 0000000..8c3da8c
--- /dev/null
+++ b/src/repo/s6rc_repo_removeinternals.c
@@ -0,0 +1,17 @@
+/* ISC license. */
+
+#include <string.h>
+
+#include <skalibs/genalloc.h>
+
+#include <s6-rc/repo.h>
+
+void s6rc_repo_removeinternals (genalloc *ga, unsigned int start, char const *s)
+{
+ size_t *indices = genalloc_s(size_t, ga) ;
+ unsigned int n = genalloc_len(size_t, ga) ;
+ for (unsigned int i = start ; i < n ; i++)
+ if (!strncmp(s + indices[i], "s6rc-", 5) || !strncmp(s + indices[i], "s6-rc-", 6))
+ indices[i--] = indices[--n] ;
+ genalloc_setlen(size_t, ga, n) ;
+}