DORMANTno replies

[PATCH 04/19] Migrate update-cache.c to use the new cache api's

From: Brad Roberts <hidden>
Date: 2016-06-15 22:41:53

tree 34f7fc89e28a40387e811057065592ed2f0218a2
parent d70686e08f453199e5451b27fc7d0b36b73a5c7f
author Brad Roberts [off-list ref] 1114073784 -0700
committer Brad Roberts [off-list ref] 1114073784 -0700

[PATCH] Migrate update-cache.c to use the new cache api's

Signed-off-by: Brad Roberts <redacted>
---

 read-cache.c   |    3 +++
 update-cache.c |   13 +++++--------
 2 files changed, 8 insertions(+), 8 deletions(-)

Index: read-cache.c
===================================================================
--- d70686e08f453199e5451b27fc7d0b36b73a5c7f:1/read-cache.c  (mode:100644 sha1:6689df59d5a93e0503d7c80c114efbd16de826f3)
+++ 40bf732f5bcb986943070a2ed6c09a16543d81be:1/read-cache.c  (mode:100644 sha1:8eaa05957a481b09116c37e43e16c5ef4e219a1e)
@@ -122,6 +122,9 @@
 
 void set_cache_entry(struct cache_entry *ce, int pos)
 {
+	/* You can NOT just free active_cache[i] here, since it
+	 * might not be necessarily malloc()ed but can also come
+	 * from mmap(). */
 	active_cache[pos] = ce;
 }
 
Index: update-cache.c
===================================================================
--- d70686e08f453199e5451b27fc7d0b36b73a5c7f:1/update-cache.c  (mode:100644 sha1:585951108c57a64bb774114d289d81fd7fd22768)
+++ 40bf732f5bcb986943070a2ed6c09a16543d81be:1/update-cache.c  (mode:100644 sha1:e741f593eb9c56c596fabed7eb6b79dee2d8cba9)
@@ -204,13 +204,13 @@
 {
 	int i;
 
-	for (i = 0; i < active_nr; i++) {
+	for (i = 0; i < get_num_cache_entries(); i++) {
 		struct cache_entry *ce, *new;
-		ce = active_cache[i];
+		ce = get_cache_entry(i);
 		if (ce_stage(ce)) {
 			printf("%s: needs merge\n", ce->name);
-			while ((i < active_nr) &&
-			       ! strcmp(active_cache[i]->name, ce->name))
+			while ((i < get_num_cache_entries()) &&
+			       ! strcmp(get_cache_entry(i)->name, ce->name))
 				i++;
 			i--;
 			continue;
@@ -221,10 +221,7 @@
 			printf("%s: needs update\n", ce->name);
 			continue;
 		}
-		/* You can NOT just free active_cache[i] here, since it
-		 * might not be necessarily malloc()ed but can also come
-		 * from mmap(). */
-		active_cache[i] = new;
+		set_cache_entry(new, i);
 	}
 }
 
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help