From f7548d6d28c313cf80e6f3ef89aed16a19815df1 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 11:51:24 +0200 Subject: Adding upstream version 1:2.3.19.1+dfsg1. Signed-off-by: Daniel Baumann --- src/lib-index/mail-index-util.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/lib-index/mail-index-util.h (limited to 'src/lib-index/mail-index-util.h') diff --git a/src/lib-index/mail-index-util.h b/src/lib-index/mail-index-util.h new file mode 100644 index 0000000..b61e16a --- /dev/null +++ b/src/lib-index/mail-index-util.h @@ -0,0 +1,22 @@ +#ifndef MAIL_INDEX_UTIL_H +#define MAIL_INDEX_UTIL_H + +ARRAY_DEFINE_TYPE(seq_array, uint32_t); + +uint32_t mail_index_uint32_to_offset(uint32_t offset); +uint32_t mail_index_offset_to_uint32(uint32_t offset); + +#define MAIL_INDEX_PACK_MAX_SIZE ((sizeof(uint32_t) * 8 + 7) / 7) +void mail_index_pack_num(uint8_t **p, uint32_t num); +int mail_index_unpack_num(const uint8_t **p, const uint8_t *end, + uint32_t *num_r); + +bool mail_index_seq_array_lookup(const ARRAY_TYPE(seq_array) *array, + uint32_t seq, unsigned int *idx_r); +void mail_index_seq_array_alloc(ARRAY_TYPE(seq_array) *array, + size_t record_size); +bool mail_index_seq_array_add(ARRAY_TYPE(seq_array) *array, uint32_t seq, + const void *record, size_t record_size, + void *old_record) ATTR_NULL(5); + +#endif -- cgit v1.2.3