Re: Shrink "struct object" a bit

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

 



Linus Torvalds wrote:

This shrinks "struct object" by a small amount, by getting rid of the "struct type *" pointer and replacing it with a 3-bit bitfield instead.

@@ -179,9 +179,7 @@ static int loop(void)
		 */
		if (! (obj->flags & TO_SCAN)) {
			if (fetch(obj->sha1)) {
-				report_missing(obj->type
-					       ? obj->type
-					       : "object", obj->sha1);
+				report_missing(typename(obj->type), obj->sha1);
				return -1;
			}
		}

diff --git a/object.c b/object.c
index 9adc874..0f70890 100644
--- a/object.c
+++ b/object.c
@@ -9,6 +9,10 @@ struct object **objs;
static int nr_objs;
int obj_allocs;

+const char *type_names[] = {
+	"none", "blob", "tree", "commit", "bad"
+};
+

A minor thing, but doesn't this mean the "report_missing" message would change from:

> Cannot obtain needed object ab12cdef1234567890abcd
> while processing commit fedcbadeadbeefdeadbe

to

> Cannot obtain needed none ab12cdef1234567890abcd
> while processing commit fedcbadeadbeefdeadbe

in some cases? I'm not sure that it's possible for the type value to be unspecified at this point in the code, but it seemed like the output from report_missing would be confusing if this ever happened.

:v)
-
: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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]