55 **********************************************************************/ 
66
77#include  "include/secp256k1.h" 
8- #include  "include/secp256k1_prealloc .h" 
8+ #include  "include/secp256k1_preallocated .h" 
99
1010#include  "util.h" 
1111#include  "num_impl.h" 
@@ -65,7 +65,7 @@ static secp256k1_context secp256k1_context_no_precomp_ = {
6565};
6666secp256k1_context  * secp256k1_context_no_precomp  =  & secp256k1_context_no_precomp_ ;
6767
68- size_t  secp256k1_context_prealloc_size (unsigned int   flags ) {
68+ size_t  secp256k1_context_preallocated_size (unsigned int   flags ) {
6969    size_t  ret  =  ROUND_TO_ALIGN (sizeof (secp256k1_context ));
7070
7171    if  (EXPECT ((flags  &  SECP256K1_FLAGS_TYPE_MASK ) !=  SECP256K1_FLAGS_TYPE_CONTEXT , 0 )) {
@@ -76,34 +76,34 @@ size_t secp256k1_context_prealloc_size(unsigned int flags) {
7676    }
7777
7878    if  (flags  &  SECP256K1_FLAGS_BIT_CONTEXT_SIGN ) {
79-         ret  +=  secp256k1_ecmult_gen_context_prealloc_size ();
79+         ret  +=  secp256k1_ecmult_gen_context_preallocated_size ();
8080    }
8181    if  (flags  &  SECP256K1_FLAGS_BIT_CONTEXT_VERIFY ) {
82-         ret  +=  secp256k1_ecmult_context_prealloc_size ();
82+         ret  +=  secp256k1_ecmult_context_preallocated_size ();
8383    }
8484    return  ret ;
8585}
8686
87- size_t  secp256k1_context_prealloc_size_for_clone (const  secp256k1_context *  ctx ) {
87+ size_t  secp256k1_context_preallocated_size_for_clone (const  secp256k1_context *  ctx ) {
8888    size_t  ret  =  ROUND_TO_ALIGN (sizeof (secp256k1_context ));
8989    VERIFY_CHECK (ctx  !=  NULL );
9090    if  (secp256k1_ecmult_gen_context_is_built (& ctx -> ecmult_gen_ctx )) {
91-         ret  +=  secp256k1_ecmult_gen_context_prealloc_size ();
91+         ret  +=  secp256k1_ecmult_gen_context_preallocated_size ();
9292    }
9393    if  (secp256k1_ecmult_context_is_built (& ctx -> ecmult_ctx )) {
94-         ret  +=  secp256k1_ecmult_context_prealloc_size ();
94+         ret  +=  secp256k1_ecmult_context_preallocated_size ();
9595    }
9696    return  ret ;
9797}
9898
99- secp256k1_context *  secp256k1_context_prealloc_create (void *  prealloc , unsigned int   flags ) {
99+ secp256k1_context *  secp256k1_context_preallocated_create (void *  prealloc , unsigned int   flags ) {
100100    void *  const  base  =  prealloc ;
101101    size_t  prealloc_size ;
102102    secp256k1_context *  ret ;
103103
104104    VERIFY_CHECK (prealloc  !=  NULL );
105-     prealloc_size  =  secp256k1_context_prealloc_size (flags );
106-     ret  =  (secp256k1_context * )manual_alloc (& prealloc , sizeof (secp256k1_context ), base , prealloc_size );
105+     prealloc_size  =  secp256k1_context_preallocated_size (flags );
106+     ret  =  (secp256k1_context * )manual_malloc (& prealloc , sizeof (secp256k1_context ), base , prealloc_size );
107107    ret -> illegal_callback  =  default_illegal_callback ;
108108    ret -> error_callback  =  default_error_callback ;
109109
@@ -128,23 +128,23 @@ secp256k1_context* secp256k1_context_prealloc_create(void* prealloc, unsigned in
128128}
129129
130130secp256k1_context *  secp256k1_context_create (unsigned int   flags ) {
131-     size_t  const  prealloc_size  =  secp256k1_context_prealloc_size (flags );
131+     size_t  const  prealloc_size  =  secp256k1_context_preallocated_size (flags );
132132    secp256k1_context *  ctx  =  (secp256k1_context * )checked_malloc (& default_error_callback , prealloc_size );
133-     if  (EXPECT (secp256k1_context_prealloc_create (ctx , flags ) ==  NULL , 0 )) {
133+     if  (EXPECT (secp256k1_context_preallocated_create (ctx , flags ) ==  NULL , 0 )) {
134134        free (ctx );
135135        return  NULL ;
136136    }
137137
138138    return  ctx ;
139139}
140140
141- secp256k1_context *  secp256k1_context_prealloc_clone (const  secp256k1_context *  ctx , void *  prealloc ) {
141+ secp256k1_context *  secp256k1_context_preallocated_clone (const  secp256k1_context *  ctx , void *  prealloc ) {
142142    size_t  prealloc_size ;
143143    secp256k1_context *  ret ;
144144    VERIFY_CHECK (ctx  !=  NULL );
145145    ARG_CHECK (prealloc  !=  NULL );
146146
147-     prealloc_size  =  secp256k1_context_prealloc_size_for_clone (ctx );
147+     prealloc_size  =  secp256k1_context_preallocated_size_for_clone (ctx );
148148    ret  =  (secp256k1_context * )prealloc ;
149149    memcpy (ret , ctx , prealloc_size );
150150    secp256k1_ecmult_gen_context_finalize_memcpy (& ret -> ecmult_gen_ctx , & ctx -> ecmult_gen_ctx );
@@ -157,13 +157,13 @@ secp256k1_context* secp256k1_context_clone(const secp256k1_context* ctx) {
157157    size_t  prealloc_size ;
158158
159159    VERIFY_CHECK (ctx  !=  NULL );
160-     prealloc_size  =  secp256k1_context_prealloc_size_for_clone (ctx );
160+     prealloc_size  =  secp256k1_context_preallocated_size_for_clone (ctx );
161161    ret  =  (secp256k1_context * )checked_malloc (& ctx -> error_callback , prealloc_size );
162-     ret  =  secp256k1_context_prealloc_clone (ctx , ret );
162+     ret  =  secp256k1_context_preallocated_clone (ctx , ret );
163163    return  ret ;
164164}
165165
166- void  secp256k1_context_prealloc_destroy (secp256k1_context *  ctx ) {
166+ void  secp256k1_context_preallocated_destroy (secp256k1_context *  ctx ) {
167167    if  (ctx  !=  NULL ) {
168168        secp256k1_ecmult_context_clear (& ctx -> ecmult_ctx );
169169        secp256k1_ecmult_gen_context_clear (& ctx -> ecmult_gen_ctx );
@@ -172,7 +172,7 @@ void secp256k1_context_prealloc_destroy(secp256k1_context* ctx) {
172172
173173void  secp256k1_context_destroy (secp256k1_context *  ctx ) {
174174    if  (ctx  !=  NULL ) {
175-         secp256k1_context_prealloc_destroy (ctx );
175+         secp256k1_context_preallocated_destroy (ctx );
176176        free (ctx );
177177    }
178178}
0 commit comments