{"thread":{"id":"207","subject":"[PATCH 01/19] write_cache api signature change, isolate active_cache and active_nr inside read-cache.c","startedAt":"2005-04-21T18:34:42Z","lastAt":"2005-04-21T18:34:42Z","messageCount":1,"participants":["Brad Roberts"],"isPatch":true,"patchVersion":1,"patchTotal":19},"messages":[{"id":"1155","messageId":"200504211834.j3LIYg1j026811@gameboy2.puremagic.com","threadId":"207","inReplyTo":null,"subject":"[PATCH 01/19] write_cache api signature change, isolate active_cache and active_nr inside read-cache.c","fromName":"Brad Roberts","fromEmail":"braddr@gameboy2.puremagic.com","sentAt":"2005-04-21T18:34:42Z","receivedAt":"2005-04-21T18:34:42Z","isPatch":true,"sender":{"key":"braddr@gameboy2.puremagic.com","avatar":null},"body":"tree f45fd10b26bf98349b63427805a96bd0551cad74\nparent 43fdf65356c50483233cb3d6e391b0849b2a2a50\nparent cd1c034369b73da7503da365fa556aab27004814\nauthor Brad Roberts <braddr@puremagic.com> 1114072582 -0700\ncommitter Brad Roberts <braddr@gameboy2.puremagic.com> 1114072582 -0700\n\n[PATCH] write_cache api signature change, isolate active_cache and active_nr inside read-cache.c\n\n\nSigned-off-by: Brad Roberts <braddr@puremagic.com>\n---\n\n cache.h        |    2 +-\n read-cache.c   |    8 ++++----\n read-tree.c    |    2 +-\n update-cache.c |    2 +-\n 4 files changed, 7 insertions(+), 7 deletions(-)\n\nIndex: cache.h\n===================================================================\n--- cd1c034369b73da7503da365fa556aab27004814:1/cache.h  (mode:100644 sha1:828d660ab82bb35a1ca632a2ba4620dc483889bd)\n+++ 77de9e0b7a81ddc22526c9415f0273171f631d3f:1/cache.h  (mode:100644 sha1:a101870e4a002a2548d88544a77bedad21668203)\n@@ -88,7 +88,7 @@\n \n /* Initialize and use the cache information */\n extern int read_cache(void);\n-extern int write_cache(int newfd, struct cache_entry **cache, int entries);\n+extern int write_cache(int newfd);\n extern int cache_name_pos(const char *name, int namelen);\n extern int add_cache_entry(struct cache_entry *ce, int ok_to_add);\n extern int remove_file_from_cache(char *path);\nIndex: read-cache.c\n===================================================================\n--- cd1c034369b73da7503da365fa556aab27004814:1/read-cache.c  (mode:100644 sha1:2f6a4aa18d48865db80459a3459ac4384b0b16c8)\n+++ 77de9e0b7a81ddc22526c9415f0273171f631d3f:1/read-cache.c  (mode:100644 sha1:349ebd1f8a0a95bf462bb1dfd3d9dfb50628829c)\n@@ -267,7 +267,7 @@\n \treturn 0;\n }\n \n-int write_cache(int newfd, struct cache_entry **cache, int entries)\n+int write_cache(int newfd)\n {\n \tSHA_CTX c;\n \tstruct cache_header hdr;\n@@ -275,14 +275,14 @@\n \n \thdr.hdr_signature = htonl(CACHE_SIGNATURE);\n \thdr.hdr_version = htonl(2);\n-\thdr.hdr_entries = htonl(entries);\n+\thdr.hdr_entries = htonl(active_nr);\n \n \tSHA1_Init(&c);\n \tif (ce_write(&c, newfd, &hdr, sizeof(hdr)) < 0)\n \t\treturn -1;\n \n-\tfor (i = 0; i < entries; i++) {\n-\t\tstruct cache_entry *ce = cache[i];\n+\tfor (i = 0; i < active_nr; i++) {\n+\t\tstruct cache_entry *ce = active_cache[i];\n \t\tif (ce_write(&c, newfd, ce, ce_size(ce)) < 0)\n \t\t\treturn -1;\n \t}\nIndex: read-tree.c\n===================================================================\n--- cd1c034369b73da7503da365fa556aab27004814:1/read-tree.c  (mode:100644 sha1:620f3f74eb56366fca8be4d28d7b04875c0fa90c)\n+++ 77de9e0b7a81ddc22526c9415f0273171f631d3f:1/read-tree.c  (mode:100644 sha1:4ad48f5c409ead69407d2b5feab4466cdcb499f8)\n@@ -261,7 +261,7 @@\n \t\t\tdie(\"just how do you expect me to merge %d trees?\", stage-1);\n \t\t}\n \t}\n-\tif (write_cache(newfd, active_cache, active_nr) ||\n+\tif (write_cache(newfd) ||\n \t    rename(\".git/index.lock\", \".git/index\"))\n \t\tdie(\"unable to write new index file\");\n \tremove_lock = 0;\nIndex: update-cache.c\n===================================================================\n--- cd1c034369b73da7503da365fa556aab27004814:1/update-cache.c  (mode:100644 sha1:a09883541c745c76413c62109a80f40df4b7a7fb)\n+++ 77de9e0b7a81ddc22526c9415f0273171f631d3f:1/update-cache.c  (mode:100644 sha1:585951108c57a64bb774114d289d81fd7fd22768)\n@@ -341,7 +341,7 @@\n \t\tif (add_file_to_cache(path))\n \t\t\tdie(\"Unable to add %s to database\", path);\n \t}\n-\tif (write_cache(newfd, active_cache, active_nr) ||\n+\tif (write_cache(newfd) ||\n \t    rename(\".git/index.lock\", \".git/index\"))\n \t\tdie(\"Unable to write new cachefile\");\n \n\n"}]}