diff options
| author | EuAndreh <eu@euandre.org> | 2025-01-17 10:53:59 -0300 |
|---|---|---|
| committer | EuAndreh <eu@euandre.org> | 2025-01-17 10:53:59 -0300 |
| commit | 6339fc0f869fe275acdd70e47a4c64100cdcf28a (patch) | |
| tree | d3fc0eaec22eaabee053979c9649b6043cde5702 | |
| parent | src/trace.c: Replace thread_local with pthreads (diff) | |
| download | pindaiba-6339fc0f869fe275acdd70e47a4c64100cdcf28a.tar.gz pindaiba-6339fc0f869fe275acdd70e47a4c64100cdcf28a.tar.xz | |
src/trace.c: Add explicit cast for uintptr_t
| -rw-r--r-- | src/trace.c | 5 | ||||
| -rw-r--r-- | tests/trace.c | 2 |
2 files changed, 4 insertions, 3 deletions
diff --git a/src/trace.c b/src/trace.c index d21a792..f4994c8 100644 --- a/src/trace.c +++ b/src/trace.c @@ -4,6 +4,7 @@ #include <errno.h> #include <pthread.h> #include <stdarg.h> +#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -44,7 +45,7 @@ vftracef( ) { assert(pthread_once(&ONCE, init) == 0); - const enum TraceLevel current_level = (enum TraceLevel)pthread_getspecific(LEVEL_KEY); + const enum TraceLevel current_level = (enum TraceLevel)(intptr_t)pthread_getspecific(LEVEL_KEY); if (level > current_level) { return; } @@ -104,5 +105,5 @@ int trace_set_level(const enum TraceLevel level) { assert(level >= TraceLevel_NONE); assert(level <= TraceLevel_DEBUG); - return pthread_setspecific(LEVEL_KEY, (void *)level); + return pthread_setspecific(LEVEL_KEY, (void *)(intptr_t)level); } diff --git a/tests/trace.c b/tests/trace.c index 5b59a46..e98c291 100644 --- a/tests/trace.c +++ b/tests/trace.c @@ -19,7 +19,7 @@ test_ftracef(void) { FILE *file = NULL; char *str = NULL; - const enum TraceLevel orig = (enum TraceLevel)pthread_getspecific(LEVEL_KEY); + const enum TraceLevel orig = (enum TraceLevel)(intptr_t)pthread_getspecific(LEVEL_KEY); trace_set_level(TraceLevel_INFO); { |
