File tree Expand file tree Collapse file tree 3 files changed +28
-21
lines changed Expand file tree Collapse file tree 3 files changed +28
-21
lines changed Original file line number Diff line number Diff line change 1- 139,149d138
1+ 140,150d139
22< secp256k1_context* secp256k1_context_create(unsigned int flags) {
33< size_t const prealloc_size = secp256k1_context_preallocated_size(flags);
44< secp256k1_context* ctx = (secp256k1_context*)checked_malloc(&default_error_callback, prealloc_size);
1010< return ctx;
1111< }
1212<
13- 164,174d152
13+ 162,174d150
1414< secp256k1_context* secp256k1_context_clone(const secp256k1_context* ctx) {
1515< secp256k1_context* ret;
1616< size_t prealloc_size;
1717<
1818< VERIFY_CHECK(ctx != NULL);
19+ < ARG_CHECK(secp256k1_context_is_proper(ctx));
20+ <
1921< prealloc_size = secp256k1_context_preallocated_clone_size(ctx);
2022< ret = (secp256k1_context*)checked_malloc(&ctx->error_callback, prealloc_size);
2123< ret = secp256k1_context_preallocated_clone(ctx, ret);
2224< return ret;
2325< }
2426<
25- 183,189d160
27+ 186,197d161
2628< void secp256k1_context_destroy(secp256k1_context* ctx) {
27- < if (ctx != NULL) {
28- < secp256k1_context_preallocated_destroy(ctx);
29- < free(ctx);
29+ < ARG_CHECK_VOID(ctx == NULL || secp256k1_context_is_proper(ctx));
30+ <
31+ < /* Defined as noop */
32+ < if (ctx == NULL) {
33+ < return;
3034< }
35+ <
36+ < secp256k1_context_preallocated_destroy(ctx);
37+ < free(ctx);
3138< }
3239<
33- 206,215d176
40+ 220,229d183
3441< }
3542<
3643< secp256k1_scratch_space* secp256k1_scratch_space_create(const secp256k1_context* ctx, size_t max_size) {
Original file line number Diff line number Diff line change 1- 226,228d225
2- < SECP256K1_API secp256k1_context* secp256k1_context_create(
1+ 279,281d278
2+ < SECP256K1_API secp256k1_context * secp256k1_context_create(
33< unsigned int flags
44< ) SECP256K1_WARN_UNUSED_RESULT;
5- 231,233d227
6- < SECP256K1_API secp256k1_context* secp256k1_context_clone(
7- < const secp256k1_context* ctx
5+ 295,297d291
6+ < SECP256K1_API secp256k1_context * secp256k1_context_clone(
7+ < const secp256k1_context * ctx
88< ) SECP256K1_ARG_NONNULL(1) SECP256K1_WARN_UNUSED_RESULT;
9- 248,250d241
9+ 313,315d306
1010< SECP256K1_API void secp256k1_context_destroy(
11- < secp256k1_context* ctx
11+ < secp256k1_context * ctx
1212< ) SECP256K1_ARG_NONNULL(1);
13- 327,330d317
14- < SECP256K1_API SECP256K1_WARN_UNUSED_RESULT secp256k1_scratch_space* secp256k1_scratch_space_create(
15- < const secp256k1_context* ctx,
13+ 395,398d385
14+ < SECP256K1_API SECP256K1_WARN_UNUSED_RESULT secp256k1_scratch_space * secp256k1_scratch_space_create(
15+ < const secp256k1_context * ctx,
1616< size_t size
1717< ) SECP256K1_ARG_NONNULL(1);
18- 338,341d324
18+ 406,409d392
1919< SECP256K1_API void secp256k1_scratch_space_destroy(
20- < const secp256k1_context* ctx,
21- < secp256k1_scratch_space* scratch
20+ < const secp256k1_context * ctx,
21+ < secp256k1_scratch_space * scratch
2222< ) SECP256K1_ARG_NONNULL(1);
Original file line number Diff line number Diff line change 1- 71,86d70
1+ 134,149d133
22< static SECP256K1_INLINE void *checked_malloc(const secp256k1_callback* cb, size_t size) {
33< void *ret = malloc(size);
44< if (ret == NULL) {
You can’t perform that action at this time.
0 commit comments