Skip to content

Commit

Permalink
Add secp256k1_ prefix to default callback functions
Browse files Browse the repository at this point in the history
  • Loading branch information
real-or-random committed May 26, 2019
1 parent 908bdce commit 77defd2
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/secp256k1.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,28 +36,28 @@
#ifndef USE_EXTERNAL_DEFAULT_CALLBACKS
#include <stdlib.h>
#include <stdio.h>
static void default_illegal_callback_fn(const char* str, void* data) {
static void secp256k1_default_illegal_callback_fn(const char* str, void* data) {
(void)data;
fprintf(stderr, "[libsecp256k1] illegal argument: %s\n", str);
abort();
}
static void default_error_callback_fn(const char* str, void* data) {
static void secp256k1_default_error_callback_fn(const char* str, void* data) {
(void)data;
fprintf(stderr, "[libsecp256k1] internal consistency check failed: %s\n", str);
abort();
}
#else
void default_illegal_callback_fn(const char* str, void* data);
void default_error_callback_fn(const char* str, void* data);
void secp256k1_default_illegal_callback_fn(const char* str, void* data);
void secp256k1_default_error_callback_fn(const char* str, void* data);
#endif

static const secp256k1_callback default_illegal_callback = {
default_illegal_callback_fn,
secp256k1_default_illegal_callback_fn,
NULL
};

static const secp256k1_callback default_error_callback = {
default_error_callback_fn,
secp256k1_default_error_callback_fn,
NULL
};

Expand All @@ -71,8 +71,8 @@ struct secp256k1_context_struct {
static const secp256k1_context secp256k1_context_no_precomp_ = {
{ 0 },
{ 0 },
{ default_illegal_callback_fn, 0 },
{ default_error_callback_fn, 0 }
{ secp256k1_default_illegal_callback_fn, 0 },
{ secp256k1_default_error_callback_fn, 0 }
};
const secp256k1_context *secp256k1_context_no_precomp = &secp256k1_context_no_precomp_;

Expand Down Expand Up @@ -190,7 +190,7 @@ void secp256k1_context_destroy(secp256k1_context* ctx) {
void secp256k1_context_set_illegal_callback(secp256k1_context* ctx, void (*fun)(const char* message, void* data), const void* data) {
ARG_CHECK_NO_RETURN(ctx != secp256k1_context_no_precomp);
if (fun == NULL) {
fun = default_illegal_callback_fn;
fun = secp256k1_default_illegal_callback_fn;
}
ctx->illegal_callback.fn = fun;
ctx->illegal_callback.data = data;
Expand All @@ -199,7 +199,7 @@ void secp256k1_context_set_illegal_callback(secp256k1_context* ctx, void (*fun)(
void secp256k1_context_set_error_callback(secp256k1_context* ctx, void (*fun)(const char* message, void* data), const void* data) {
ARG_CHECK_NO_RETURN(ctx != secp256k1_context_no_precomp);
if (fun == NULL) {
fun = default_error_callback_fn;
fun = secp256k1_default_error_callback_fn;
}
ctx->error_callback.fn = fun;
ctx->error_callback.data = data;
Expand Down

0 comments on commit 77defd2

Please sign in to comment.