* Map the loose object at "path" if it is not NULL, or the path found by
* searching for a loose object named "sha1".
*/
-#define map_sha1_file_1(r, p, s, si) map_sha1_file_1_##r(p, s, si)
-static void *map_sha1_file_1_the_repository(const char *path,
- const unsigned char *sha1,
- unsigned long *size)
+static void *map_sha1_file_1(struct repository *r, const char *path,
+ const unsigned char *sha1, unsigned long *size)
{
void *map;
int fd;
if (path)
fd = git_open(path);
else
- fd = open_sha1_file(the_repository, sha1, &path);
+ fd = open_sha1_file(r, sha1, &path);
map = NULL;
if (fd >= 0) {
struct stat st;
return map;
}
-void *map_sha1_file_the_repository(const unsigned char *sha1, unsigned long *size)
+void *map_sha1_file(struct repository *r,
+ const unsigned char *sha1, unsigned long *size)
{
- return map_sha1_file_1(the_repository, NULL, sha1, size);
+ return map_sha1_file_1(r, NULL, sha1, size);
}
static int unpack_sha1_short_header(git_zstream *stream,
return parse_sha1_header_extended(hdr, &oi, 0);
}
-#define sha1_loose_object_info(r, s, o, f) sha1_loose_object_info_##r(s, o, f)
-static int sha1_loose_object_info_the_repository(const unsigned char *sha1,
- struct object_info *oi,
- int flags)
+static int sha1_loose_object_info(struct repository *r,
+ const unsigned char *sha1,
+ struct object_info *oi, int flags)
{
int status = 0;
unsigned long mapsize;
if (!oi->typep && !oi->typename && !oi->sizep && !oi->contentp) {
const char *path;
struct stat st;
- if (stat_sha1_file(the_repository, sha1, &st, &path) < 0)
+ if (stat_sha1_file(r, sha1, &st, &path) < 0)
return -1;
if (oi->disk_sizep)
*oi->disk_sizep = st.st_size;
return 0;
}
- map = map_sha1_file(the_repository, sha1, &mapsize);
+ map = map_sha1_file(r, sha1, &mapsize);
if (!map)
return -1;