reftable/basics: introduce `REFTABLE_UNUSED` annotation
Introduce the `REFTABLE_UNUSED` annotation and replace all existing users of `UNUSED` in the reftable library to use the new macro instead. Note that we unconditionally define `MAYBE_UNUSED` in the exact same way, so doing so unconditionally for `REFTABLE_UNUSED` should be fine, too. Suggested-by: Toon Claes <toon@iotcl.com> Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>maint
parent
f8ed12dec4
commit
f93b2a0424
|
@ -16,6 +16,8 @@ https://developers.google.com/open-source/licenses/bsd
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "reftable-basics.h"
|
#include "reftable-basics.h"
|
||||||
|
|
||||||
|
#define REFTABLE_UNUSED __attribute__((__unused__))
|
||||||
|
|
||||||
struct reftable_buf {
|
struct reftable_buf {
|
||||||
size_t alloc;
|
size_t alloc;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
|
@ -13,14 +13,14 @@ https://developers.google.com/open-source/licenses/bsd
|
||||||
#include "reftable-blocksource.h"
|
#include "reftable-blocksource.h"
|
||||||
#include "reftable-error.h"
|
#include "reftable-error.h"
|
||||||
|
|
||||||
static void reftable_buf_return_block(void *b UNUSED, struct reftable_block *dest)
|
static void reftable_buf_return_block(void *b REFTABLE_UNUSED, struct reftable_block *dest)
|
||||||
{
|
{
|
||||||
if (dest->len)
|
if (dest->len)
|
||||||
memset(dest->data, 0xff, dest->len);
|
memset(dest->data, 0xff, dest->len);
|
||||||
reftable_free(dest->data);
|
reftable_free(dest->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void reftable_buf_close(void *b UNUSED)
|
static void reftable_buf_close(void *b REFTABLE_UNUSED)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ static uint64_t file_size(void *b)
|
||||||
return ((struct file_block_source *)b)->size;
|
return ((struct file_block_source *)b)->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void file_return_block(void *b UNUSED, struct reftable_block *dest UNUSED)
|
static void file_return_block(void *b REFTABLE_UNUSED, struct reftable_block *dest REFTABLE_UNUSED)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,17 +25,17 @@ int iterator_next(struct reftable_iterator *it, struct reftable_record *rec)
|
||||||
return it->ops->next(it->iter_arg, rec);
|
return it->ops->next(it->iter_arg, rec);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int empty_iterator_seek(void *arg UNUSED, struct reftable_record *want UNUSED)
|
static int empty_iterator_seek(void *arg REFTABLE_UNUSED, struct reftable_record *want REFTABLE_UNUSED)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int empty_iterator_next(void *arg UNUSED, struct reftable_record *rec UNUSED)
|
static int empty_iterator_next(void *arg REFTABLE_UNUSED, struct reftable_record *rec REFTABLE_UNUSED)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void empty_iterator_close(void *arg UNUSED)
|
static void empty_iterator_close(void *arg REFTABLE_UNUSED)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,8 +143,8 @@ static int indexed_table_ref_iter_next_block(struct indexed_table_ref_iter *it)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int indexed_table_ref_iter_seek(void *p UNUSED,
|
static int indexed_table_ref_iter_seek(void *p REFTABLE_UNUSED,
|
||||||
struct reftable_record *want UNUSED)
|
struct reftable_record *want REFTABLE_UNUSED)
|
||||||
{
|
{
|
||||||
return REFTABLE_API_ERROR;
|
return REFTABLE_API_ERROR;
|
||||||
}
|
}
|
||||||
|
|
|
@ -490,7 +490,7 @@ static void reftable_obj_record_release(void *rec)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int reftable_obj_record_copy_from(void *rec, const void *src_rec,
|
static int reftable_obj_record_copy_from(void *rec, const void *src_rec,
|
||||||
uint32_t hash_size UNUSED)
|
uint32_t hash_size REFTABLE_UNUSED)
|
||||||
{
|
{
|
||||||
struct reftable_obj_record *obj = rec;
|
struct reftable_obj_record *obj = rec;
|
||||||
const struct reftable_obj_record *src = src_rec;
|
const struct reftable_obj_record *src = src_rec;
|
||||||
|
@ -528,7 +528,7 @@ static uint8_t reftable_obj_record_val_type(const void *rec)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int reftable_obj_record_encode(const void *rec, struct string_view s,
|
static int reftable_obj_record_encode(const void *rec, struct string_view s,
|
||||||
uint32_t hash_size UNUSED)
|
uint32_t hash_size REFTABLE_UNUSED)
|
||||||
{
|
{
|
||||||
const struct reftable_obj_record *r = rec;
|
const struct reftable_obj_record *r = rec;
|
||||||
struct string_view start = s;
|
struct string_view start = s;
|
||||||
|
@ -563,8 +563,8 @@ static int reftable_obj_record_encode(const void *rec, struct string_view s,
|
||||||
|
|
||||||
static int reftable_obj_record_decode(void *rec, struct reftable_buf key,
|
static int reftable_obj_record_decode(void *rec, struct reftable_buf key,
|
||||||
uint8_t val_type, struct string_view in,
|
uint8_t val_type, struct string_view in,
|
||||||
uint32_t hash_size UNUSED,
|
uint32_t hash_size REFTABLE_UNUSED,
|
||||||
struct reftable_buf *scratch UNUSED)
|
struct reftable_buf *scratch REFTABLE_UNUSED)
|
||||||
{
|
{
|
||||||
struct string_view start = in;
|
struct string_view start = in;
|
||||||
struct reftable_obj_record *r = rec;
|
struct reftable_obj_record *r = rec;
|
||||||
|
@ -618,13 +618,13 @@ static int reftable_obj_record_decode(void *rec, struct reftable_buf key,
|
||||||
return start.len - in.len;
|
return start.len - in.len;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int not_a_deletion(const void *p UNUSED)
|
static int not_a_deletion(const void *p REFTABLE_UNUSED)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int reftable_obj_record_equal_void(const void *a, const void *b,
|
static int reftable_obj_record_equal_void(const void *a, const void *b,
|
||||||
uint32_t hash_size UNUSED)
|
uint32_t hash_size REFTABLE_UNUSED)
|
||||||
{
|
{
|
||||||
struct reftable_obj_record *ra = (struct reftable_obj_record *) a;
|
struct reftable_obj_record *ra = (struct reftable_obj_record *) a;
|
||||||
struct reftable_obj_record *rb = (struct reftable_obj_record *) b;
|
struct reftable_obj_record *rb = (struct reftable_obj_record *) b;
|
||||||
|
@ -1054,7 +1054,7 @@ static int reftable_index_record_key(const void *r, struct reftable_buf *dest)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int reftable_index_record_copy_from(void *rec, const void *src_rec,
|
static int reftable_index_record_copy_from(void *rec, const void *src_rec,
|
||||||
uint32_t hash_size UNUSED)
|
uint32_t hash_size REFTABLE_UNUSED)
|
||||||
{
|
{
|
||||||
struct reftable_index_record *dst = rec;
|
struct reftable_index_record *dst = rec;
|
||||||
const struct reftable_index_record *src = src_rec;
|
const struct reftable_index_record *src = src_rec;
|
||||||
|
@ -1075,13 +1075,13 @@ static void reftable_index_record_release(void *rec)
|
||||||
reftable_buf_release(&idx->last_key);
|
reftable_buf_release(&idx->last_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint8_t reftable_index_record_val_type(const void *rec UNUSED)
|
static uint8_t reftable_index_record_val_type(const void *rec REFTABLE_UNUSED)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int reftable_index_record_encode(const void *rec, struct string_view out,
|
static int reftable_index_record_encode(const void *rec, struct string_view out,
|
||||||
uint32_t hash_size UNUSED)
|
uint32_t hash_size REFTABLE_UNUSED)
|
||||||
{
|
{
|
||||||
const struct reftable_index_record *r =
|
const struct reftable_index_record *r =
|
||||||
(const struct reftable_index_record *)rec;
|
(const struct reftable_index_record *)rec;
|
||||||
|
@ -1097,10 +1097,10 @@ static int reftable_index_record_encode(const void *rec, struct string_view out,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int reftable_index_record_decode(void *rec, struct reftable_buf key,
|
static int reftable_index_record_decode(void *rec, struct reftable_buf key,
|
||||||
uint8_t val_type UNUSED,
|
uint8_t val_type REFTABLE_UNUSED,
|
||||||
struct string_view in,
|
struct string_view in,
|
||||||
uint32_t hash_size UNUSED,
|
uint32_t hash_size REFTABLE_UNUSED,
|
||||||
struct reftable_buf *scratch UNUSED)
|
struct reftable_buf *scratch REFTABLE_UNUSED)
|
||||||
{
|
{
|
||||||
struct string_view start = in;
|
struct string_view start = in;
|
||||||
struct reftable_index_record *r = rec;
|
struct reftable_index_record *r = rec;
|
||||||
|
@ -1120,7 +1120,7 @@ static int reftable_index_record_decode(void *rec, struct reftable_buf key,
|
||||||
}
|
}
|
||||||
|
|
||||||
static int reftable_index_record_equal(const void *a, const void *b,
|
static int reftable_index_record_equal(const void *a, const void *b,
|
||||||
uint32_t hash_size UNUSED)
|
uint32_t hash_size REFTABLE_UNUSED)
|
||||||
{
|
{
|
||||||
struct reftable_index_record *ia = (struct reftable_index_record *) a;
|
struct reftable_index_record *ia = (struct reftable_index_record *) a;
|
||||||
struct reftable_index_record *ib = (struct reftable_index_record *) b;
|
struct reftable_index_record *ib = (struct reftable_index_record *) b;
|
||||||
|
|
|
@ -649,7 +649,7 @@ static void write_object_record(void *void_arg, void *key)
|
||||||
done:;
|
done:;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void object_record_free(void *void_arg UNUSED, void *key)
|
static void object_record_free(void *void_arg REFTABLE_UNUSED, void *key)
|
||||||
{
|
{
|
||||||
struct obj_index_tree_node *entry = key;
|
struct obj_index_tree_node *entry = key;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue