Convert ce_path_match() to use struct pathspec
[gitweb.git] / read-cache.c
index 4f2e890b01b0c27ef2e49080e1fd34bf67e969c7..8b2d537f0253ef33b0cd7bb90ec8f6f47b5b8307 100644 (file)
@@ -706,17 +706,18 @@ int ce_same_name(struct cache_entry *a, struct cache_entry *b)
        return ce_namelen(b) == len && !memcmp(a->name, b->name, len);
 }
 
-int ce_path_match(const struct cache_entry *ce, const char **pathspec)
+int ce_path_match(const struct cache_entry *ce, const struct pathspec *pathspec)
 {
        const char *match, *name;
+       const char **ps = pathspec->raw;
        int len;
 
-       if (!pathspec)
+       if (!pathspec->nr)
                return 1;
 
        len = ce_namelen(ce);
        name = ce->name;
-       while ((match = *pathspec++) != NULL) {
+       while ((match = *ps++) != NULL) {
                int matchlen = strlen(match);
                if (matchlen > len)
                        continue;