@matheusbsbs / matheus-bagliano / commits / 8e44025925
Fork 0

Use blob_, commit_, tag_, and tree_type throughout.

This replaces occurences of "blob", "commit", "tag", and "tree", where they're really used as type specifiers, which we already have defined global constants for. Signed-off-by: Peter Eriksen <s022018@student.dtu.dk> Signed-off-by: Junio C Hamano <junkio@cox.net>

Peter Eriksen committed Apr 2, 2006 at 14:44 UTC 8e4402592574d630cdb5ab4f55a1b7131802ff72
23 files changed +102 -69
apply.c
+3 -2
@@ -9,6 +9,7 @@
9 #include <fnmatch.h>
10 #include "cache.h"
11 #include "quote.h"
12 +#include "blob.h"
13
14 // --check turns on checking that the working tree matches the
15 // files that are being modified, but doesn't apply the patch
@@ -1296,7 +1297,7 @@ static int apply_fragments(struct buffer_desc *desc, struct patch *patch)
1297 * applies to.
1298 */
1299 write_sha1_file_prepare(desc->buffer, desc->size,
1299 - "blob", sha1, hdr, &hdrlen);
1300 + blob_type, sha1, hdr, &hdrlen);
1301 if (strcmp(sha1_to_hex(sha1), patch->old_sha1_prefix))
1302 return error("the patch applies to '%s' (%s), "
1303 "which does not match the "
@@ -1659,7 +1660,7 @@ static void add_index_file(const char *path, unsigned mode, void *buf, unsigned
1660 if (lstat(path, &st) < 0)
1661 die("unable to stat newly created file %s", path);
1662 fill_stat_cache_info(ce, &st);
1662 - if (write_sha1_file(buf, size, "blob", ce->sha1) < 0)
1663 + if (write_sha1_file(buf, size, blob_type, ce->sha1) < 0)
1664 die("unable to create backing store for newly created file %s", path);
1665 if (add_cache_entry(ce, ADD_CACHE_OK_TO_ADD) < 0)
1666 die("unable to add cache entry for %s", path);
blame.c
+1 -1
@@ -229,7 +229,7 @@ static void get_blob(struct commit *commit)
229
230 info->buf = read_sha1_file(info->sha1, type, &info->size);
231
232 - assert(!strcmp(type, "blob"));
232 + assert(!strcmp(type, blob_type));
233 }
234
235 /* For debugging only */
cat-file.c
+4 -2
@@ -5,6 +5,8 @@
5 */
6 #include "cache.h"
7 #include "exec_cmd.h"
8 +#include "tag.h"
9 +#include "tree.h"
10
11 static void flush_buffer(const char *buf, unsigned long size)
12 {
@@ -136,13 +138,13 @@ int main(int argc, char **argv)
138 die("Not a valid object name %s", argv[2]);
139
140 /* custom pretty-print here */
139 - if (!strcmp(type, "tree"))
141 + if (!strcmp(type, tree_type))
142 return execl_git_cmd("ls-tree", argv[2], NULL);
143
144 buf = read_sha1_file(sha1, type, &size);
145 if (!buf)
146 die("Cannot read object %s", argv[2]);
145 - if (!strcmp(type, "tag"))
147 + if (!strcmp(type, tag_type))
148 return pprint_tag(sha1, buf, size);
149
150 /* otherwise just spit out the data */
combine-diff.c
+2 -1
@@ -1,5 +1,6 @@
1 #include "cache.h"
2 #include "commit.h"
3 +#include "blob.h"
4 #include "diff.h"
5 #include "diffcore.h"
6 #include "quote.h"
@@ -104,7 +105,7 @@ static char *grab_blob(const unsigned char *sha1, unsigned long *size)
105 return xcalloc(1, 1);
106 }
107 blob = read_sha1_file(sha1, type, size);
107 - if (strcmp(type, "blob"))
108 + if (strcmp(type, blob_type))
109 die("object '%s' is not a blob!", sha1_to_hex(sha1));
110 return blob;
111 }
commit-tree.c
+5 -3
@@ -4,6 +4,8 @@
4 * Copyright (C) Linus Torvalds, 2005
5 */
6 #include "cache.h"
7 +#include "commit.h"
8 +#include "tree.h"
9
10 #define BLOCKING (1ul << 14)
11
@@ -93,13 +95,13 @@ int main(int argc, char **argv)
95 if (argc < 2 || get_sha1_hex(argv[1], tree_sha1) < 0)
96 usage(commit_tree_usage);
97
96 - check_valid(tree_sha1, "tree");
98 + check_valid(tree_sha1, tree_type);
99 for (i = 2; i < argc; i += 2) {
100 char *a, *b;
101 a = argv[i]; b = argv[i+1];
102 if (!b || strcmp(a, "-p") || get_sha1(b, parent_sha1[parents]))
103 usage(commit_tree_usage);
102 - check_valid(parent_sha1[parents], "commit");
104 + check_valid(parent_sha1[parents], commit_type);
105 if (new_parent(parents))
106 parents++;
107 }
@@ -125,7 +127,7 @@ int main(int argc, char **argv)
127 while (fgets(comment, sizeof(comment), stdin) != NULL)
128 add_buffer(&buffer, &size, "%s", comment);
129
128 - if (!write_sha1_file(buffer, size, "commit", commit_sha1)) {
130 + if (!write_sha1_file(buffer, size, commit_type, commit_sha1)) {
131 printf("%s\n", sha1_to_hex(commit_sha1));
132 return 0;
133 }
convert-objects.c
+11 -8
@@ -2,6 +2,9 @@
2 #define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */
3 #include <time.h>
4 #include "cache.h"
5 +#include "blob.h"
6 +#include "commit.h"
7 +#include "tree.h"
8
9 struct entry {
10 unsigned char old_sha1[20];
@@ -122,7 +125,7 @@ static int write_subdirectory(void *buffer, unsigned long size, const char *base
125 buffer += len;
126 }
127
125 - write_sha1_file(new, newlen, "tree", result_sha1);
128 + write_sha1_file(new, newlen, tree_type, result_sha1);
129 free(new);
130 return used;
131 }
@@ -262,8 +265,8 @@ static void convert_date(void *buffer, unsigned long size, unsigned char *result
265 memcpy(new + newlen, buffer, size);
266 newlen += size;
267
265 - write_sha1_file(new, newlen, "commit", result_sha1);
266 - free(new);
268 + write_sha1_file(new, newlen, commit_type, result_sha1);
269 + free(new);
270 }
271
272 static void convert_commit(void *buffer, unsigned long size, unsigned char *result_sha1)
@@ -297,12 +300,12 @@ static struct entry * convert_entry(unsigned char *sha1)
300
301 buffer = xmalloc(size);
302 memcpy(buffer, data, size);
300 -
301 - if (!strcmp(type, "blob")) {
302 - write_sha1_file(buffer, size, "blob", entry->new_sha1);
303 - } else if (!strcmp(type, "tree"))
303 +
304 + if (!strcmp(type, blob_type)) {
305 + write_sha1_file(buffer, size, blob_type, entry->new_sha1);
306 + } else if (!strcmp(type, tree_type))
307 convert_tree(buffer, size, entry->new_sha1);
305 - else if (!strcmp(type, "commit"))
308 + else if (!strcmp(type, commit_type))
309 convert_commit(buffer, size, entry->new_sha1);
310 else
311 die("unknown object type '%s' in %s", type, sha1_to_hex(sha1));
diff-tree.c
+1 -1
@@ -52,7 +52,7 @@ static int diff_root_tree(const unsigned char *new, const char *base)
52 void *tree;
53 struct tree_desc empty, real;
54
55 - tree = read_object_with_reference(new, "tree", &real.size, NULL);
55 + tree = read_object_with_reference(new, tree_type, &real.size, NULL);
56 if (!tree)
57 die("unable to read root tree (%s)", sha1_to_hex(new));
58 real.buf = tree;
entry.c
+2 -1
@@ -1,6 +1,7 @@
1 #include <sys/types.h>
2 #include <dirent.h>
3 #include "cache.h"
4 +#include "blob.h"
5
6 static void create_directories(const char *path, struct checkout *state)
7 {
@@ -72,7 +73,7 @@ static int write_entry(struct cache_entry *ce, char *path, struct checkout *stat
73 char type[20];
74
75 new = read_sha1_file(ce->sha1, type, &size);
75 - if (!new || strcmp(type, "blob")) {
76 + if (!new || strcmp(type, blob_type)) {
77 if (new)
78 free(new);
79 return error("git-checkout-index: unable to read sha1 file of %s (%s)",
hash-object.c
+3 -2
@@ -2,9 +2,10 @@
2 * GIT - The information manager from hell
3 *
4 * Copyright (C) Linus Torvalds, 2005
5 - * Copyright (C) Junio C Hamano, 2005
5 + * Copyright (C) Junio C Hamano, 2005
6 */
7 #include "cache.h"
8 +#include "blob.h"
9
10 static void hash_object(const char *path, const char *type, int write_object)
11 {
@@ -35,7 +36,7 @@ static const char hash_object_usage[] =
36 int main(int argc, char **argv)
37 {
38 int i;
38 - const char *type = "blob";
39 + const char *type = blob_type;
40 int write_object = 0;
41 const char *prefix = NULL;
42 int prefix_length = -1;
index-pack.c
+8 -4
@@ -2,6 +2,10 @@
2 #include "delta.h"
3 #include "pack.h"
4 #include "csum-file.h"
5 +#include "blob.h"
6 +#include "commit.h"
7 +#include "tag.h"
8 +#include "tree.h"
9
10 static const char index_pack_usage[] =
11 "git-index-pack [-o index-file] pack-file";
@@ -224,10 +228,10 @@ static void sha1_object(const void *data, unsigned long size,
228 const char *type_str;
229
230 switch (type) {
227 - case OBJ_COMMIT: type_str = "commit"; break;
228 - case OBJ_TREE: type_str = "tree"; break;
229 - case OBJ_BLOB: type_str = "blob"; break;
230 - case OBJ_TAG: type_str = "tag"; break;
231 + case OBJ_COMMIT: type_str = commit_type; break;
232 + case OBJ_TREE: type_str = tree_type; break;
233 + case OBJ_BLOB: type_str = blob_type; break;
234 + case OBJ_TAG: type_str = tag_type; break;
235 default:
236 die("bad type %d", type);
237 }
ls-tree.c
+2 -2
@@ -56,7 +56,7 @@ static int show_tree(unsigned char *sha1, const char *base, int baselen,
56 const char *pathname, unsigned mode, int stage)
57 {
58 int retval = 0;
59 - const char *type = "blob";
59 + const char *type = blob_type;
60
61 if (S_ISDIR(mode)) {
62 if (show_recursive(base, baselen, pathname)) {
@@ -64,7 +64,7 @@ static int show_tree(unsigned char *sha1, const char *base, int baselen,
64 if (!(ls_options & LS_SHOW_TREES))
65 return retval;
66 }
67 - type = "tree";
67 + type = tree_type;
68 }
69 else if (ls_options & LS_TREE_ONLY)
70 return 0;
mktag.c
+2 -1
@@ -1,4 +1,5 @@
1 #include "cache.h"
2 +#include "tag.h"
3
4 /*
5 * A signature file has a very simple fixed format: three lines
@@ -126,7 +127,7 @@ int main(int argc, char **argv)
127 if (verify_tag(buffer, size) < 0)
128 die("invalid tag signature file");
129
129 - if (write_sha1_file(buffer, size, "tag", result_sha1) < 0)
130 + if (write_sha1_file(buffer, size, tag_type, result_sha1) < 0)
131 die("unable to write tag file");
132 printf("%s\n", sha1_to_hex(result_sha1));
133 return 0;
mktree.c
+2 -1
@@ -6,6 +6,7 @@
6 #include "cache.h"
7 #include "strbuf.h"
8 #include "quote.h"
9 +#include "tree.h"
10
11 static struct treeent {
12 unsigned mode;
@@ -67,7 +68,7 @@ static void write_tree(unsigned char *sha1)
68 memcpy(buffer + offset, ent->sha1, 20);
69 offset += 20;
70 }
70 - write_sha1_file(buffer, offset, "tree", sha1);
71 + write_sha1_file(buffer, offset, tree_type, sha1);
72 }
73
74 static const char mktree_usage[] = "mktree [-z]";
object.c
+4 -4
@@ -196,15 +196,15 @@ struct object *parse_object(const unsigned char *sha1)
196 struct object *obj;
197 if (check_sha1_signature(sha1, buffer, size, type) < 0)
198 printf("sha1 mismatch %s\n", sha1_to_hex(sha1));
199 - if (!strcmp(type, "blob")) {
199 + if (!strcmp(type, blob_type)) {
200 struct blob *blob = lookup_blob(sha1);
201 parse_blob_buffer(blob, buffer, size);
202 obj = &blob->object;
203 - } else if (!strcmp(type, "tree")) {
203 + } else if (!strcmp(type, tree_type)) {
204 struct tree *tree = lookup_tree(sha1);
205 parse_tree_buffer(tree, buffer, size);
206 obj = &tree->object;
207 - } else if (!strcmp(type, "commit")) {
207 + } else if (!strcmp(type, commit_type)) {
208 struct commit *commit = lookup_commit(sha1);
209 parse_commit_buffer(commit, buffer, size);
210 if (!commit->buffer) {
@@ -212,7 +212,7 @@ struct object *parse_object(const unsigned char *sha1)
212 buffer = NULL;
213 }
214 obj = &commit->object;
215 - } else if (!strcmp(type, "tag")) {
215 + } else if (!strcmp(type, tag_type)) {
216 struct tag *tag = lookup_tag(sha1);
217 parse_tag_buffer(tag, buffer, size);
218 obj = &tag->object;
pack-objects.c
+10 -6
@@ -1,5 +1,9 @@
1 #include "cache.h"
2 #include "object.h"
3 +#include "blob.h"
4 +#include "commit.h"
5 +#include "tag.h"
6 +#include "tree.h"
7 #include "delta.h"
8 #include "pack.h"
9 #include "csum-file.h"
@@ -603,7 +607,7 @@ static void add_pbase_tree(struct tree_desc *tree, struct name_path *up)
607 if (!add_object_entry(sha1, hash, 1))
608 continue;
609
606 - if (!strcmp(type, "tree")) {
610 + if (!strcmp(type, tree_type)) {
611 struct tree_desc sub;
612 void *elem;
613 struct name_path me;
@@ -626,7 +630,7 @@ static void add_preferred_base(unsigned char *sha1)
630 struct tree_desc tree;
631 void *elem;
632
629 - elem = read_object_with_reference(sha1, "tree", &tree.size, NULL);
633 + elem = read_object_with_reference(sha1, tree_type, &tree.size, NULL);
634 tree.buf = elem;
635 if (!tree.buf)
636 return;
@@ -684,13 +688,13 @@ static void check_object(struct object_entry *entry)
688 die("unable to get type of object %s",
689 sha1_to_hex(entry->sha1));
690
687 - if (!strcmp(type, "commit")) {
691 + if (!strcmp(type, commit_type)) {
692 entry->type = OBJ_COMMIT;
689 - } else if (!strcmp(type, "tree")) {
693 + } else if (!strcmp(type, tree_type)) {
694 entry->type = OBJ_TREE;
691 - } else if (!strcmp(type, "blob")) {
695 + } else if (!strcmp(type, blob_type)) {
696 entry->type = OBJ_BLOB;
693 - } else if (!strcmp(type, "tag")) {
697 + } else if (!strcmp(type, tag_type)) {
698 entry->type = OBJ_TAG;
699 } else
700 die("unable to pack object %s of type %s",
revision.c
+1 -1
@@ -260,7 +260,7 @@ int rev_same_tree_as_empty(struct tree *t1)
260 if (!t1)
261 return 0;
262
263 - tree = read_object_with_reference(t1->object.sha1, "tree", &real.size, NULL);
263 + tree = read_object_with_reference(t1->object.sha1, tree_type, &real.size, NULL);
264 if (!tree)
265 return 0;
266 real.buf = tree;
sha1_file.c
+22 -18
@@ -9,6 +9,10 @@
9 #include "cache.h"
10 #include "delta.h"
11 #include "pack.h"
12 +#include "blob.h"
13 +#include "commit.h"
14 +#include "tag.h"
15 +#include "tree.h"
16
17 #ifndef O_NOATIME
18 #if defined(__linux__) && (defined(__i386__) || defined(__PPC__))
@@ -894,16 +898,16 @@ void packed_object_info_detail(struct pack_entry *e,
898 }
899 switch (kind) {
900 case OBJ_COMMIT:
897 - strcpy(type, "commit");
901 + strcpy(type, commit_type);
902 break;
903 case OBJ_TREE:
900 - strcpy(type, "tree");
904 + strcpy(type, tree_type);
905 break;
906 case OBJ_BLOB:
903 - strcpy(type, "blob");
907 + strcpy(type, blob_type);
908 break;
909 case OBJ_TAG:
906 - strcpy(type, "tag");
910 + strcpy(type, tag_type);
911 break;
912 default:
913 die("corrupted pack file %s containing object of kind %d",
@@ -934,16 +938,16 @@ static int packed_object_info(struct pack_entry *entry,
938 unuse_packed_git(p);
939 return retval;
940 case OBJ_COMMIT:
937 - strcpy(type, "commit");
941 + strcpy(type, commit_type);
942 break;
943 case OBJ_TREE:
940 - strcpy(type, "tree");
944 + strcpy(type, tree_type);
945 break;
946 case OBJ_BLOB:
943 - strcpy(type, "blob");
947 + strcpy(type, blob_type);
948 break;
949 case OBJ_TAG:
946 - strcpy(type, "tag");
950 + strcpy(type, tag_type);
951 break;
952 default:
953 die("corrupted pack file %s containing object of kind %d",
@@ -1071,16 +1075,16 @@ void *unpack_entry_gently(struct pack_entry *entry,
1075 retval = unpack_delta_entry(pack, size, left, type, sizep, p);
1076 return retval;
1077 case OBJ_COMMIT:
1074 - strcpy(type, "commit");
1078 + strcpy(type, commit_type);
1079 break;
1080 case OBJ_TREE:
1077 - strcpy(type, "tree");
1081 + strcpy(type, tree_type);
1082 break;
1083 case OBJ_BLOB:
1080 - strcpy(type, "blob");
1084 + strcpy(type, blob_type);
1085 break;
1086 case OBJ_TAG:
1083 - strcpy(type, "tag");
1087 + strcpy(type, tag_type);
1088 break;
1089 default:
1090 return NULL;
@@ -1241,9 +1245,9 @@ void *read_object_with_reference(const unsigned char *sha1,
1245 return buffer;
1246 }
1247 /* Handle references */
1244 - else if (!strcmp(type, "commit"))
1248 + else if (!strcmp(type, commit_type))
1249 ref_type = "tree ";
1246 - else if (!strcmp(type, "tag"))
1250 + else if (!strcmp(type, tag_type))
1251 ref_type = "object ";
1252 else {
1253 free(buffer);
@@ -1625,7 +1629,7 @@ int index_pipe(unsigned char *sha1, int fd, const char *type, int write_object)
1629 return -1;
1630 }
1631 if (!type)
1628 - type = "blob";
1632 + type = blob_type;
1633 if (write_object)
1634 ret = write_sha1_file(buf, off, type, sha1);
1635 else {
@@ -1652,7 +1656,7 @@ int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object, con
1656 return -1;
1657
1658 if (!type)
1655 - type = "blob";
1659 + type = blob_type;
1660 if (write_object)
1661 ret = write_sha1_file(buf, size, type, sha1);
1662 else {
@@ -1690,9 +1694,9 @@ int index_path(unsigned char *sha1, const char *path, struct stat *st, int write
1694 if (!write_object) {
1695 unsigned char hdr[50];
1696 int hdrlen;
1693 - write_sha1_file_prepare(target, st->st_size, "blob",
1697 + write_sha1_file_prepare(target, st->st_size, blob_type,
1698 sha1, hdr, &hdrlen);
1695 - } else if (write_sha1_file(target, st->st_size, "blob", sha1))
1699 + } else if (write_sha1_file(target, st->st_size, blob_type, sha1))
1700 return error("%s: failed to insert into database",
1701 path);
1702 free(target);
tar-tree.c
+1 -1
@@ -335,7 +335,7 @@ int main(int argc, char **argv)
335 } else
336 archive_time = time(NULL);
337
338 - tree.buf = read_object_with_reference(sha1, "tree", &tree.size,
338 + tree.buf = read_object_with_reference(sha1, tree_type, &tree.size,
339 tree_sha1);
340 if (!tree.buf)
341 die("not a reference to a tag, commit or tree object: %s",
tree-diff.c
+4 -3
@@ -3,6 +3,7 @@
3 */
4 #include "cache.h"
5 #include "diff.h"
6 +#include "tree.h"
7
8 // What paths are we interested in?
9 static int nr_paths = 0;
@@ -148,7 +149,7 @@ static int show_entry(struct diff_options *opt, const char *prefix, struct tree_
149 void *tree;
150
151 tree = read_sha1_file(sha1, type, &inner.size);
151 - if (!tree || strcmp(type, "tree"))
152 + if (!tree || strcmp(type, tree_type))
153 die("corrupt tree sha %s", sha1_to_hex(sha1));
154
155 inner.buf = tree;
@@ -206,10 +207,10 @@ int diff_tree_sha1(const unsigned char *old, const unsigned char *new, const cha
207 struct tree_desc t1, t2;
208 int retval;
209
209 - tree1 = read_object_with_reference(old, "tree", &t1.size, NULL);
210 + tree1 = read_object_with_reference(old, tree_type, &t1.size, NULL);
211 if (!tree1)
212 die("unable to read source tree (%s)", sha1_to_hex(old));
212 - tree2 = read_object_with_reference(new, "tree", &t2.size, NULL);
213 + tree2 = read_object_with_reference(new, tree_type, &t2.size, NULL);
214 if (!tree2)
215 die("unable to read destination tree (%s)", sha1_to_hex(new));
216 t1.buf = tree1;
tree-walk.c
+2 -1
@@ -1,5 +1,6 @@
1 #include "cache.h"
2 #include "tree-walk.h"
3 +#include "tree.h"
4
5 void *fill_tree_descriptor(struct tree_desc *desc, const unsigned char *sha1)
6 {
@@ -7,7 +8,7 @@ void *fill_tree_descriptor(struct tree_desc *desc, const unsigned char *sha1)
8 void *buf = NULL;
9
10 if (sha1) {
10 - buf = read_object_with_reference(sha1, "tree", &size, NULL);
11 + buf = read_object_with_reference(sha1, tree_type, &size, NULL);
12 if (!buf)
13 die("unable to read tree %s", sha1_to_hex(sha1));
14 }
unpack-file.c
+2 -1
@@ -1,4 +1,5 @@
1 #include "cache.h"
2 +#include "blob.h"
3
4 static char *create_temp_file(unsigned char *sha1)
5 {
@@ -9,7 +10,7 @@ static char *create_temp_file(unsigned char *sha1)
10 int fd;
11
12 buf = read_sha1_file(sha1, type, &size);
12 - if (!buf || strcmp(type, "blob"))
13 + if (!buf || strcmp(type, blob_type))
14 die("unable to read blob object %s", sha1_to_hex(sha1));
15
16 strcpy(path, ".merge_file_XXXXXX");
unpack-objects.c
+8 -4
@@ -2,6 +2,10 @@
2 #include "object.h"
3 #include "delta.h"
4 #include "pack.h"
5 +#include "blob.h"
6 +#include "commit.h"
7 +#include "tag.h"
8 +#include "tree.h"
9
10 #include <sys/time.h>
11
@@ -148,10 +152,10 @@ static int unpack_non_delta_entry(enum object_type kind, unsigned long size)
152 const char *type;
153
154 switch (kind) {
151 - case OBJ_COMMIT: type = "commit"; break;
152 - case OBJ_TREE: type = "tree"; break;
153 - case OBJ_BLOB: type = "blob"; break;
154 - case OBJ_TAG: type = "tag"; break;
155 + case OBJ_COMMIT: type = commit_type; break;
156 + case OBJ_TREE: type = tree_type; break;
157 + case OBJ_BLOB: type = blob_type; break;
158 + case OBJ_TAG: type = tag_type; break;
159 default: die("bad type %d", kind);
160 }
161 if (!dry_run)
write-tree.c
+2 -1
@@ -4,6 +4,7 @@
4 * Copyright (C) Linus Torvalds, 2005
5 */
6 #include "cache.h"
7 +#include "tree.h"
8
9 static int missing_ok = 0;
10
@@ -78,7 +79,7 @@ static int write_tree(struct cache_entry **cachep, int maxentries, const char *b
79 nr++;
80 }
81
81 - write_sha1_file(buffer, offset, "tree", returnsha1);
82 + write_sha1_file(buffer, offset, tree_type, returnsha1);
83 free(buffer);
84 return nr;
85 }