Skip to content

Commit bc062ad

Browse files
avargitster
authored andcommitted
streaming.c: remove {open,close,read}_method_decl() macros
Remove the {open,close,read}_method_decl() macros added in 46bf043 (streaming: a new API to read from the object store, 2011-05-11) in favor of inlining the definition of the arguments of these functions. Since we'll end up using them via the "{open,close,read}_istream_fn" types we don't gain anything in the way of compiler checking by using these macros, and as of preceding commits we no longer need to declare these argument lists twice. So declaring them at a distance just serves to make the code less readable. Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0d9af06 commit bc062ad

File tree

1 file changed

+22
-25
lines changed

1 file changed

+22
-25
lines changed

streaming.c

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,6 @@ struct stream_vtbl {
2121
read_istream_fn read;
2222
};
2323

24-
#define open_method_decl(name) \
25-
int open_istream_ ##name \
26-
(struct git_istream *st, struct repository *r, \
27-
struct object_info *oi, const struct object_id *oid, \
28-
enum object_type *type)
29-
30-
#define close_method_decl(name) \
31-
int close_istream_ ##name \
32-
(struct git_istream *st)
33-
34-
#define read_method_decl(name) \
35-
ssize_t read_istream_ ##name \
36-
(struct git_istream *st, char *buf, size_t sz)
37-
3824
#define FILTER_BUFFER (1024*16)
3925

4026
struct filtered_istream {
@@ -95,13 +81,14 @@ static void close_deflated_stream(struct git_istream *st)
9581
*
9682
*****************************************************************/
9783

98-
static close_method_decl(filtered)
84+
static int close_istream_filtered(struct git_istream *st)
9985
{
10086
free_stream_filter(st->u.filtered.filter);
10187
return close_istream(st->u.filtered.upstream);
10288
}
10389

104-
static read_method_decl(filtered)
90+
static ssize_t read_istream_filtered(struct git_istream *st, char *buf,
91+
size_t sz)
10592
{
10693
struct filtered_istream *fs = &(st->u.filtered);
10794
size_t filled = 0;
@@ -187,7 +174,7 @@ static struct git_istream *attach_stream_filter(struct git_istream *st,
187174
*
188175
*****************************************************************/
189176

190-
static read_method_decl(loose)
177+
static ssize_t read_istream_loose(struct git_istream *st, char *buf, size_t sz)
191178
{
192179
size_t total_read = 0;
193180

@@ -232,7 +219,7 @@ static read_method_decl(loose)
232219
return total_read;
233220
}
234221

235-
static close_method_decl(loose)
222+
static int close_istream_loose(struct git_istream *st)
236223
{
237224
close_deflated_stream(st);
238225
munmap(st->u.loose.mapped, st->u.loose.mapsize);
@@ -244,7 +231,10 @@ static struct stream_vtbl loose_vtbl = {
244231
read_istream_loose,
245232
};
246233

247-
static open_method_decl(loose)
234+
static int open_istream_loose(struct git_istream *st, struct repository *r,
235+
struct object_info *oi,
236+
const struct object_id *oid,
237+
enum object_type *type)
248238
{
249239
st->u.loose.mapped = map_loose_object(r, oid, &st->u.loose.mapsize);
250240
if (!st->u.loose.mapped)
@@ -275,7 +265,8 @@ static open_method_decl(loose)
275265
*
276266
*****************************************************************/
277267

278-
static read_method_decl(pack_non_delta)
268+
static ssize_t read_istream_pack_non_delta(struct git_istream *st, char *buf,
269+
size_t sz)
279270
{
280271
size_t total_read = 0;
281272

@@ -333,7 +324,7 @@ static read_method_decl(pack_non_delta)
333324
return total_read;
334325
}
335326

336-
static close_method_decl(pack_non_delta)
327+
static int close_istream_pack_non_delta(struct git_istream *st)
337328
{
338329
close_deflated_stream(st);
339330
return 0;
@@ -344,7 +335,11 @@ static struct stream_vtbl pack_non_delta_vtbl = {
344335
read_istream_pack_non_delta,
345336
};
346337

347-
static open_method_decl(pack_non_delta)
338+
static int open_istream_pack_non_delta(struct git_istream *st,
339+
struct repository *r,
340+
struct object_info *oi,
341+
const struct object_id *oid,
342+
enum object_type *type)
348343
{
349344
struct pack_window *window;
350345
enum object_type in_pack_type;
@@ -379,13 +374,13 @@ static open_method_decl(pack_non_delta)
379374
*
380375
*****************************************************************/
381376

382-
static close_method_decl(incore)
377+
static int close_istream_incore(struct git_istream *st)
383378
{
384379
free(st->u.incore.buf);
385380
return 0;
386381
}
387382

388-
static read_method_decl(incore)
383+
static ssize_t read_istream_incore(struct git_istream *st, char *buf, size_t sz)
389384
{
390385
size_t read_size = sz;
391386
size_t remainder = st->size - st->u.incore.read_ptr;
@@ -404,7 +399,9 @@ static struct stream_vtbl incore_vtbl = {
404399
read_istream_incore,
405400
};
406401

407-
static open_method_decl(incore)
402+
static int open_istream_incore(struct git_istream *st, struct repository *r,
403+
struct object_info *oi, const struct object_id *oid,
404+
enum object_type *type)
408405
{
409406
st->u.incore.buf = read_object_file_extended(r, oid, type, &st->size, 0);
410407
st->u.incore.read_ptr = 0;

0 commit comments

Comments
 (0)