Replace parse_blob() with an explanatory comment
parse_blob() has never actually been used; it has served simply to avoid having a confusing gap in the API. Instead of leaving it, put in a comment that explains what "parsing a blob" entails (making sure the object is actually readable), and why code might care whether a blob has been parsed or not. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Daniel Barkalow committed
Jan 18, 2010 at 13:06 UTC
837d395a5c0b98ab938d71db8e2b6b9f69ddcc4d
2 files changed
+8
-22
blob.c
-21
@@ -23,24 +23,3 @@ int parse_blob_buffer(struct blob *item, void *buffer, unsigned long size)
23
item->object.parsed = 1;
24
return 0;
25
}
26
-
27
-int parse_blob(struct blob *item)
28
-{
29
- enum object_type type;
30
- void *buffer;
31
- unsigned long size;
32
- int ret;
33
-
34
- if (item->object.parsed)
35
- return 0;
36
- buffer = read_sha1_file(item->object.sha1, &type, &size);
37
- if (!buffer)
38
- return error("Could not read %s",
39
- sha1_to_hex(item->object.sha1));
40
- if (type != OBJ_BLOB)
41
- return error("Object %s not a blob",
42
- sha1_to_hex(item->object.sha1));
43
- ret = parse_blob_buffer(item, buffer, size);
44
- free(buffer);
45
- return ret;
46
-}
blob.h
+8
-1
@@ -13,6 +13,13 @@ struct blob *lookup_blob(const unsigned char *sha1);
13
14
int parse_blob_buffer(struct blob *item, void *buffer, unsigned long size);
15
16
-int parse_blob(struct blob *item);
16
+/**
17
+ * Blobs do not contain references to other objects and do not have
18
+ * structured data that needs parsing. However, code may use the
19
+ * "parsed" bit in the struct object for a blob to determine whether
20
+ * its content has been found to actually be available, so
21
+ * parse_blob_buffer() is used (by object.c) to flag that the object
22
+ * has been read successfully from the database.
23
+ **/
24
25
#endif /* BLOB_H */