VirtualBox

source: vbox/trunk/src/libs/openssl-3.0.7/include/crypto/sparse_array.h@ 98133

最後變更 在這個檔案從98133是 97984,由 vboxsync 提交於 2 年 前

libs/openssl-3.0.7: Shut up pragma once warnings for internal headers. Added sed script for doing that. bugref:10317

檔案大小: 3.4 KB
 
1/*
2 * Copyright 2019-2021 The OpenSSL Project Authors. All Rights Reserved.
3 * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
4 *
5 * Licensed under the Apache License 2.0 (the "License"). You may not use
6 * this file except in compliance with the License. You can obtain a copy
7 * in the file LICENSE in the source distribution or at
8 * https://www.openssl.org/source/license.html
9 */
10
11#ifndef OSSL_CRYPTO_SPARSE_ARRAY_H
12# define OSSL_CRYPTO_SPARSE_ARRAY_H
13# ifndef RT_WITHOUT_PRAGMA_ONCE /* VBOX */
14# pragma once
15# endif /* VBOX */
16
17# include <openssl/e_os2.h>
18
19# ifdef __cplusplus
20extern "C" {
21# endif
22
23# define SPARSE_ARRAY_OF(type) struct sparse_array_st_ ## type
24
25# define DEFINE_SPARSE_ARRAY_OF_INTERNAL(type, ctype) \
26 SPARSE_ARRAY_OF(type); \
27 static ossl_unused ossl_inline SPARSE_ARRAY_OF(type) * \
28 ossl_sa_##type##_new(void) \
29 { \
30 return (SPARSE_ARRAY_OF(type) *)ossl_sa_new(); \
31 } \
32 static ossl_unused ossl_inline void \
33 ossl_sa_##type##_free(SPARSE_ARRAY_OF(type) *sa) \
34 { \
35 ossl_sa_free((OPENSSL_SA *)sa); \
36 } \
37 static ossl_unused ossl_inline void \
38 ossl_sa_##type##_free_leaves(SPARSE_ARRAY_OF(type) *sa) \
39 { \
40 ossl_sa_free_leaves((OPENSSL_SA *)sa); \
41 } \
42 static ossl_unused ossl_inline size_t \
43 ossl_sa_##type##_num(const SPARSE_ARRAY_OF(type) *sa) \
44 { \
45 return ossl_sa_num((OPENSSL_SA *)sa); \
46 } \
47 static ossl_unused ossl_inline void \
48 ossl_sa_##type##_doall(const SPARSE_ARRAY_OF(type) *sa, \
49 void (*leaf)(ossl_uintmax_t, type *)) \
50 { \
51 ossl_sa_doall((OPENSSL_SA *)sa, \
52 (void (*)(ossl_uintmax_t, void *))leaf); \
53 } \
54 static ossl_unused ossl_inline void \
55 ossl_sa_##type##_doall_arg(const SPARSE_ARRAY_OF(type) *sa, \
56 void (*leaf)(ossl_uintmax_t, type *, void *), \
57 void *arg) \
58 { \
59 ossl_sa_doall_arg((OPENSSL_SA *)sa, \
60 (void (*)(ossl_uintmax_t, void *, void *))leaf, arg); \
61 } \
62 static ossl_unused ossl_inline ctype \
63 *ossl_sa_##type##_get(const SPARSE_ARRAY_OF(type) *sa, ossl_uintmax_t n) \
64 { \
65 return (type *)ossl_sa_get((OPENSSL_SA *)sa, n); \
66 } \
67 static ossl_unused ossl_inline int \
68 ossl_sa_##type##_set(SPARSE_ARRAY_OF(type) *sa, \
69 ossl_uintmax_t n, ctype *val) \
70 { \
71 return ossl_sa_set((OPENSSL_SA *)sa, n, (void *)val); \
72 } \
73 SPARSE_ARRAY_OF(type)
74
75# define DEFINE_SPARSE_ARRAY_OF(type) \
76 DEFINE_SPARSE_ARRAY_OF_INTERNAL(type, type)
77# define DEFINE_SPARSE_ARRAY_OF_CONST(type) \
78 DEFINE_SPARSE_ARRAY_OF_INTERNAL(type, const type)
79
80typedef struct sparse_array_st OPENSSL_SA;
81OPENSSL_SA *ossl_sa_new(void);
82void ossl_sa_free(OPENSSL_SA *sa);
83void ossl_sa_free_leaves(OPENSSL_SA *sa);
84size_t ossl_sa_num(const OPENSSL_SA *sa);
85void ossl_sa_doall(const OPENSSL_SA *sa, void (*leaf)(ossl_uintmax_t, void *));
86void ossl_sa_doall_arg(const OPENSSL_SA *sa,
87 void (*leaf)(ossl_uintmax_t, void *, void *), void *);
88void *ossl_sa_get(const OPENSSL_SA *sa, ossl_uintmax_t n);
89int ossl_sa_set(OPENSSL_SA *sa, ossl_uintmax_t n, void *val);
90
91# ifdef __cplusplus
92}
93# endif
94#endif
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette