{"thread":{"id":"17113","subject":"[RFC/PATCH 1/7] sha1_file: make \"read_object\" static","startedAt":"2009-01-12T17:42:24Z","lastAt":"2009-01-12T17:42:24Z","messageCount":1,"participants":["Christian Couder"],"isPatch":true,"patchVersion":1,"patchTotal":7},"messages":[{"id":"100139","messageId":"20090112184224.31342906.chriscool@tuxfamily.org","threadId":"17113","inReplyTo":null,"subject":"[RFC/PATCH 1/7] sha1_file: make \"read_object\" static","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2009-01-12T17:42:24Z","receivedAt":"2009-01-12T17:42:24Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"This function is only used from \"sha1_file.c\".\n\nAnd as we want to add a \"replace_object\" hook in \"read_sha1_file\",\nwe must not let people bypass the hook using something other than\n\"read_sha1_file\".\n\nSigned-off-by: Christian Couder <chriscool@tuxfamily.org>\n---\n cache.h     |    3 ---\n sha1_file.c |    7 +++++--\n 2 files changed, 5 insertions(+), 5 deletions(-)\n\n\tHere is a new patch series. This time the hook is in \"read_sha1_file\".\n\tThere are still many things to do and to check after this, it's just a start.\n\tBut I try to follow the advise we give to GSoC student so I release early\n\tand often :-)\n\ndiff --git a/cache.h b/cache.h\nindex 231c06d..8e1af26 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -631,9 +631,6 @@ extern int write_sha1_file(void *buf, unsigned long len, const char *type, unsig\n extern int pretend_sha1_file(void *, unsigned long, enum object_type, unsigned char *);\n extern int force_object_loose(const unsigned char *sha1, time_t mtime);\n \n-/* just like read_sha1_file(), but non fatal in presence of bad objects */\n-extern void *read_object(const unsigned char *sha1, enum object_type *type, unsigned long *size);\n-\n /* global flag to enable extra checks when accessing packed objects */\n extern int do_check_packed_object_crc;\n \ndiff --git a/sha1_file.c b/sha1_file.c\nindex 52d1ead..f08493f 100644\n--- a/sha1_file.c\n+++ b/sha1_file.c\n@@ -1700,6 +1700,9 @@ static void add_delta_base_cache(struct packed_git *p, off_t base_offset,\n \tdelta_base_cache_lru.prev = &ent->lru;\n }\n \n+static void *read_object(const unsigned char *sha1, enum object_type *type,\n+\t\t\t unsigned long *size);\n+\n static void *unpack_delta_entry(struct packed_git *p,\n \t\t\t\tstruct pack_window **w_curs,\n \t\t\t\toff_t curpos,\n@@ -2130,8 +2133,8 @@ int pretend_sha1_file(void *buf, unsigned long len, enum object_type type,\n \treturn 0;\n }\n \n-void *read_object(const unsigned char *sha1, enum object_type *type,\n-\t\t  unsigned long *size)\n+static void *read_object(const unsigned char *sha1, enum object_type *type,\n+\t\t\t unsigned long *size)\n {\n \tunsigned long mapsize;\n \tvoid *map, *buf;\n-- \n1.6.1.83.g16e5\n"}]}