Bitcoin ABC  0.26.3
P2P Digital Currency
Go to the documentation of this file.
1 /***********************************************************************
2  * Copyright (c) 2017 Andrew Poelstra *
3  * Distributed under the MIT software license, see the accompanying *
4  * file COPYING or*
5  ***********************************************************************/
7 #ifndef SECP256K1_SCRATCH_H
8 #define SECP256K1_SCRATCH_H
10 /* The typedef is used internally; the struct name is used in the public API
11  * (where it is exposed as a different typedef) */
14  unsigned char magic[8];
16  void *data;
19  size_t alloc_size;
21  size_t max_size;
24 static secp256k1_scratch* secp256k1_scratch_create(const secp256k1_callback* error_callback, size_t max_size);
26 static void secp256k1_scratch_destroy(const secp256k1_callback* error_callback, secp256k1_scratch* scratch);
30 static size_t secp256k1_scratch_checkpoint(const secp256k1_callback* error_callback, const secp256k1_scratch* scratch);
34 static void secp256k1_scratch_apply_checkpoint(const secp256k1_callback* error_callback, secp256k1_scratch* scratch, size_t checkpoint);
37 static size_t secp256k1_scratch_max_allocation(const secp256k1_callback* error_callback, const secp256k1_scratch* scratch, size_t n_objects);
40 static void *secp256k1_scratch_alloc(const secp256k1_callback* error_callback, secp256k1_scratch* scratch, size_t n);
42 #endif
static void secp256k1_scratch_apply_checkpoint(const secp256k1_callback *error_callback, secp256k1_scratch *scratch, size_t checkpoint)
Applies a check point received from secp256k1_scratch_checkpoint, undoing all allocations since that ...
static void * secp256k1_scratch_alloc(const secp256k1_callback *error_callback, secp256k1_scratch *scratch, size_t n)
Returns a pointer into the most recently allocated frame, or NULL if there is insufficient available ...
static void secp256k1_scratch_destroy(const secp256k1_callback *error_callback, secp256k1_scratch *scratch)
static secp256k1_scratch * secp256k1_scratch_create(const secp256k1_callback *error_callback, size_t max_size)
static size_t secp256k1_scratch_max_allocation(const secp256k1_callback *error_callback, const secp256k1_scratch *scratch, size_t n_objects)
Returns the maximum allocation the scratch space will allow.
struct secp256k1_scratch_space_struct secp256k1_scratch
static size_t secp256k1_scratch_checkpoint(const secp256k1_callback *error_callback, const secp256k1_scratch *scratch)
Returns an opaque object used to "checkpoint" a scratch space.
size_t alloc_size
amount that has been allocated (i.e.
Definition: scratch.h:19
size_t max_size
maximum size available to allocate
Definition: scratch.h:21
void * data
actual allocated data
Definition: scratch.h:16
unsigned char magic[8]
guard against interpreting this object as other types
Definition: scratch.h:14