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

Tracing macros #617

Open
DimitriPapadopoulos opened this issue Jun 11, 2024 · 1 comment
Open

Tracing macros #617

DimitriPapadopoulos opened this issue Jun 11, 2024 · 1 comment

Comments

@DimitriPapadopoulos
Copy link
Contributor

Describe the bug

I am not sure I understand the tracing macros:

c-blosc2/include/blosc2.h

Lines 114 to 129 in 3ae32b6

#define BLOSC_ERROR(rc) \
do { \
int rc_ = rc; \
if (rc_ < BLOSC2_ERROR_SUCCESS) { \
char *error_msg = print_error(rc_); \
BLOSC_TRACE_ERROR("%s", error_msg); \
return rc_; \
} \
} while (0)
#define BLOSC_INFO(msg, ...) \
do { \
const char *__e = getenv("BLOSC_INFO"); \
if (!__e) { break; } \
fprintf(stderr, "[INFO] - " msg "\n", ##__VA_ARGS__); \
} while(0)

  • BLOSC_ERROR calls BLOSC_TRACE_ERROR, which prints only if environment variable BLOSC_TRACE is defined
  • BLOSC_INFO prints directly if environment variable BLOSC_INFO is defined. Instead, I think it should call BLOSC_TRACE_INFO, which prints only if environment variable BLOSC_TRACE is defined.

I realise that it's probably unfeasible to modify things without slightly breaking backwards compatibility, but the current macros don't make sense to me: if environment only variable BLOSC_INFO is defined, BLOSC_INFO will print but BLOSC_ERROR will not print!

@FrancescAlted
Copy link
Member

I like your proposal of making interfaces more uniform. Right now BLOSC_INFO should not be used beyond developers, so I don't think we will break anything serious if we implement what you are proposing. Would you mind sending a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants