t4209: use helper functions to test --grep
[gitweb.git] / daemon.c
index 13608c07c674171ace754154c5d1cb7dea6c5e04..503e03906c5c7f921e4d67a53835f771ea695d0c 100644 (file)
--- a/daemon.c
+++ b/daemon.c
@@ -235,7 +235,7 @@ static int service_enabled;
 
 static int git_daemon_config(const char *var, const char *value, void *cb)
 {
-       if (!prefixcmp(var, "daemon.") &&
+       if (starts_with(var, "daemon.") &&
            !strcmp(var + 7, service_looking_at->config_name)) {
                service_enabled = git_config_bool(var, value);
                return 0;
@@ -633,7 +633,7 @@ static int execute(void)
        for (i = 0; i < ARRAY_SIZE(daemon_service); i++) {
                struct daemon_service *s = &(daemon_service[i]);
                int namelen = strlen(s->name);
-               if (!prefixcmp(line, "git-") &&
+               if (starts_with(line, "git-") &&
                    !strncmp(s->name, line + 4, namelen) &&
                    line[namelen + 4] == ' ') {
                        /*
@@ -1165,11 +1165,11 @@ int main(int argc, char **argv)
        for (i = 1; i < argc; i++) {
                char *arg = argv[i];
 
-               if (!prefixcmp(arg, "--listen=")) {
+               if (starts_with(arg, "--listen=")) {
                        string_list_append(&listen_addr, xstrdup_tolower(arg + 9));
                        continue;
                }
-               if (!prefixcmp(arg, "--port=")) {
+               if (starts_with(arg, "--port=")) {
                        char *end;
                        unsigned long n;
                        n = strtoul(arg+7, &end, 0);
@@ -1199,19 +1199,19 @@ int main(int argc, char **argv)
                        export_all_trees = 1;
                        continue;
                }
-               if (!prefixcmp(arg, "--access-hook=")) {
+               if (starts_with(arg, "--access-hook=")) {
                        access_hook = arg + 14;
                        continue;
                }
-               if (!prefixcmp(arg, "--timeout=")) {
+               if (starts_with(arg, "--timeout=")) {
                        timeout = atoi(arg+10);
                        continue;
                }
-               if (!prefixcmp(arg, "--init-timeout=")) {
+               if (starts_with(arg, "--init-timeout=")) {
                        init_timeout = atoi(arg+15);
                        continue;
                }
-               if (!prefixcmp(arg, "--max-connections=")) {
+               if (starts_with(arg, "--max-connections=")) {
                        max_connections = atoi(arg+18);
                        if (max_connections < 0)
                                max_connections = 0;            /* unlimited */
@@ -1221,7 +1221,7 @@ int main(int argc, char **argv)
                        strict_paths = 1;
                        continue;
                }
-               if (!prefixcmp(arg, "--base-path=")) {
+               if (starts_with(arg, "--base-path=")) {
                        base_path = arg+12;
                        continue;
                }
@@ -1229,7 +1229,7 @@ int main(int argc, char **argv)
                        base_path_relaxed = 1;
                        continue;
                }
-               if (!prefixcmp(arg, "--interpolated-path=")) {
+               if (starts_with(arg, "--interpolated-path=")) {
                        interpolated_path = arg+20;
                        continue;
                }
@@ -1241,11 +1241,11 @@ int main(int argc, char **argv)
                        user_path = "";
                        continue;
                }
-               if (!prefixcmp(arg, "--user-path=")) {
+               if (starts_with(arg, "--user-path=")) {
                        user_path = arg + 12;
                        continue;
                }
-               if (!prefixcmp(arg, "--pid-file=")) {
+               if (starts_with(arg, "--pid-file=")) {
                        pid_file = arg + 11;
                        continue;
                }
@@ -1254,27 +1254,27 @@ int main(int argc, char **argv)
                        log_syslog = 1;
                        continue;
                }
-               if (!prefixcmp(arg, "--user=")) {
+               if (starts_with(arg, "--user=")) {
                        user_name = arg + 7;
                        continue;
                }
-               if (!prefixcmp(arg, "--group=")) {
+               if (starts_with(arg, "--group=")) {
                        group_name = arg + 8;
                        continue;
                }
-               if (!prefixcmp(arg, "--enable=")) {
+               if (starts_with(arg, "--enable=")) {
                        enable_service(arg + 9, 1);
                        continue;
                }
-               if (!prefixcmp(arg, "--disable=")) {
+               if (starts_with(arg, "--disable=")) {
                        enable_service(arg + 10, 0);
                        continue;
                }
-               if (!prefixcmp(arg, "--allow-override=")) {
+               if (starts_with(arg, "--allow-override=")) {
                        make_service_overridable(arg + 17, 1);
                        continue;
                }
-               if (!prefixcmp(arg, "--forbid-override=")) {
+               if (starts_with(arg, "--forbid-override=")) {
                        make_service_overridable(arg + 18, 0);
                        continue;
                }