Thread (1 message) 1 message, 1 author, 2021-04-09

Re: [PATCH 2/2] object.c: initialize automatic variable in lookup_object()

From: Junio C Hamano <hidden>
Date: 2021-04-09 22:32:34

Jeff King [off-list ref] writes:
quoted
 struct object *lookup_object(struct repository *r, const struct object_id *oid)
 {
 	unsigned int i, first;
-	struct object *obj;
+	struct object *obj = NULL;
 
 	if (!r->parsed_objects->obj_hash)
-		return NULL;
+		return obj;
I actually prefer the original style (where any "can we bail early"
checks just explicitly return NULL, rather than making you check to see
that obj is NULL).
Perhaps I should return "me too" here.


Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help