# [PATCH] unpack-trees: improve maintainability

1 messages from 2013-06-07 to 2013-06-07. Participants: Felipe Contreras.
Thread: https://gitlist.dev/t/34058

## Felipe Contreras, 2013-06-07 22:23

Subject: [PATCH] unpack-trees: improve maintainability
Message-ID: <1370643787-3687-1-git-send-email-felipe.contreras@gmail.com>
URL: https://gitlist.dev/e/1370643787-3687-1-git-send-email-felipe.contreras%40gmail.com

```
Clarify that ce can be NULL by adding a check (probably more efficient
also), and get rid of unnecessary indentation (since it's a single line
it doesn't matter, but in the future it might).

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
---
 unpack-trees.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/unpack-trees.c b/unpack-trees.c
index 57b4074..9c0100d 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -605,8 +605,9 @@ static int unpack_nondirectories(int n, unsigned long mask,
 					o);
 		for (i = 0; i < n; i++) {
 			struct cache_entry *ce = src[i + o->merge];
-			if (ce != o->df_conflict_entry)
-				free(ce);
+			if (!ce || ce == o->df_conflict_entry)
+				continue;
+			free(ce);
 		}
 		return rc;
 	}
-- 
1.8.3.698.g079b096

```
