]> rtime.felk.cvut.cz Git - git.git/blobdiff - attr.c
completion: --set-upstream option for git-branch
[git.git] / attr.c
diff --git a/attr.c b/attr.c
index 55bdb7cdebea7f7ea551231fe7801f272d128d69..f5346ed32a1b5caf908021805214fd97e033eb27 100644 (file)
--- a/attr.c
+++ b/attr.c
@@ -65,7 +65,7 @@ static int invalid_attr_name(const char *name, int namelen)
        return 0;
 }
 
-struct git_attr *git_attr(const char *name, int len)
+static struct git_attr *git_attr_internal(const char *name, int len)
 {
        unsigned hval = hash_name(name, len);
        unsigned pos = hval % HASHSIZE;
@@ -95,6 +95,11 @@ struct git_attr *git_attr(const char *name, int len)
        return a;
 }
 
+struct git_attr *git_attr(const char *name)
+{
+       return git_attr_internal(name, strlen(name));
+}
+
 /*
  * .gitattributes file is one line per record, each of which is
  *
@@ -162,7 +167,7 @@ static const char *parse_attr(const char *src, int lineno, const char *cp,
                else {
                        e->setto = xmemdupz(equals + 1, ep - equals - 1);
                }
-               e->attr = git_attr(cp, len);
+               e->attr = git_attr_internal(cp, len);
        }
        (*num_attr)++;
        return ep + strspn(ep, blank);
@@ -221,7 +226,7 @@ static struct match_attr *parse_attr_line(const char *line, const char *src,
                              sizeof(struct attr_state) * num_attr +
                              (is_macro ? 0 : namelen + 1));
                if (is_macro)
-                       res->u.attr = git_attr(name, namelen);
+                       res->u.attr = git_attr_internal(name, namelen);
                else {
                        res->u.pattern = (char *)&(res->state[num_attr]);
                        memcpy(res->u.pattern, name, namelen);