From 9a0d0df33ddcbc690e919d1765720fcf23a97b08 Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Tue, 21 Mar 2023 11:21:22 +0100 Subject: [PATCH] Use path_has_prefix in loom.c --- src/emu/loom.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/emu/loom.c b/src/emu/loom.c index ab063d7..bdbac2b 100644 --- a/src/emu/loom.c +++ b/src/emu/loom.c @@ -30,19 +30,10 @@ set_hostname(char host[PATH_MAX], const char name[PATH_MAX]) host[i] = '\0'; } -static int -has_prefix(const char *path, const char *prefix) -{ - if (strncmp(path, prefix, strlen(prefix)) != 0) - return 0; - - return 1; -} - int loom_matches(const char *path) { - return has_prefix(path, loom_prefix); + return path_has_prefix(path, loom_prefix); } int @@ -50,7 +41,7 @@ loom_init_begin(struct loom *loom, const char *name) { memset(loom, 0, sizeof(struct loom)); - if (!has_prefix(name, loom_prefix)) { + if (!path_has_prefix(name, loom_prefix)) { err("loom name must start with '%s': %s", loom_prefix, name); return -1; }