Bitcoin ABC  0.28.12
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
7 extern "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 
65  void* prealloc,
66  unsigned int flags
68 
76  const secp256k1_context* ctx
78 
96  const secp256k1_context* ctx,
97  void* prealloc
99 
122 );
123 
124 #ifdef __cplusplus
125 }
126 #endif
127 
128 #endif /* SECP256K1_PREALLOCATED_H */
secp256k1_context * ctx
int flags
Definition: bitcoin-tx.cpp:533
#define SECP256K1_ARG_NONNULL(_x)
Definition: secp256k1.h:155
#define SECP256K1_API
Definition: secp256k1.h:140
#define SECP256K1_WARN_UNUSED_RESULT
Warning attributes NONNULL is not used if SECP256K1_BUILD is set to avoid the compiler optimizing out...
Definition: secp256k1.h:150
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 void secp256k1_context_preallocated_destroy(secp256k1_context *ctx)
Destroy a secp256k1 context object that has been created in caller-provided memory.
Definition: secp256k1.c:188
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:106
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:86
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:163