X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=attr.c;h=f5346ed32a1b5caf908021805214fd97e033eb27;hb=6ddf75ae5d0ff55844cd936a1b850ca9ae5abbe5;hp=55bdb7cdebea7f7ea551231fe7801f272d128d69;hpb=864cd9491772367b3ce5b0dda98f068e5bd49680;p=git.git diff --git a/attr.c b/attr.c index 55bdb7cde..f5346ed32 100644 --- 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);