]> git.proxmox.com Git - libgit2.git/commitdiff
move entry_is_tree to tree.h
authorClemens Buchacher <drizzd@aon.at>
Fri, 30 Dec 2011 18:03:55 +0000 (19:03 +0100)
committerClemens Buchacher <drizzd@aon.at>
Fri, 30 Dec 2011 19:14:01 +0000 (20:14 +0100)
src/tree.c
src/tree.h

index b698a8a247dd589a5a13985d250726c4988c0d7d..50a9afae0197a771810500c1584b07c884159e40 100644 (file)
@@ -15,8 +15,6 @@
 #define MAX_FILEMODE 0777777
 #define MAX_FILEMODE_BYTES 6
 
-#define ENTRY_IS_TREE(e) ((e)->attr & 040000)
-
 static int valid_attributes(const int attributes)
 {
        return attributes >= 0 && attributes <= MAX_FILEMODE;
@@ -33,8 +31,8 @@ static int entry_sort_cmp(const void *a, const void *b)
        const git_tree_entry *entry_b = (const git_tree_entry *)(b);
 
        return git_futils_cmp_path(
-               entry_a->filename, entry_a->filename_len, ENTRY_IS_TREE(entry_a),
-               entry_b->filename, entry_b->filename_len, ENTRY_IS_TREE(entry_b));
+               entry_a->filename, entry_a->filename_len, entry_is_tree(entry_a),
+               entry_b->filename, entry_b->filename_len, entry_is_tree(entry_b));
 }
 
 
@@ -717,7 +715,7 @@ static int tree_walk_post(
                if (callback(path->ptr, entry, payload) < 0)
                        continue;
 
-               if (ENTRY_IS_TREE(entry)) {
+               if (entry_is_tree(entry)) {
                        git_tree *subtree;
                        size_t path_len = path->size;
 
@@ -980,7 +978,7 @@ static int diff_index_cb(const char *root, git_tree_entry *tentry, void *data)
        git_buf fn_buf = GIT_BUF_INIT;
        int cmp, error = GIT_SUCCESS;
 
-       if (ENTRY_IS_TREE(tentry))
+       if (entry_is_tree(tentry))
                return GIT_SUCCESS;
 
        git_buf_puts(&fn_buf, root);
index 4f8c07f08d668128605926ac2c64c0dbf389c17c..6b2a7d36ddad0cab2349616d8d0d795e5754c387 100644 (file)
@@ -31,6 +31,11 @@ struct git_treebuilder {
 };
 
 
+GIT_INLINE(unsigned int) entry_is_tree(const struct git_tree_entry *e)
+{
+       return e->attr & 040000;
+}
+
 void git_tree__free(git_tree *tree);
 int git_tree__parse(git_tree *tree, git_odb_object *obj);