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.
This commit is contained in:
Philip Wendland 2015-04-03 21:07:49 +02:00 committed by Viktor Tarasov
parent 95ad11a253
commit f93835add9
1 changed files with 2 additions and 6 deletions

View File

@ -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));