mirror of
https://github.com/neovim/neovim.git
synced 2025-09-27 21:48:35 +00:00
refactor: enable formatting for files under lib
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
// uncrustify:off
|
||||
|
||||
/*-
|
||||
* Copyright 1997-1999, 2001, John-Mark Gurney.
|
||||
* 2008-2009, Attractive Chaos <attractor@live.co.uk>
|
||||
@@ -36,10 +34,10 @@
|
||||
#ifndef NVIM_LIB_KBTREE_H
|
||||
#define NVIM_LIB_KBTREE_H
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "nvim/memory.h"
|
||||
|
||||
@@ -97,7 +95,8 @@
|
||||
} while (0)
|
||||
|
||||
#define __KB_GET_AUX1(name, key_t, kbnode_t, __cmp) \
|
||||
static inline int __kb_getp_aux_##name(const kbnode_t * __restrict x, key_t * __restrict k, int *r) \
|
||||
static inline int __kb_getp_aux_##name(const kbnode_t * __restrict x, key_t * __restrict k, \
|
||||
int *r) \
|
||||
{ \
|
||||
int tr, *rr, begin = 0, end = x->n; \
|
||||
if (x->n == 0) return -1; \
|
||||
@@ -134,7 +133,8 @@
|
||||
}
|
||||
|
||||
#define __KB_INTERVAL(name, key_t, kbnode_t) \
|
||||
static inline void kb_intervalp_##name(kbtree_##name##_t *b, key_t * __restrict k, key_t **lower, key_t **upper) \
|
||||
static inline void kb_intervalp_##name(kbtree_##name##_t *b, key_t * __restrict k, key_t **lower, \
|
||||
key_t **upper) \
|
||||
{ \
|
||||
if (!b->root) { \
|
||||
return; \
|
||||
@@ -171,9 +171,11 @@
|
||||
memcpy(__KB_KEY(key_t, z), &__KB_KEY(key_t, y)[T], sizeof(key_t) * (T - 1)); \
|
||||
if (y->is_internal) memcpy(__KB_PTR(b, z), &__KB_PTR(b, y)[T], sizeof(void *) * T); \
|
||||
y->n = T - 1; \
|
||||
memmove(&__KB_PTR(b, x)[i + 2], &__KB_PTR(b, x)[i + 1], sizeof(void*) * (unsigned int)(x->n - i)); \
|
||||
memmove(&__KB_PTR(b, x)[i + 2], &__KB_PTR(b, \
|
||||
x)[i + 1], sizeof(void *) * (unsigned int)(x->n - i)); \
|
||||
__KB_PTR(b, x)[i + 1] = z; \
|
||||
memmove(&__KB_KEY(key_t, x)[i + 1], &__KB_KEY(key_t, x)[i], sizeof(key_t) * (unsigned int)(x->n - i)); \
|
||||
memmove(&__KB_KEY(key_t, x)[i + 1], &__KB_KEY(key_t, x)[i], \
|
||||
sizeof(key_t) * (unsigned int)(x->n - i)); \
|
||||
__KB_KEY(key_t, x)[i] = __KB_KEY(key_t, y)[T - 1]; \
|
||||
++x->n; \
|
||||
} \
|
||||
@@ -184,7 +186,9 @@
|
||||
if (x->is_internal == 0) { \
|
||||
i = __kb_getp_aux_##name(x, k, 0); \
|
||||
if (i != x->n - 1) \
|
||||
memmove(&__KB_KEY(key_t, x)[i + 2], &__KB_KEY(key_t, x)[i + 1], (unsigned int)(x->n - i - 1) * sizeof(key_t)); \
|
||||
memmove(&__KB_KEY(key_t, x)[i + 2], &__KB_KEY(key_t, \
|
||||
x)[i + 1], \
|
||||
(unsigned int)(x->n - i - 1) * sizeof(key_t)); \
|
||||
ret = &__KB_KEY(key_t, x)[i + 1]; \
|
||||
*ret = *k; \
|
||||
++x->n; \
|
||||
@@ -224,7 +228,8 @@
|
||||
|
||||
|
||||
#define __KB_DEL(name, key_t, kbnode_t, T) \
|
||||
static inline key_t __kb_delp_aux_##name(kbtree_##name##_t *b, kbnode_t *x, key_t * __restrict k, int s) \
|
||||
static inline key_t __kb_delp_aux_##name(kbtree_##name##_t *b, kbnode_t *x, key_t * __restrict k, \
|
||||
int s) \
|
||||
{ \
|
||||
int yn, zn, i, r = 0; \
|
||||
kbnode_t *xp, *y, *z; \
|
||||
@@ -237,7 +242,9 @@
|
||||
if (x->is_internal == 0) { \
|
||||
if (s == 2) ++i; \
|
||||
kp = __KB_KEY(key_t, x)[i]; \
|
||||
memmove(&__KB_KEY(key_t, x)[i], &__KB_KEY(key_t, x)[i + 1], (unsigned int)(x->n - i - 1) * sizeof(key_t)); \
|
||||
memmove(&__KB_KEY(key_t, x)[i], &__KB_KEY(key_t, \
|
||||
x)[i + 1], \
|
||||
(unsigned int)(x->n - i - 1) * sizeof(key_t)); \
|
||||
--x->n; \
|
||||
return kp; \
|
||||
} \
|
||||
@@ -256,10 +263,16 @@
|
||||
y = __KB_PTR(b, x)[i]; z = __KB_PTR(b, x)[i + 1]; \
|
||||
__KB_KEY(key_t, y)[y->n++] = *k; \
|
||||
memmove(&__KB_KEY(key_t, y)[y->n], __KB_KEY(key_t, z), (unsigned int)z->n * sizeof(key_t)); \
|
||||
if (y->is_internal) memmove(&__KB_PTR(b, y)[y->n], __KB_PTR(b, z), (unsigned int)(z->n + 1) * sizeof(void*)); \
|
||||
if (y->is_internal) memmove(&__KB_PTR(b, y)[y->n], __KB_PTR(b, \
|
||||
z), \
|
||||
(unsigned int)(z->n + 1) * sizeof(void *)); \
|
||||
y->n += z->n; \
|
||||
memmove(&__KB_KEY(key_t, x)[i], &__KB_KEY(key_t, x)[i + 1], (unsigned int)(x->n - i - 1) * sizeof(key_t)); \
|
||||
memmove(&__KB_PTR(b, x)[i + 1], &__KB_PTR(b, x)[i + 2], (unsigned int)(x->n - i - 1) * sizeof(void*)); \
|
||||
memmove(&__KB_KEY(key_t, x)[i], &__KB_KEY(key_t, \
|
||||
x)[i + 1], \
|
||||
(unsigned int)(x->n - i - 1) * sizeof(key_t)); \
|
||||
memmove(&__KB_PTR(b, x)[i + 1], &__KB_PTR(b, \
|
||||
x)[i + 2], \
|
||||
(unsigned int)(x->n - i - 1) * sizeof(void *)); \
|
||||
--x->n; \
|
||||
XFREE_CLEAR(z); \
|
||||
return __kb_delp_aux_##name(b, y, k, s); \
|
||||
@@ -269,7 +282,9 @@
|
||||
if ((xp = __KB_PTR(b, x)[i])->n == T - 1) { \
|
||||
if (i > 0 && (y = __KB_PTR(b, x)[i - 1])->n >= T) { \
|
||||
memmove(&__KB_KEY(key_t, xp)[1], __KB_KEY(key_t, xp), (unsigned int)xp->n * sizeof(key_t)); \
|
||||
if (xp->is_internal) memmove(&__KB_PTR(b, xp)[1], __KB_PTR(b, xp), (unsigned int)(xp->n + 1) * sizeof(void*)); \
|
||||
if (xp->is_internal) memmove(&__KB_PTR(b, xp)[1], __KB_PTR(b, \
|
||||
xp), \
|
||||
(unsigned int)(xp->n + 1) * sizeof(void *)); \
|
||||
__KB_KEY(key_t, xp)[0] = __KB_KEY(key_t, x)[i - 1]; \
|
||||
__KB_KEY(key_t, x)[i - 1] = __KB_KEY(key_t, y)[y->n - 1]; \
|
||||
if (xp->is_internal) __KB_PTR(b, xp)[0] = __KB_PTR(b, y)[y->n]; \
|
||||
@@ -280,24 +295,38 @@
|
||||
if (xp->is_internal) __KB_PTR(b, xp)[xp->n] = __KB_PTR(b, y)[0]; \
|
||||
--y->n; \
|
||||
memmove(__KB_KEY(key_t, y), &__KB_KEY(key_t, y)[1], (unsigned int)y->n * sizeof(key_t)); \
|
||||
if (y->is_internal) memmove(__KB_PTR(b, y), &__KB_PTR(b, y)[1], (unsigned int)(y->n + 1) * sizeof(void*)); \
|
||||
if (y->is_internal) memmove(__KB_PTR(b, y), &__KB_PTR(b, \
|
||||
y)[1], \
|
||||
(unsigned int)(y->n + 1) * sizeof(void *)); \
|
||||
} else if (i > 0 && (y = __KB_PTR(b, x)[i - 1])->n == T - 1) { \
|
||||
__KB_KEY(key_t, y)[y->n++] = __KB_KEY(key_t, x)[i - 1]; \
|
||||
memmove(&__KB_KEY(key_t, y)[y->n], __KB_KEY(key_t, xp), (unsigned int)xp->n * sizeof(key_t)); \
|
||||
if (y->is_internal) memmove(&__KB_PTR(b, y)[y->n], __KB_PTR(b, xp), (unsigned int)(xp->n + 1) * sizeof(void*)); \
|
||||
memmove(&__KB_KEY(key_t, y)[y->n], __KB_KEY(key_t, xp), \
|
||||
(unsigned int)xp->n * sizeof(key_t)); \
|
||||
if (y->is_internal) memmove(&__KB_PTR(b, y)[y->n], __KB_PTR(b, \
|
||||
xp), \
|
||||
(unsigned int)(xp->n + 1) * sizeof(void *)); \
|
||||
y->n += xp->n; \
|
||||
memmove(&__KB_KEY(key_t, x)[i - 1], &__KB_KEY(key_t, x)[i], (unsigned int)(x->n - i) * sizeof(key_t)); \
|
||||
memmove(&__KB_PTR(b, x)[i], &__KB_PTR(b, x)[i + 1], (unsigned int)(x->n - i) * sizeof(void*)); \
|
||||
memmove(&__KB_KEY(key_t, x)[i - 1], &__KB_KEY(key_t, \
|
||||
x)[i], \
|
||||
(unsigned int)(x->n - i) * sizeof(key_t)); \
|
||||
memmove(&__KB_PTR(b, x)[i], &__KB_PTR(b, \
|
||||
x)[i + 1], (unsigned int)(x->n - i) * sizeof(void *)); \
|
||||
--x->n; \
|
||||
XFREE_CLEAR(xp); \
|
||||
xp = y; \
|
||||
} else if (i < x->n && (y = __KB_PTR(b, x)[i + 1])->n == T - 1) { \
|
||||
__KB_KEY(key_t, xp)[xp->n++] = __KB_KEY(key_t, x)[i]; \
|
||||
memmove(&__KB_KEY(key_t, xp)[xp->n], __KB_KEY(key_t, y), (unsigned int)y->n * sizeof(key_t)); \
|
||||
if (xp->is_internal) memmove(&__KB_PTR(b, xp)[xp->n], __KB_PTR(b, y), (unsigned int)(y->n + 1) * sizeof(void*)); \
|
||||
memmove(&__KB_KEY(key_t, xp)[xp->n], __KB_KEY(key_t, y), \
|
||||
(unsigned int)y->n * sizeof(key_t)); \
|
||||
if (xp->is_internal) memmove(&__KB_PTR(b, xp)[xp->n], __KB_PTR(b, y), \
|
||||
(unsigned int)(y->n + 1) * sizeof(void *)); \
|
||||
xp->n += y->n; \
|
||||
memmove(&__KB_KEY(key_t, x)[i], &__KB_KEY(key_t, x)[i + 1], (unsigned int)(x->n - i - 1) * sizeof(key_t)); \
|
||||
memmove(&__KB_PTR(b, x)[i + 1], &__KB_PTR(b, x)[i + 2], (unsigned int)(x->n - i - 1) * sizeof(void*)); \
|
||||
memmove(&__KB_KEY(key_t, x)[i], &__KB_KEY(key_t, \
|
||||
x)[i + 1], \
|
||||
(unsigned int)(x->n - i - 1) * sizeof(key_t)); \
|
||||
memmove(&__KB_PTR(b, x)[i + 1], &__KB_PTR(b, \
|
||||
x)[i + 2], \
|
||||
(unsigned int)(x->n - i - 1) * sizeof(void *)); \
|
||||
--x->n; \
|
||||
XFREE_CLEAR(y); \
|
||||
} \
|
||||
@@ -373,7 +402,8 @@
|
||||
if (itr->p->x && itr->p->i >= 0) return 1; \
|
||||
} \
|
||||
} \
|
||||
static inline int kb_itr_getp_##name(kbtree_##name##_t *b, key_t * __restrict k, kbitr_##name##_t *itr) \
|
||||
static inline int kb_itr_getp_##name(kbtree_##name##_t *b, key_t * __restrict k, \
|
||||
kbitr_##name##_t *itr) \
|
||||
{ \
|
||||
if (b->n_keys == 0) { \
|
||||
itr->p = NULL; \
|
||||
@@ -406,7 +436,8 @@
|
||||
}
|
||||
|
||||
#define KBTREE_INIT(name, key_t, __cmp, T) \
|
||||
KBTREE_INIT_IMPL(name, key_t, kbnode_##name##_t, __cmp, T, (sizeof(kbnode_##name##_t)+(2*T)*sizeof(void *)))
|
||||
KBTREE_INIT_IMPL(name, key_t, kbnode_##name##_t, __cmp, T, \
|
||||
(sizeof(kbnode_##name##_t)+(2*T)*sizeof(void *)))
|
||||
|
||||
#define KBTREE_INIT_IMPL(name, key_t, kbnode_t, __cmp, T, ILEN) \
|
||||
__KB_TREE_T(name, key_t, T) \
|
||||
|
@@ -1,5 +1,3 @@
|
||||
// uncrustify:off
|
||||
|
||||
/* The MIT License
|
||||
|
||||
Copyright (c) 2008, 2009, 2011 by Attractive Chaos <attractor@live.co.uk>
|
||||
@@ -127,16 +125,15 @@ int main() {
|
||||
|
||||
#define AC_VERSION_KHASH_H "0.2.8"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "nvim/memory.h"
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "nvim/func_attr.h"
|
||||
#include "nvim/memory.h"
|
||||
|
||||
/* compiler specific configuration */
|
||||
// compiler specific configuration
|
||||
|
||||
#if UINT_MAX == 0xffffffffu
|
||||
typedef unsigned int khint32_t;
|
||||
@@ -170,7 +167,8 @@ typedef khint_t khiter_t;
|
||||
#define __ac_fsize(m) ((m) < 16? 1 : (m)>>4)
|
||||
|
||||
#ifndef kroundup32
|
||||
#define kroundup32(x) (--(x), (x)|=(x)>>1, (x)|=(x)>>2, (x)|=(x)>>4, (x)|=(x)>>8, (x)|=(x)>>16, ++(x))
|
||||
# define kroundup32(x) (--(x), (x)|=(x)>>1, (x)|=(x)>>2, (x)|=(x)>>4, (x)|=(x)>>8, (x)|=(x)>>16, \
|
||||
++(x))
|
||||
#endif
|
||||
|
||||
#ifndef kcalloc
|
||||
@@ -281,12 +279,11 @@ typedef khint_t khiter_t;
|
||||
memset(new_flags, 0xaa, \
|
||||
__ac_fsize(new_n_buckets) * sizeof(khint32_t)); \
|
||||
if (h->n_buckets < new_n_buckets) { /* expand */ \
|
||||
khkey_t *new_keys = (khkey_t*)krealloc( \
|
||||
(void *)h->keys, new_n_buckets * sizeof(khkey_t)); \
|
||||
khkey_t *new_keys = (khkey_t *)krealloc((void *)h->keys, new_n_buckets * sizeof(khkey_t)); \
|
||||
h->keys = new_keys; \
|
||||
if (kh_is_map) { \
|
||||
khval_t *new_vals = (khval_t*)krealloc( \
|
||||
(void *)h->vals, new_n_buckets * sizeof(khval_t)); \
|
||||
khval_t *new_vals = \
|
||||
(khval_t *)krealloc((void *)h->vals, new_n_buckets * sizeof(khval_t)); \
|
||||
h->vals = new_vals; \
|
||||
} \
|
||||
} /* otherwise shrink */ \
|
||||
@@ -431,7 +428,7 @@ typedef khint_t khiter_t;
|
||||
#define KHASH_INIT(name, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal) \
|
||||
KHASH_INIT2(name, static kh_inline, khkey_t, khval_t, kh_is_map, __hash_func, __hash_equal)
|
||||
|
||||
/* --- BEGIN OF HASH FUNCTIONS --- */
|
||||
// --- BEGIN OF HASH FUNCTIONS ---
|
||||
|
||||
/*! @function
|
||||
@abstract Integer hash function
|
||||
@@ -461,7 +458,9 @@ typedef khint_t khiter_t;
|
||||
static kh_inline khint_t __ac_X31_hash_string(const char *s)
|
||||
{
|
||||
khint_t h = (khint_t)*s;
|
||||
if (h) for (++s ; *s; ++s) h = (h << 5) - h + (uint8_t)*s;
|
||||
if (h) {
|
||||
for (++s ; *s; ++s) { h = (h << 5) - h + (uint8_t)*s; }
|
||||
}
|
||||
return h;
|
||||
}
|
||||
/*! @function
|
||||
@@ -487,9 +486,9 @@ static kh_inline khint_t __ac_Wang_hash(khint_t key)
|
||||
}
|
||||
#define kh_int_hash_func2(k) __ac_Wang_hash((khint_t)key)
|
||||
|
||||
/* --- END OF HASH FUNCTIONS --- */
|
||||
// --- END OF HASH FUNCTIONS ---
|
||||
|
||||
/* Other convenient macros... */
|
||||
// Other convenient macros...
|
||||
|
||||
/*!
|
||||
@abstract Type of the hash table.
|
||||
@@ -667,7 +666,7 @@ static kh_inline khint_t __ac_Wang_hash(khint_t key)
|
||||
} \
|
||||
}
|
||||
|
||||
/* More conenient interfaces */
|
||||
// More conenient interfaces
|
||||
|
||||
/*! @function
|
||||
@abstract Instantiate a hash set containing integer keys
|
||||
|
@@ -1,5 +1,3 @@
|
||||
// uncrustify:off
|
||||
|
||||
/* The MIT License
|
||||
|
||||
Copyright (c) 2008-2009, by Attractive Chaos <attractor@live.co.uk>
|
||||
@@ -28,11 +26,11 @@
|
||||
#ifndef _AC_KLIST_H
|
||||
#define _AC_KLIST_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "nvim/memory.h"
|
||||
#include "nvim/func_attr.h"
|
||||
#include "nvim/memory.h"
|
||||
|
||||
|
||||
#define KMEMPOOL_INIT(name, kmptype_t, kmpfree_f) \
|
||||
|
@@ -1,5 +1,3 @@
|
||||
// uncrustify:off
|
||||
|
||||
// The MIT License
|
||||
//
|
||||
// Copyright (c) 2008, by Attractive Chaos <attractor@live.co.uk>
|
||||
@@ -138,8 +136,7 @@
|
||||
(v).items = (v).init_array)
|
||||
|
||||
/// Move data to a new destination and free source
|
||||
static inline void *_memcpy_free(void *const restrict dest,
|
||||
void *const restrict src,
|
||||
static inline void *_memcpy_free(void *const restrict dest, void *const restrict src,
|
||||
const size_t size)
|
||||
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_NONNULL_RET FUNC_ATTR_ALWAYS_INLINE
|
||||
{
|
||||
|
@@ -1,5 +1,3 @@
|
||||
// uncrustify:off
|
||||
|
||||
// Queue implemented by circularly-linked list.
|
||||
//
|
||||
// Adapted from libuv. Simpler and more efficient than klist.h for implementing
|
||||
|
@@ -1,5 +1,3 @@
|
||||
// uncrustify:off
|
||||
|
||||
/// Macros-based ring buffer implementation.
|
||||
///
|
||||
/// Supported functions:
|
||||
@@ -17,19 +15,24 @@
|
||||
#ifndef NVIM_LIB_RINGBUF_H
|
||||
#define NVIM_LIB_RINGBUF_H
|
||||
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "nvim/memory.h"
|
||||
#include "nvim/func_attr.h"
|
||||
#include "nvim/memory.h"
|
||||
|
||||
#define _RINGBUF_LENGTH(rb) \
|
||||
((rb)->first == NULL ? 0 \
|
||||
: ((rb)->next == (rb)->first) ? (size_t)((rb)->buf_end - (rb)->buf) + 1 \
|
||||
: ((rb)->next > (rb)->first) ? (size_t) ((rb)->next - (rb)->first) \
|
||||
: (size_t) ((rb)->next - (rb)->buf + (rb)->buf_end - (rb)->first + 1))
|
||||
: ((rb)->next > \
|
||||
(rb)->first) ? (size_t)((rb)->next - \
|
||||
(rb)->first) \
|
||||
: (size_t)((rb)->\
|
||||
next - (rb)->buf + \
|
||||
(rb)->buf_end - \
|
||||
(rb)->first + 1))
|
||||
|
||||
#define _RINGBUF_NEXT(rb, var) \
|
||||
((var) == (rb)->buf_end ? (rb)->buf : (var) + 1)
|
||||
@@ -164,11 +167,11 @@ static inline void funcprefix##_rb_push(TypeName##RingBuffer *const rb, \
|
||||
rb->next = _RINGBUF_NEXT(rb, rb->next); \
|
||||
} \
|
||||
\
|
||||
static inline ptrdiff_t funcprefix##_rb_find_idx( \
|
||||
const TypeName##RingBuffer *const rb, const RBType *const item_p) \
|
||||
static inline ptrdiff_t funcprefix##_rb_find_idx(const TypeName##RingBuffer *const rb, \
|
||||
const RBType *const item_p) \
|
||||
REAL_FATTR_NONNULL_ALL REAL_FATTR_PURE REAL_FATTR_UNUSED; \
|
||||
static inline ptrdiff_t funcprefix##_rb_find_idx( \
|
||||
const TypeName##RingBuffer *const rb, const RBType *const item_p) \
|
||||
static inline ptrdiff_t funcprefix##_rb_find_idx(const TypeName##RingBuffer *const rb, \
|
||||
const RBType *const item_p) \
|
||||
{ \
|
||||
assert(rb->buf <= item_p); \
|
||||
assert(rb->buf_end >= item_p); \
|
||||
@@ -181,29 +184,25 @@ static inline ptrdiff_t funcprefix##_rb_find_idx( \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
static inline size_t funcprefix##_rb_size( \
|
||||
const TypeName##RingBuffer *const rb) \
|
||||
static inline size_t funcprefix##_rb_size(const TypeName##RingBuffer *const rb) \
|
||||
REAL_FATTR_NONNULL_ALL REAL_FATTR_PURE; \
|
||||
static inline size_t funcprefix##_rb_size( \
|
||||
const TypeName##RingBuffer *const rb) \
|
||||
static inline size_t funcprefix##_rb_size(const TypeName##RingBuffer *const rb) \
|
||||
{ \
|
||||
return (size_t)(rb->buf_end - rb->buf) + 1; \
|
||||
} \
|
||||
\
|
||||
static inline size_t funcprefix##_rb_length( \
|
||||
const TypeName##RingBuffer *const rb) \
|
||||
static inline size_t funcprefix##_rb_length(const TypeName##RingBuffer *const rb) \
|
||||
REAL_FATTR_NONNULL_ALL REAL_FATTR_PURE; \
|
||||
static inline size_t funcprefix##_rb_length( \
|
||||
const TypeName##RingBuffer *const rb) \
|
||||
static inline size_t funcprefix##_rb_length(const TypeName##RingBuffer *const rb) \
|
||||
{ \
|
||||
return _RINGBUF_LENGTH(rb); \
|
||||
} \
|
||||
\
|
||||
static inline RBType *funcprefix##_rb_idx_p( \
|
||||
const TypeName##RingBuffer *const rb, const size_t idx) \
|
||||
static inline RBType *funcprefix##_rb_idx_p(const TypeName##RingBuffer *const rb, \
|
||||
const size_t idx) \
|
||||
REAL_FATTR_NONNULL_ALL REAL_FATTR_PURE; \
|
||||
static inline RBType *funcprefix##_rb_idx_p( \
|
||||
const TypeName##RingBuffer *const rb, const size_t idx) \
|
||||
static inline RBType *funcprefix##_rb_idx_p(const TypeName##RingBuffer *const rb, \
|
||||
const size_t idx) \
|
||||
{ \
|
||||
assert(idx <= funcprefix##_rb_size(rb)); \
|
||||
assert(idx <= funcprefix##_rb_length(rb)); \
|
||||
|
Reference in New Issue
Block a user