File tree 3 files changed +28
-21
lines changed
3 files changed +28
-21
lines changed Original file line number Diff line number Diff line change 1
- 139,149d138
1
+ 140,150d139
2
2
< secp256k1_context* secp256k1_context_create(unsigned int flags) {
3
3
< size_t const prealloc_size = secp256k1_context_preallocated_size(flags);
4
4
< secp256k1_context* ctx = (secp256k1_context*)checked_malloc(&default_error_callback, prealloc_size);
10
10
< return ctx;
11
11
< }
12
12
<
13
- 164,174d152
13
+ 162,174d150
14
14
< secp256k1_context* secp256k1_context_clone(const secp256k1_context* ctx) {
15
15
< secp256k1_context* ret;
16
16
< size_t prealloc_size;
17
17
<
18
18
< VERIFY_CHECK(ctx != NULL);
19
+ < ARG_CHECK(secp256k1_context_is_proper(ctx));
20
+ <
19
21
< prealloc_size = secp256k1_context_preallocated_clone_size(ctx);
20
22
< ret = (secp256k1_context*)checked_malloc(&ctx->error_callback, prealloc_size);
21
23
< ret = secp256k1_context_preallocated_clone(ctx, ret);
22
24
< return ret;
23
25
< }
24
26
<
25
- 183,189d160
27
+ 186,197d161
26
28
< 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;
30
34
< }
35
+ <
36
+ < secp256k1_context_preallocated_destroy(ctx);
37
+ < free(ctx);
31
38
< }
32
39
<
33
- 206,215d176
40
+ 220,229d183
34
41
< }
35
42
<
36
43
< 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(
3
3
< unsigned int flags
4
4
< ) 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
8
8
< ) SECP256K1_ARG_NONNULL(1) SECP256K1_WARN_UNUSED_RESULT;
9
- 248,250d241
9
+ 313,315d306
10
10
< SECP256K1_API void secp256k1_context_destroy(
11
- < secp256k1_context* ctx
11
+ < secp256k1_context * ctx
12
12
< ) 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,
16
16
< size_t size
17
17
< ) SECP256K1_ARG_NONNULL(1);
18
- 338,341d324
18
+ 406,409d392
19
19
< 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
22
22
< ) SECP256K1_ARG_NONNULL(1);
Original file line number Diff line number Diff line change 1
- 71,86d70
1
+ 134,149d133
2
2
< static SECP256K1_INLINE void *checked_malloc(const secp256k1_callback* cb, size_t size) {
3
3
< void *ret = malloc(size);
4
4
< if (ret == NULL) {
You can’t perform that action at this time.
0 commit comments