Bitcoin Core 28.99.0
P2P Digital Currency
secp256k1_preallocated.h
Go to the documentation of this file.
1#ifndef SECP256K1_PREALLOCATED_H
2#define SECP256K1_PREALLOCATED_H
3
4#include "secp256k1.h"
5
6#ifdef __cplusplus
7extern "C" {
8#endif
9
10/* The module provided by this header file is intended for settings in which it
11 * is not possible or desirable to rely on dynamic memory allocation. It provides
12 * functions for creating, cloning, and destroying secp256k1 context objects in a
13 * contiguous fixed-size block of memory provided by the caller.
14 *
15 * Context objects created by functions in this module can be used like contexts
16 * objects created by functions in secp256k1.h, i.e., they can be passed to any
17 * API function that expects a context object (see secp256k1.h for details). The
18 * only exception is that context objects created by functions in this module
19 * must be destroyed using secp256k1_context_preallocated_destroy (in this
20 * module) instead of secp256k1_context_destroy (in secp256k1.h).
21 *
22 * It is guaranteed that functions in this module will not call malloc or its
23 * friends realloc, calloc, and free.
24 */
25
36 unsigned int flags
38
67 void *prealloc,
68 unsigned int flags
70
78 const secp256k1_context *ctx
80
101 const secp256k1_context *ctx,
102 void *prealloc
104
129
130#ifdef __cplusplus
131}
132#endif
133
134#endif /* SECP256K1_PREALLOCATED_H */
int flags
Definition: bitcoin-tx.cpp:536
#define SECP256K1_ARG_NONNULL(_x)
Definition: secp256k1.h:176
#define SECP256K1_API
Definition: secp256k1.h:161
#define SECP256K1_WARN_UNUSED_RESULT
Definition: secp256k1.h:171
SECP256K1_API size_t secp256k1_context_preallocated_clone_size(const secp256k1_context *ctx) SECP256K1_ARG_NONNULL(1) SECP256K1_WARN_UNUSED_RESULT
Determine the memory size of a secp256k1 context object to be copied into caller-provided memory.
Definition: secp256k1.c:112
SECP256K1_API void secp256k1_context_preallocated_destroy(secp256k1_context *ctx) SECP256K1_ARG_NONNULL(1)
Destroy a secp256k1 context object that has been created in caller-provided memory.
Definition: secp256k1.c:176
SECP256K1_API secp256k1_context * secp256k1_context_preallocated_create(void *prealloc, unsigned int flags) SECP256K1_ARG_NONNULL(1) SECP256K1_WARN_UNUSED_RESULT
Create a secp256k1 context object in caller-provided memory.
Definition: secp256k1.c:118
SECP256K1_API size_t secp256k1_context_preallocated_size(unsigned int flags) SECP256K1_WARN_UNUSED_RESULT
Determine the memory size of a secp256k1 context object to be created in caller-provided memory.
Definition: secp256k1.c:92
SECP256K1_API secp256k1_context * secp256k1_context_preallocated_clone(const secp256k1_context *ctx, void *prealloc) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_WARN_UNUSED_RESULT
Copy a secp256k1 context object into caller-provided memory.
Definition: secp256k1.c:152