aboutsummaryrefslogtreecommitdiff
path: root/include/crypto/sparse_array.h
diff options
context:
space:
mode:
authorEnji Cooper <ngie@FreeBSD.org>2026-01-29 01:27:53 +0000
committerEnji Cooper <ngie@FreeBSD.org>2026-01-29 01:27:53 +0000
commit808413da28df9fb93e1f304e6016b15e660f54c8 (patch)
treef3ecb4f928716223c9563ee34e044ab84549debb /include/crypto/sparse_array.h
parent8e12a5c4eb3507846b507d0afe87d115af41df40 (diff)
Diffstat (limited to 'include/crypto/sparse_array.h')
-rw-r--r--include/crypto/sparse_array.h116
1 files changed, 57 insertions, 59 deletions
diff --git a/include/crypto/sparse_array.h b/include/crypto/sparse_array.h
index 7ef742837989..d2629000eeaf 100644
--- a/include/crypto/sparse_array.h
+++ b/include/crypto/sparse_array.h
@@ -9,70 +9,68 @@
*/
#ifndef OSSL_CRYPTO_SPARSE_ARRAY_H
-# define OSSL_CRYPTO_SPARSE_ARRAY_H
-# pragma once
+#define OSSL_CRYPTO_SPARSE_ARRAY_H
+#pragma once
-# include <openssl/e_os2.h>
+#include <openssl/e_os2.h>
-# ifdef __cplusplus
+#ifdef __cplusplus
extern "C" {
-# endif
+#endif
-# define SPARSE_ARRAY_OF(type) struct sparse_array_st_ ## type
+#define SPARSE_ARRAY_OF(type) struct sparse_array_st_##type
-# define DEFINE_SPARSE_ARRAY_OF_INTERNAL(type, ctype) \
- SPARSE_ARRAY_OF(type); \
- static ossl_unused ossl_inline SPARSE_ARRAY_OF(type) * \
- ossl_sa_##type##_new(void) \
- { \
- return (SPARSE_ARRAY_OF(type) *)ossl_sa_new(); \
- } \
- static ossl_unused ossl_inline void \
- ossl_sa_##type##_free(SPARSE_ARRAY_OF(type) *sa) \
- { \
- ossl_sa_free((OPENSSL_SA *)sa); \
- } \
- static ossl_unused ossl_inline void \
- ossl_sa_##type##_free_leaves(SPARSE_ARRAY_OF(type) *sa) \
- { \
- ossl_sa_free_leaves((OPENSSL_SA *)sa); \
- } \
- static ossl_unused ossl_inline size_t \
- ossl_sa_##type##_num(const SPARSE_ARRAY_OF(type) *sa) \
- { \
- return ossl_sa_num((OPENSSL_SA *)sa); \
- } \
- static ossl_unused ossl_inline void \
- ossl_sa_##type##_doall(const SPARSE_ARRAY_OF(type) *sa, \
- void (*leaf)(ossl_uintmax_t, type *)) \
- { \
- ossl_sa_doall((OPENSSL_SA *)sa, \
- (void (*)(ossl_uintmax_t, void *))leaf); \
- } \
- static ossl_unused ossl_inline void \
- ossl_sa_##type##_doall_arg(const SPARSE_ARRAY_OF(type) *sa, \
- void (*leaf)(ossl_uintmax_t, type *, void *), \
- void *arg) \
- { \
- ossl_sa_doall_arg((OPENSSL_SA *)sa, \
- (void (*)(ossl_uintmax_t, void *, void *))leaf, arg); \
- } \
- static ossl_unused ossl_inline ctype \
- *ossl_sa_##type##_get(const SPARSE_ARRAY_OF(type) *sa, ossl_uintmax_t n) \
- { \
- return (type *)ossl_sa_get((OPENSSL_SA *)sa, n); \
- } \
- static ossl_unused ossl_inline int \
- ossl_sa_##type##_set(SPARSE_ARRAY_OF(type) *sa, \
- ossl_uintmax_t n, ctype *val) \
- { \
- return ossl_sa_set((OPENSSL_SA *)sa, n, (void *)val); \
- } \
+#define DEFINE_SPARSE_ARRAY_OF_INTERNAL(type, ctype) \
+ SPARSE_ARRAY_OF(type); \
+ static ossl_unused ossl_inline SPARSE_ARRAY_OF(type) * ossl_sa_##type##_new(void) \
+ { \
+ return (SPARSE_ARRAY_OF(type) *)ossl_sa_new(); \
+ } \
+ static ossl_unused ossl_inline void \
+ ossl_sa_##type##_free(SPARSE_ARRAY_OF(type) * sa) \
+ { \
+ ossl_sa_free((OPENSSL_SA *)sa); \
+ } \
+ static ossl_unused ossl_inline void \
+ ossl_sa_##type##_free_leaves(SPARSE_ARRAY_OF(type) * sa) \
+ { \
+ ossl_sa_free_leaves((OPENSSL_SA *)sa); \
+ } \
+ static ossl_unused ossl_inline size_t \
+ ossl_sa_##type##_num(const SPARSE_ARRAY_OF(type) * sa) \
+ { \
+ return ossl_sa_num((OPENSSL_SA *)sa); \
+ } \
+ static ossl_unused ossl_inline void \
+ ossl_sa_##type##_doall(const SPARSE_ARRAY_OF(type) * sa, \
+ void (*leaf)(ossl_uintmax_t, type *)) \
+ { \
+ ossl_sa_doall((OPENSSL_SA *)sa, \
+ (void (*)(ossl_uintmax_t, void *))leaf); \
+ } \
+ static ossl_unused ossl_inline void \
+ ossl_sa_##type##_doall_arg(const SPARSE_ARRAY_OF(type) * sa, \
+ void (*leaf)(ossl_uintmax_t, type *, void *), \
+ void *arg) \
+ { \
+ ossl_sa_doall_arg((OPENSSL_SA *)sa, \
+ (void (*)(ossl_uintmax_t, void *, void *))leaf, arg); \
+ } \
+ static ossl_unused ossl_inline ctype *ossl_sa_##type##_get(const SPARSE_ARRAY_OF(type) * sa, ossl_uintmax_t n) \
+ { \
+ return (type *)ossl_sa_get((OPENSSL_SA *)sa, n); \
+ } \
+ static ossl_unused ossl_inline int \
+ ossl_sa_##type##_set(SPARSE_ARRAY_OF(type) * sa, \
+ ossl_uintmax_t n, ctype * val) \
+ { \
+ return ossl_sa_set((OPENSSL_SA *)sa, n, (void *)val); \
+ } \
SPARSE_ARRAY_OF(type)
-# define DEFINE_SPARSE_ARRAY_OF(type) \
+#define DEFINE_SPARSE_ARRAY_OF(type) \
DEFINE_SPARSE_ARRAY_OF_INTERNAL(type, type)
-# define DEFINE_SPARSE_ARRAY_OF_CONST(type) \
+#define DEFINE_SPARSE_ARRAY_OF_CONST(type) \
DEFINE_SPARSE_ARRAY_OF_INTERNAL(type, const type)
typedef struct sparse_array_st OPENSSL_SA;
@@ -82,11 +80,11 @@ void ossl_sa_free_leaves(OPENSSL_SA *sa);
size_t ossl_sa_num(const OPENSSL_SA *sa);
void ossl_sa_doall(const OPENSSL_SA *sa, void (*leaf)(ossl_uintmax_t, void *));
void ossl_sa_doall_arg(const OPENSSL_SA *sa,
- void (*leaf)(ossl_uintmax_t, void *, void *), void *);
+ void (*leaf)(ossl_uintmax_t, void *, void *), void *);
void *ossl_sa_get(const OPENSSL_SA *sa, ossl_uintmax_t n);
int ossl_sa_set(OPENSSL_SA *sa, ossl_uintmax_t n, void *val);
-# ifdef __cplusplus
+#ifdef __cplusplus
}
-# endif
+#endif
#endif