{"thread":{"id":"34058","subject":"[PATCH] unpack-trees: improve maintainability","startedAt":"2013-06-07T22:23:07Z","lastAt":"2013-06-07T22:23:07Z","messageCount":1,"participants":["Felipe Contreras"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"219754","messageId":"1370643787-3687-1-git-send-email-felipe.contreras@gmail.com","threadId":"34058","inReplyTo":null,"subject":"[PATCH] unpack-trees: improve maintainability","fromName":"Felipe Contreras","fromEmail":"felipe.contreras@gmail.com","sentAt":"2013-06-07T22:23:07Z","receivedAt":"2013-06-07T22:23:07Z","isPatch":true,"sender":{"key":"felipe.contreras@gmail.com","avatar":"https://avatars.githubusercontent.com/u/8358?v=4"},"body":"Clarify that ce can be NULL by adding a check (probably more efficient\nalso), and get rid of unnecessary indentation (since it's a single line\nit doesn't matter, but in the future it might).\n\nSigned-off-by: Felipe Contreras <felipe.contreras@gmail.com>\n---\n unpack-trees.c | 5 +++--\n 1 file changed, 3 insertions(+), 2 deletions(-)\n\ndiff --git a/unpack-trees.c b/unpack-trees.c\nindex 57b4074..9c0100d 100644\n--- a/unpack-trees.c\n+++ b/unpack-trees.c\n@@ -605,8 +605,9 @@ static int unpack_nondirectories(int n, unsigned long mask,\n \t\t\t\t\to);\n \t\tfor (i = 0; i < n; i++) {\n \t\t\tstruct cache_entry *ce = src[i + o->merge];\n-\t\t\tif (ce != o->df_conflict_entry)\n-\t\t\t\tfree(ce);\n+\t\t\tif (!ce || ce == o->df_conflict_entry)\n+\t\t\t\tcontinue;\n+\t\t\tfree(ce);\n \t\t}\n \t\treturn rc;\n \t}\n-- \n1.8.3.698.g079b096\n"}]}