Skip to content

Commit 91d48f0

Browse files
committed
Merge branch 'pw/reftable-libgit2-cleanup' into seen
Code clean-ups. Comments? * pw/reftable-libgit2-cleanup: reftable/stack: allow passing flags to `reftable_stack_add()` reftable/stack: reorder code to avoid forward declarations reftable/stack: fix compiler warning due to missing braces reftable/writer: drop Git-specific `QSORT()` macro reftable/writer: fix type used for number of records
2 parents 7b52981 + bced10f commit 91d48f0

File tree

6 files changed

+232
-237
lines changed

6 files changed

+232
-237
lines changed

refs/reftable-backend.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1974,7 +1974,7 @@ static int reftable_be_rename_ref(struct ref_store *ref_store,
19741974
ret = backend_for(&arg.be, refs, newrefname, &newrefname, 1);
19751975
if (ret)
19761976
goto done;
1977-
ret = reftable_stack_add(arg.be->stack, &write_copy_table, &arg);
1977+
ret = reftable_stack_add(arg.be->stack, &write_copy_table, &arg, 0);
19781978

19791979
done:
19801980
assert(ret != REFTABLE_API_ERROR);
@@ -2003,7 +2003,7 @@ static int reftable_be_copy_ref(struct ref_store *ref_store,
20032003
ret = backend_for(&arg.be, refs, newrefname, &newrefname, 1);
20042004
if (ret)
20052005
goto done;
2006-
ret = reftable_stack_add(arg.be->stack, &write_copy_table, &arg);
2006+
ret = reftable_stack_add(arg.be->stack, &write_copy_table, &arg, 0);
20072007

20082008
done:
20092009
assert(ret != REFTABLE_API_ERROR);
@@ -2375,7 +2375,7 @@ static int reftable_be_create_reflog(struct ref_store *ref_store,
23752375
goto done;
23762376
arg.stack = be->stack;
23772377

2378-
ret = reftable_stack_add(be->stack, &write_reflog_existence_table, &arg);
2378+
ret = reftable_stack_add(be->stack, &write_reflog_existence_table, &arg, 0);
23792379

23802380
done:
23812381
return ret;
@@ -2446,7 +2446,7 @@ static int reftable_be_delete_reflog(struct ref_store *ref_store,
24462446
return ret;
24472447
arg.stack = be->stack;
24482448

2449-
ret = reftable_stack_add(be->stack, &write_reflog_delete_table, &arg);
2449+
ret = reftable_stack_add(be->stack, &write_reflog_delete_table, &arg, 0);
24502450

24512451
assert(ret != REFTABLE_API_ERROR);
24522452
return ret;

reftable/reftable-stack.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,15 @@ int reftable_addition_commit(struct reftable_addition *add);
6868
* transaction. Releases the lock if held. */
6969
void reftable_addition_destroy(struct reftable_addition *add);
7070

71-
/* add a new table to the stack. The write_table function must call
72-
* reftable_writer_set_limits, add refs and return an error value. */
71+
/*
72+
* Add a new table to the stack. The write_table function must call
73+
* reftable_writer_set_limits, add refs and return an error value.
74+
* The flags are passed through to `reftable_stack_new_addition()`.
75+
*/
7376
int reftable_stack_add(struct reftable_stack *st,
7477
int (*write_table)(struct reftable_writer *wr,
7578
void *write_arg),
76-
void *write_arg);
79+
void *write_arg, unsigned flags);
7780

7881
struct reftable_iterator;
7982

reftable/reftable-writer.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ int reftable_writer_add_ref(struct reftable_writer *w,
156156
the records before adding them, reordering the records array passed in.
157157
*/
158158
int reftable_writer_add_refs(struct reftable_writer *w,
159-
struct reftable_ref_record *refs, int n);
159+
struct reftable_ref_record *refs, size_t n);
160160

161161
/*
162162
adds reftable_log_records. Log records are keyed by (refname, decreasing
@@ -171,7 +171,7 @@ int reftable_writer_add_log(struct reftable_writer *w,
171171
the records before adding them, reordering records array passed in.
172172
*/
173173
int reftable_writer_add_logs(struct reftable_writer *w,
174-
struct reftable_log_record *logs, int n);
174+
struct reftable_log_record *logs, size_t n);
175175

176176
/* reftable_writer_close finalizes the reftable. The writer is retained so
177177
* statistics can be inspected. */

0 commit comments

Comments
 (0)