projects
/
git.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Some more memory leak avoidance
[git.git]
/
builtin-grep.c
diff --git
a/builtin-grep.c
b/builtin-grep.c
index
5fac570
..
9806499
100644
(file)
--- a/
builtin-grep.c
+++ b/
builtin-grep.c
@@
-630,10
+630,9
@@
static int grep_tree(struct grep_opt *opt, const char **paths,
static int grep_object(struct grep_opt *opt, const char **paths,
struct object *obj, const char *name)
{
static int grep_object(struct grep_opt *opt, const char **paths,
struct object *obj, const char *name)
{
- if (
!strcmp(obj->type, blob_type)
)
+ if (
obj->type == TYPE_BLOB
)
return grep_sha1(opt, obj->sha1, name);
return grep_sha1(opt, obj->sha1, name);
- if (!strcmp(obj->type, commit_type) ||
- !strcmp(obj->type, tree_type)) {
+ if (obj->type == TYPE_COMMIT || obj->type == TYPE_TREE) {
struct tree_desc tree;
void *data;
int hit;
struct tree_desc tree;
void *data;
int hit;
@@
-646,7
+645,7
@@
static int grep_object(struct grep_opt *opt, const char **paths,
free(data);
return hit;
}
free(data);
return hit;
}
- die("unable to grep from object of type %s",
obj->type
);
+ die("unable to grep from object of type %s",
typename(obj->type)
);
}
static const char builtin_grep_usage[] =
}
static const char builtin_grep_usage[] =