Git development
 help / color / mirror / Atom feed
* [PATCH 04/19] Migrate update-cache.c to use the new cache api's
@ 2005-04-21 18:35 Brad Roberts
  0 siblings, 0 replies; only message in thread
From: Brad Roberts @ 2005-04-21 18:35 UTC (permalink / raw)
  To: git

tree 34f7fc89e28a40387e811057065592ed2f0218a2
parent d70686e08f453199e5451b27fc7d0b36b73a5c7f
author Brad Roberts <braddr@puremagic.com> 1114073784 -0700
committer Brad Roberts <braddr@gameboy2.puremagic.com> 1114073784 -0700

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

Signed-off-by: Brad Roberts <braddr@puremagic.com>
---

 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);
 	}
 }
 


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-04-21 18:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-21 18:35 [PATCH 04/19] Migrate update-cache.c to use the new cache api's Brad Roberts

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox