]> git.ipfire.org Git - thirdparty/git.git/blobdiff - urlmatch.c
convert trivial uses of strncmp() to starts_with()
[thirdparty/git.git] / urlmatch.c
index b615adc923ae019b756e25a1cdcfb251333e69ff..620a648efc5e81ac8b233153ae504ba145d6ee8f 100644 (file)
@@ -209,7 +209,7 @@ static char *url_normalize_1(const char *url, struct url_info *out_info, char al
         */
        if (!url_len || strchr(":/?#", *url)) {
                /* Missing host invalid for all URL schemes except file */
-               if (strncmp(norm.buf, "file:", 5)) {
+               if (!starts_with(norm.buf, "file:")) {
                        if (out_info) {
                                out_info->url = NULL;
                                out_info->err = _("missing host and scheme is not 'file:'");
@@ -268,11 +268,11 @@ static char *url_normalize_1(const char *url, struct url_info *out_info, char al
                if (url == slash_ptr) {
                        /* Skip ":" port with no number, it's same as default */
                } else if (slash_ptr - url == 2 &&
-                          !strncmp(norm.buf, "http:", 5) &&
+                          starts_with(norm.buf, "http:") &&
                           !strncmp(url, "80", 2)) {
                        /* Skip http :80 as it's the default */
                } else if (slash_ptr - url == 3 &&
-                          !strncmp(norm.buf, "https:", 6) &&
+                          starts_with(norm.buf, "https:") &&
                           !strncmp(url, "443", 3)) {
                        /* Skip https :443 as it's the default */
                } else {