1#ifndef DEFINE_FUNC_ATTRIBUTES
2# define DEFINE_FUNC_ATTRIBUTES
3#endif
4#include "nvim/func_attr.h"
5#undef DEFINE_FUNC_ATTRIBUTES
6static inline kh_bufset_t *kh_init_bufset(void);
7static inline void kh_dealloc_bufset(kh_bufset_t *h);
8static inline void kh_destroy_bufset(kh_bufset_t *h);
9static inline void kh_clear_bufset(kh_bufset_t *h);
10static inline khint_t kh_get_bufset(const kh_bufset_t *h, khint64_t key);
11static inline void kh_resize_bufset(kh_bufset_t *h, khint_t new_n_buckets);
12static inline khint_t kh_put_bufset(kh_bufset_t *h, khint64_t key, int *ret);
13static inline void kh_del_bufset(kh_bufset_t *h, khint_t x);
14static inline kh_fnamebufs_t *kh_init_fnamebufs(void);
15static inline void kh_dealloc_fnamebufs(kh_fnamebufs_t *h);
16static inline void kh_destroy_fnamebufs(kh_fnamebufs_t *h);
17static inline void kh_clear_fnamebufs(kh_fnamebufs_t *h);
18static inline khint_t kh_get_fnamebufs(const kh_fnamebufs_t *h, kh_cstr_t key);
19static inline void kh_resize_fnamebufs(kh_fnamebufs_t *h, khint_t new_n_buckets);
20static inline khint_t kh_put_fnamebufs(kh_fnamebufs_t *h, kh_cstr_t key, int *ret);
21static inline void kh_del_fnamebufs(kh_fnamebufs_t *h, khint_t x);
22static inline kh_strset_t *kh_init_strset(void);
23static inline void kh_dealloc_strset(kh_strset_t *h);
24static inline void kh_destroy_strset(kh_strset_t *h);
25static inline void kh_clear_strset(kh_strset_t *h);
26static inline khint_t kh_get_strset(const kh_strset_t *h, kh_cstr_t key);
27static inline void kh_resize_strset(kh_strset_t *h, khint_t new_n_buckets);
28static inline khint_t kh_put_strset(kh_strset_t *h, kh_cstr_t key, int *ret);
29static inline void kh_del_strset(kh_strset_t *h, khint_t x);
30static inline kh_hmll_entries_t *kh_init_hmll_entries(void);
31static inline void kh_dealloc_hmll_entries(kh_hmll_entries_t *h);
32static inline void kh_destroy_hmll_entries(kh_hmll_entries_t *h);
33static inline void kh_clear_hmll_entries(kh_hmll_entries_t *h);
34static inline khint_t kh_get_hmll_entries(const kh_hmll_entries_t *h, kh_cstr_t key);
35static inline void kh_resize_hmll_entries(kh_hmll_entries_t *h, khint_t new_n_buckets);
36static inline khint_t kh_put_hmll_entries(kh_hmll_entries_t *h, kh_cstr_t key, int *ret);
37static inline void kh_del_hmll_entries(kh_hmll_entries_t *h, khint_t x);
38static inline kh_file_marks_t *kh_init_file_marks(void);
39static inline void kh_dealloc_file_marks(kh_file_marks_t *h);
40static inline void kh_destroy_file_marks(kh_file_marks_t *h);
41static inline void kh_clear_file_marks(kh_file_marks_t *h);
42static inline khint_t kh_get_file_marks(const kh_file_marks_t *h, kh_cstr_t key);
43static inline void kh_resize_file_marks(kh_file_marks_t *h, khint_t new_n_buckets);
44static inline khint_t kh_put_file_marks(kh_file_marks_t *h, kh_cstr_t key, int *ret);
45static inline void kh_del_file_marks(kh_file_marks_t *h, khint_t x);
46static inline void hmll_init(HMLList *const hmll, const size_t size) FUNC_ATTR_NONNULL_ALL;
47static inline void hmll_remove(HMLList *const hmll, HMLListEntry *const hmll_entry) FUNC_ATTR_NONNULL_ALL;
48static inline void hmll_insert(HMLList *const hmll, HMLListEntry *hmll_entry, const ShadaEntry data, const _Bool can_free_entry) FUNC_ATTR_NONNULL_ARG(1);
49static inline void hmll_dealloc(HMLList *const hmll) FUNC_ATTR_NONNULL_ALL;
50static ptrdiff_t read_file(ShaDaReadDef *const sd_reader, void *const dest, const size_t size) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT;
51static int read_char(ShaDaReadDef *const sd_reader) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT;
52static ptrdiff_t write_file(ShaDaWriteDef *const sd_writer, const void *const dest, const size_t size) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT;
53static void close_sd_reader(ShaDaReadDef *const sd_reader) FUNC_ATTR_NONNULL_ALL;
54static void close_sd_writer(ShaDaWriteDef *const sd_writer) FUNC_ATTR_NONNULL_ALL;
55static int sd_reader_skip_read(ShaDaReadDef *const sd_reader, const size_t offset) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT;
56static ShaDaReadResult sd_reader_skip(ShaDaReadDef *const sd_reader, const size_t offset) FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL;
57static int open_shada_file_for_reading(const char *const fname, ShaDaReadDef *sd_reader) FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL;
58static void close_file(void *cookie);
59static inline _Bool in_bufset(const kh_bufset_t *const set, const buf_T *buf) FUNC_ATTR_PURE;
60static inline _Bool in_strset(const kh_strset_t *const set, char *str) FUNC_ATTR_PURE;
61static int msgpack_sd_writer_write(void *data, const char *buf, size_t len);
62static _Bool shada_disabled(void) FUNC_ATTR_PURE;
63static int shada_read_file(const char *const file, const int flags) FUNC_ATTR_WARN_UNUSED_RESULT;
64static const void *shada_hist_iter(const void *const iter, const uint8_t history_type, const _Bool zero, ShadaEntry *const hist) FUNC_ATTR_NONNULL_ARG(4) FUNC_ATTR_WARN_UNUSED_RESULT;
65static void hms_insert(HistoryMergerState *const hms_p, const ShadaEntry entry, const _Bool do_iter, const _Bool can_free_entry) FUNC_ATTR_NONNULL_ALL;
66static inline void hms_init(HistoryMergerState *const hms_p, const uint8_t history_type, const size_t num_elements, const _Bool do_merge, const _Bool reading) FUNC_ATTR_NONNULL_ALL;
67static inline void hms_insert_whole_neovim_history(HistoryMergerState *const hms_p) FUNC_ATTR_NONNULL_ALL;
68static inline void hms_to_he_array(const HistoryMergerState *const hms_p, histentry_T *const hist_array, int *const new_hisidx, int *const new_hisnum) FUNC_ATTR_NONNULL_ALL;
69static inline void hms_dealloc(HistoryMergerState *const hms_p) FUNC_ATTR_NONNULL_ALL;
70static buf_T *find_buffer(kh_fnamebufs_t *const fname_bufs, const char *const fname) FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ALL;
71static inline _Bool marks_equal(const pos_T a, const pos_T b);
72static void shada_read(ShaDaReadDef *const sd_reader, const int flags) FUNC_ATTR_NONNULL_ALL;
73static const char *shada_get_default_file(void) FUNC_ATTR_WARN_UNUSED_RESULT;
74static char *shada_filename(const char *file) FUNC_ATTR_MALLOC FUNC_ATTR_NONNULL_RET FUNC_ATTR_WARN_UNUSED_RESULT;
75static ShaDaWriteResult shada_pack_entry(msgpack_packer *const packer, ShadaEntry entry, const size_t max_kbyte) FUNC_ATTR_NONNULL_ALL;
76static inline ShaDaWriteResult shada_pack_pfreed_entry(msgpack_packer *const packer, PossiblyFreedShadaEntry entry, const size_t max_kbyte) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_ALWAYS_INLINE;
77static int compare_file_marks(const void *a, const void *b) FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_PURE;
78static inline ShaDaReadResult shada_parse_msgpack(ShaDaReadDef *const sd_reader, const size_t length, msgpack_unpacked *ret_unpacked, char **const ret_buf) FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_NONNULL_ARG(1);
79static const char *shada_format_entry(const ShadaEntry entry) FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_UNUSED FUNC_ATTR_NONNULL_RET;
80static const char *shada_format_pfreed_entry(const PossiblyFreedShadaEntry pfs_entry) FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_UNUSED FUNC_ATTR_NONNULL_RET;
81static inline ShaDaWriteResult shada_read_when_writing(ShaDaReadDef *const sd_reader, const unsigned srni_flags, const size_t max_kbyte, WriteMergerState *const wms, msgpack_packer *const packer) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT;
82static inline _Bool ignore_buf(const buf_T *const buf, kh_bufset_t *const removable_bufs) FUNC_ATTR_PURE FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_ALWAYS_INLINE;
83static inline ShadaEntry shada_get_buflist(kh_bufset_t *const removable_bufs) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_ALWAYS_INLINE;
84static inline void add_search_pattern(PossiblyFreedShadaEntry *const ret_pse, const SearchPatternGetter get_pattern, const _Bool is_substitute_pattern, const _Bool search_last_used, const _Bool search_highlighted) FUNC_ATTR_ALWAYS_INLINE;
85static inline void shada_initialize_registers(WriteMergerState *const wms, int max_reg_lines) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_ALWAYS_INLINE;
86static inline void replace_numbered_mark(WriteMergerState *const wms, const size_t idx, const PossiblyFreedShadaEntry entry) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_ALWAYS_INLINE;
87static inline void find_removable_bufs(kh_bufset_t *removable_bufs);
88static ShaDaWriteResult shada_write(ShaDaWriteDef *const sd_writer, ShaDaReadDef *const sd_reader) FUNC_ATTR_NONNULL_ARG(1);
89static void shada_free_shada_entry(ShadaEntry *const entry);
90static ShaDaReadResult fread_len(ShaDaReadDef *const sd_reader, char *const buffer, const size_t length) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT;
91static ShaDaReadResult msgpack_read_uint64(ShaDaReadDef *const sd_reader, const int first_char, uint64_t *const result) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT;
92static ShaDaReadResult shada_read_next_item(ShaDaReadDef *const sd_reader, ShadaEntry *const entry, const unsigned flags, const size_t max_kbyte) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT;
93static _Bool shada_removable(const char *name) FUNC_ATTR_WARN_UNUSED_RESULT;
94static inline size_t shada_init_jumps(PossiblyFreedShadaEntry *jumps, kh_bufset_t *const removable_bufs);
95static ptrdiff_t read_sbuf(ShaDaReadDef *const sd_reader, void *const dest, const size_t size) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT;
96static int sd_sbuf_reader_skip_read(ShaDaReadDef *const sd_reader, const size_t offset) FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT;
97static void open_shada_sbuf_for_reading(const msgpack_sbuffer *const sbuf, ShaDaReadDef *sd_reader) FUNC_ATTR_NONNULL_ALL;
98#include "nvim/func_attr.h"
99