aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crypto/c_src
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2012-10-22 17:59:51 +0200
committerSverker Eriksson <[email protected]>2012-10-22 17:59:51 +0200
commit8d502f8f98a89678448d16a8a15e744d65603f01 (patch)
tree19dec96bcf4747e26b2db29200810cd6ad2c0a57 /lib/crypto/c_src
parentd969763b18582c8c879ab3dd9e3ce37502430972 (diff)
downloadotp-8d502f8f98a89678448d16a8a15e744d65603f01.tar.gz
otp-8d502f8f98a89678448d16a8a15e744d65603f01.tar.bz2
otp-8d502f8f98a89678448d16a8a15e744d65603f01.zip
crypto: Add debug print macros
Diffstat (limited to 'lib/crypto/c_src')
-rw-r--r--lib/crypto/c_src/crypto.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/crypto/c_src/crypto.c b/lib/crypto/c_src/crypto.c
index c98dacc3eb..ea0bb10cb7 100644
--- a/lib/crypto/c_src/crypto.c
+++ b/lib/crypto/c_src/crypto.c
@@ -363,13 +363,20 @@ static ERL_NIF_TERM atom_none;
static ERL_NIF_TERM atom_notsup;
static ERL_NIF_TERM atom_digest;
+/*
+#define PRINTF_ERR0(FMT) enif_fprintf(stderr, FMT "\n")
+#define PRINTF_ERR1(FMT, A1) enif_fprintf(stderr, FMT "\n", A1)
+*/
+#define PRINTF_ERR0(FMT)
+#define PRINTF_ERR1(FMT,A1)
+
static int change_basename(char* buf, int bufsz, const char* newfile)
{
char* p = strrchr(buf, '/');
p = (p == NULL) ? buf : p + 1;
if ((p - buf) + strlen(newfile) >= bufsz) {
- /*fprintf(stderr, "CRYPTO: lib name too long\r\n");*/
+ PRINTF_ERR0("CRYPTO: lib name too long");
return 0;
}
strcpy(p, newfile);
@@ -378,7 +385,7 @@ static int change_basename(char* buf, int bufsz, const char* newfile)
static void error_handler(void* null, const char* errstr)
{
- /*fprintf(stderr, "CRYPTO LOADING ERROR: '%s'\r\n", errstr);*/
+ PRINTF_ERR1("CRYPTO LOADING ERROR: '%s'", errstr);
}
static int init(ErlNifEnv* env, ERL_NIF_TERM load_info)
@@ -401,7 +408,7 @@ static int init(ErlNifEnv* env, ERL_NIF_TERM load_info)
|| vernum != 201
|| enif_get_string(env, tpl_array[1], lib_buf, sizeof(lib_buf), ERL_NIF_LATIN1) <= 0) {
- /*enif_fprintf(stderr, "CRYPTO: Invalid load_info '%T'\n", load_info);*/
+ PRINTF_ERR1("CRYPTO: Invalid load_info '%T'", load_info);
return 0;
}
if (library_refc > 0) {
@@ -461,7 +468,7 @@ static int init(ErlNifEnv* env, ERL_NIF_TERM load_info)
ccb = (*funcp)(nlocks);
if (!ccb || ccb->sizeof_me != sizeof(*ccb)) {
- /*fprintf(stderr, "Invalid 'crypto_callbacks'\r\n");*/
+ PRINTF_ERR0("Invalid 'crypto_callbacks'");
return 0;
}