Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Simplification of output debug messages #154

Merged
merged 1 commit into from
May 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/common.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#ifndef COMMON_H_
#define COMMON_H_

#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <time.h>

#define __DCURL_MAJOR__ 0
Expand All @@ -10,6 +12,15 @@

double diff_in_second(struct timespec t1, struct timespec t2);

static inline void ddprintf(const char *format, ...) {
#if defined(ENABLE_DEBUG)
va_list ap;
va_start(ap, format);
vprintf(format, ap);
va_end(ap);
#endif
}

typedef struct _pow_info PoW_Info;

struct _pow_info {
Expand Down
6 changes: 2 additions & 4 deletions src/implcontext.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@ bool registerImplContext(ImplContext *impl_ctx)
bool initializeImplContext(ImplContext *impl_ctx)
{
bool res = impl_ctx->initialize(impl_ctx);
#if defined(ENABLE_DEBUG)
if (res) {
printf(MSG_PREFIX "Implementation %s is initialized successfully\n",
impl_ctx->description);
ddprintf(MSG_PREFIX "Implementation %s is initialized successfully\n",
impl_ctx->description);
}
#endif
return res;
}

Expand Down