Skip to content

Commit c35f35d

Browse files
avarderrickstolee
authored andcommitted
bundle.h: make "fd" version of read_bundle_header() public
Change the parse_bundle_header() function to be non-static, and rename it to parse_bundle_header_fd(). The parse_bundle_header() function is already public, and it's a thin wrapper around this function. This will be used by code that wants to pass a fd to the bundle API. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Derrick Stolee <[email protected]>
1 parent d73b578 commit c35f35d

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

bundle.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ static int parse_bundle_signature(struct bundle_header *header, const char *line
6666
return -1;
6767
}
6868

69-
static int parse_bundle_header(int fd, struct bundle_header *header,
70-
const char *report_path)
69+
int read_bundle_header_fd(int fd, struct bundle_header *header,
70+
const char *report_path)
7171
{
7272
struct strbuf buf = STRBUF_INIT;
7373
int status = 0;
@@ -143,7 +143,7 @@ int read_bundle_header(const char *path, struct bundle_header *header)
143143

144144
if (fd < 0)
145145
return error(_("could not open '%s'"), path);
146-
return parse_bundle_header(fd, header, path);
146+
return read_bundle_header_fd(fd, header, path);
147147
}
148148

149149
int is_bundle(const char *path, int quiet)
@@ -153,7 +153,7 @@ int is_bundle(const char *path, int quiet)
153153

154154
if (fd < 0)
155155
return 0;
156-
fd = parse_bundle_header(fd, &header, quiet ? NULL : path);
156+
fd = read_bundle_header_fd(fd, &header, quiet ? NULL : path);
157157
if (fd >= 0)
158158
close(fd);
159159
bundle_header_release(&header);

bundle.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ void bundle_header_release(struct bundle_header *header);
2424

2525
int is_bundle(const char *path, int quiet);
2626
int read_bundle_header(const char *path, struct bundle_header *header);
27+
int read_bundle_header_fd(int fd, struct bundle_header *header,
28+
const char *report_path);
2729
int create_bundle(struct repository *r, const char *path,
2830
int argc, const char **argv, struct strvec *pack_options,
2931
int version);

0 commit comments

Comments
 (0)