summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: dea4562)
raw | patch | inline | side by side (parent: dea4562)
author | Junio C Hamano <gitster@pobox.com> | |
Sun, 17 Jan 2010 04:39:59 +0000 (20:39 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Sun, 17 Jan 2010 04:39:59 +0000 (20:39 -0800) |
The function took (name, namelen) as its arguments, but all the public
callers wanted to pass a full string.
Demote the counted-string interface to an internal API status, and allow
public callers to just pass the string to the function.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
callers wanted to pass a full string.
Demote the counted-string interface to an internal API status, and allow
public callers to just pass the string to the function.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
archive.c | patch | blob | history | |
attr.c | patch | blob | history | |
attr.h | patch | blob | history | |
builtin-check-attr.c | patch | blob | history | |
builtin-pack-objects.c | patch | blob | history | |
convert.c | patch | blob | history | |
ll-merge.c | patch | blob | history | |
userdiff.c | patch | blob | history | |
ws.c | patch | blob | history |
diff --git a/archive.c b/archive.c
index 55b273246e006ad55c51d3e5cb6bed3153ae8cf4..a9ebdc5d54fba9010b9eaa52f5a9eb2b0cef0dc4 100644 (file)
--- a/archive.c
+++ b/archive.c
static struct git_attr *attr_export_subst;
if (!attr_export_ignore) {
- attr_export_ignore = git_attr("export-ignore", 13);
- attr_export_subst = git_attr("export-subst", 12);
+ attr_export_ignore = git_attr("export-ignore");
+ attr_export_subst = git_attr("export-subst");
}
check[0].attr = attr_export_ignore;
check[1].attr = attr_export_subst;
index 55bdb7cdebea7f7ea551231fe7801f272d128d69..f5346ed32a1b5caf908021805214fd97e033eb27 100644 (file)
--- a/attr.c
+++ b/attr.c
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;
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
*
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);
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);
index 69b5767ebc2189a8bf9d98ff88c1885ec8fcdb7d..450f49d648a013ffddc6321b7fd79b3fc1b66f7a 100644 (file)
--- a/attr.h
+++ b/attr.h
* Given a string, return the gitattribute object that
* corresponds to it.
*/
-struct git_attr *git_attr(const char *, int);
+struct git_attr *git_attr(const char *);
/* Internal use */
extern const char git_attr__true[];
diff --git a/builtin-check-attr.c b/builtin-check-attr.c
index 8bd043009829fb4bb40cd2f730cbffa27c3791cf..3016d29caa610caf4618e9bc1684a532fd3a18a1 100644 (file)
--- a/builtin-check-attr.c
+++ b/builtin-check-attr.c
const char *name;
struct git_attr *a;
name = argv[i];
- a = git_attr(name, strlen(name));
+ a = git_attr(name);
if (!a)
return error("%s: not a valid attribute name", name);
check[i].attr = a;
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c
index 4429d53a1e82b81f0a82e34bf2d6ae463aeeadee..9beff352d5076b6350991d24579b6f9b57d018d5 100644 (file)
--- a/builtin-pack-objects.c
+++ b/builtin-pack-objects.c
static struct git_attr *attr_delta;
if (!attr_delta)
- attr_delta = git_attr("delta", 5);
+ attr_delta = git_attr("delta");
check[0].attr = attr_delta;
}
diff --git a/convert.c b/convert.c
index 491e7141b4ea29b3cf754cbaf2656a0c3ca8c46c..852fd6488aa44d25a9219bebc09990477354d168 100644 (file)
--- a/convert.c
+++ b/convert.c
static struct git_attr *attr_filter;
if (!attr_crlf) {
- attr_crlf = git_attr("crlf", 4);
- attr_ident = git_attr("ident", 5);
- attr_filter = git_attr("filter", 6);
+ attr_crlf = git_attr("crlf");
+ attr_ident = git_attr("ident");
+ attr_filter = git_attr("filter");
user_convert_tail = &user_convert;
git_config(read_convert_config, NULL);
}
diff --git a/ll-merge.c b/ll-merge.c
index 2d6b6d6cb1d2bc2d334bf058feb3444e94b5a781..f4b0a0737723d879b1ddfea9376f1644bff029c7 100644 (file)
--- a/ll-merge.c
+++ b/ll-merge.c
static struct git_attr_check attr_merge_check;
if (!attr_merge_check.attr)
- attr_merge_check.attr = git_attr("merge", 5);
+ attr_merge_check.attr = git_attr("merge");
if (git_checkattr(path, 1, &attr_merge_check))
return NULL;
diff --git a/userdiff.c b/userdiff.c
index 57529ae63d49826952b29860b3d4106b60250c7b..df992490d5f86b5eff2b87e90090b1ec576aae9a 100644 (file)
--- a/userdiff.c
+++ b/userdiff.c
struct git_attr_check check;
if (!attr)
- attr = git_attr("diff", 4);
+ attr = git_attr("diff");
check.attr = attr;
if (!path)
index 760b5743fa11f25dd4facf8beeb02e7aa28d09e1..c0893386e6c8aa3af002e847d228dfc5ef64a9cf 100644 (file)
--- a/ws.c
+++ b/ws.c
static struct git_attr *attr_whitespace;
if (!attr_whitespace)
- attr_whitespace = git_attr("whitespace", 10);
+ attr_whitespace = git_attr("whitespace");
check[0].attr = attr_whitespace;
}