From f93835add98343d454b8f4321c9a7f8708012b74 Mon Sep 17 00:00:00 2001 From: Philip Wendland Date: Fri, 3 Apr 2015 21:07:49 +0200 Subject: [PATCH] Allow log functions to be called with ctx==NULL This change allows functions to be used from places where there is no sc_context (ctx) available. --- src/libopensc/log.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/libopensc/log.c b/src/libopensc/log.c index 32f396d8..9d98413b 100644 --- a/src/libopensc/log.c +++ b/src/libopensc/log.c @@ -73,9 +73,7 @@ static void sc_do_log_va(sc_context_t *ctx, int level, const char *file, int lin FILE *outf = NULL; int n; - assert(ctx != NULL); - - if (ctx->debug < level) + if (!ctx || ctx->debug < level) return; p = buf; @@ -167,9 +165,7 @@ void sc_hex_dump(struct sc_context *ctx, int level, const u8 * in, size_t count, char *p = buf; int lines = 0; - assert(ctx != NULL); - - if (ctx->debug < level) + if (!ctx || ctx->debug < level) return; assert(buf != NULL && (in != NULL || count == 0));