git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Shrink "struct object" a bit

From
PPPhilip Pokorny <ppokorny@mindspring.com>
Date
Jun 17, 2006, 15:36 UTC
Message-ID
<44942176.1070107@mindspring.com>
In-Reply-To
<Pine.LNX.4.64.0606141630570.5498@g5.osdl.org>
Linus Torvalds wrote:
Show 16 quoted lines
>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;
> 			}
> 		}
>  
>
Show 14 quoted lines
>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)
Previous: Linus TorvaldsNext: Linus Torvalds
Message 2 of 3 in “Shrink "struct object" a bit”
  1. Linus TorvaldsJun 14, 2006
  2. Philip PokornyJun 17, 2006
  3. Linus TorvaldsJun 17, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.