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

Re: [PATCH] Fix some sparse warnings

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 17, 2013, 23:22 UTC
Message-ID
<7vd2qg6abf.fsf@alter.siamese.dyndns.org>
In-Reply-To
<51E715D8.9040307@googlemail.com>
Stefan Beller <stefanbeller@googlemail.com> writes:
Show 16 quoted lines
> And the parse_object_buffer looks like this with respect to the eaten 
> variable:
> 	struct object *parse_object_buffer(...)
> 	{
> 		int eaten = 0;
> 		if (something)
> 			return NULL;
> 		...
> 		if (something_different)
> 			eaten=1;
> 		*eaten_p = eaten;
> 	}
> ...
> Was there a particular idea or goal behind first having a local eaten
> variable, which later near the correct return of the function was used to set the 
> eaten_p?

I didn't run "blame" to see the evolution of this function, but I suspect that the original code, when the "eaten" local variable was introduced, very much tried to do exactly what you suspect. The early return codepaths you see in today's code may be much newer, added without much thinking about the exact issue you are bringing up.

Previous: Stefan BellerNext: Ramsay Jones
Message 11 of 12 in “Fix some sparse warnings”
  1. Fix some sparse warningsRamsay Jones, Jul 15, 2013
  2. Johannes SixtJul 16, 2013
  3. Jeff KingJul 16, 2013
  4. Philip OakleyJul 16, 2013
  5. Stefan BellerJul 16, 2013
  6. Philip OakleyJul 16, 2013
  7. Johannes SixtJul 17, 2013
  8. Stefan BellerJul 17, 2013
  9. parse_object_buffer: Correct freeing the buffer.Stefan Beller, Jul 17, 2013
  10. Stefan BellerJul 17, 2013
  11. Junio C HamanoJul 17, 2013
  12. Ramsay JonesJul 18, 2013

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.