Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH] Fix some sparse warnings

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:58:12

Stefan Beller [off-list ref] writes:
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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help