[PATCH 1/2] blob.c: remove buffer & size arguments to parse_blob_buffer()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



As noted in the comment introduced in 837d395a5c0 (Replace
parse_blob() with an explanatory comment, 2010-01-18) the old
parse_blob() function and the current parse_blob_buffer() exist merely
to provide consistency in the API.

We're not going to parse blobs like we "parse" commits, trees or
tags. So let's not have the parse_blob_buffer() take arguments that
pretends that we do. Its only use is to set the "parsed" flag.

See bd2c39f58f9 ([PATCH] don't load and decompress objects twice with
parse_object(), 2005-05-06) for the introduction of parse_blob_buffer().

I'm moving the prototype of parse_blob_buffer() below the comment
added in 837d395a5c0 while I'm at it. That comment was originally
meant to be a replacement for the missing parse_blob() function, but
it's much less confusing to have it be above the parse_blob_buffer()
function it refers to.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx>
---
 blob.c   | 2 +-
 blob.h   | 3 +--
 object.c | 4 ++--
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/blob.c b/blob.c
index 182718aba9..389a7546dc 100644
--- a/blob.c
+++ b/blob.c
@@ -13,7 +13,7 @@ struct blob *lookup_blob(struct repository *r, const struct object_id *oid)
 	return object_as_type(obj, OBJ_BLOB, 0);
 }
 
-int parse_blob_buffer(struct blob *item, void *buffer, unsigned long size)
+int parse_blob_buffer(struct blob *item)
 {
 	item->object.parsed = 1;
 	return 0;
diff --git a/blob.h b/blob.h
index 1664872055..ac1d4804a5 100644
--- a/blob.h
+++ b/blob.h
@@ -11,8 +11,6 @@ struct blob {
 
 struct blob *lookup_blob(struct repository *r, const struct object_id *oid);
 
-int parse_blob_buffer(struct blob *item, void *buffer, unsigned long size);
-
 /**
  * Blobs do not contain references to other objects and do not have
  * structured data that needs parsing. However, code may use the
@@ -21,5 +19,6 @@ int parse_blob_buffer(struct blob *item, void *buffer, unsigned long size);
  * parse_blob_buffer() is used (by object.c) to flag that the object
  * has been read successfully from the database.
  **/
+int parse_blob_buffer(struct blob *item);
 
 #endif /* BLOB_H */
diff --git a/object.c b/object.c
index 78343781ae..63896abf01 100644
--- a/object.c
+++ b/object.c
@@ -195,7 +195,7 @@ struct object *parse_object_buffer(struct repository *r, const struct object_id
 	if (type == OBJ_BLOB) {
 		struct blob *blob = lookup_blob(r, oid);
 		if (blob) {
-			if (parse_blob_buffer(blob, buffer, size))
+			if (parse_blob_buffer(blob))
 				return NULL;
 			obj = &blob->object;
 		}
@@ -266,7 +266,7 @@ struct object *parse_object(struct repository *r, const struct object_id *oid)
 			error(_("hash mismatch %s"), oid_to_hex(oid));
 			return NULL;
 		}
-		parse_blob_buffer(lookup_blob(r, oid), NULL, 0);
+		parse_blob_buffer(lookup_blob(r, oid));
 		return lookup_object(r, oid);
 	}
 
-- 
2.31.1.584.gf4baedee75




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux