From be6a8c76f021a2cba3d371c16bfb84a8264f51fe Mon Sep 17 00:00:00 2001 From: Marian Buschsieweke Date: Sat, 20 May 2023 21:41:32 +0200 Subject: [PATCH] fix -Wformat-nonliteral by using printf() directly --- include/relic_util.h | 2 +- src/relic_util.c | 36 ------------------------------------ 2 files changed, 1 insertion(+), 37 deletions(-) diff --git a/include/relic_util.h b/include/relic_util.h index 0dd1744..74e3216 100644 --- a/include/relic_util.h +++ b/include/relic_util.h @@ -296,7 +296,7 @@ int util_cmp_const(const void *a, const void *b, int n); * @param[in] format - the format. * @param[in] ... - the list of arguments matching the format. */ -void util_printf(const char *format, ...); +#define util_printf(...) printf(__VA_ARGS__) /** * Prints a digit. diff --git a/src/relic_util.c b/src/relic_util.c index 3bb369d..133153d 100644 --- a/src/relic_util.c +++ b/src/relic_util.c @@ -151,42 +151,6 @@ int util_cmp_const(const void *a, const void *b, int size) { return (result == 0 ? RLC_EQ : RLC_NE); } -#ifndef QUIET -void util_print(const char *format, ...) { -#if ARCH == AVR && !defined(OPSYS) - util_print_ptr = print_buf + 1; - va_list list; - va_start(list, format); - vsnprintf_P((char *)util_print_ptr, sizeof(print_buf) - 1, format, list); - va_end(list); - print_buf[0] = (uint8_t)2; -#elif ARCH == AVR && OPSYS == DUINO - stdout = &uart_output; - va_list list; - va_start(list, format); - vsnprintf_P((char *)print_buf, sizeof(print_buf), format, list); - printf("%s", (char *)print_buf); - va_end(list); -#elif ARCH == MSP && !defined(OPSYS) - va_list list; - va_start(list, format); - vprintf(format, list); - va_end(list); -#elif ARCH == ARM && OPSYS == DROID - va_list list; - va_start(list, format); - __android_log_vprint(ANDROID_LOG_INFO, "relic-toolkit", format, list); - va_end(list); -#else - va_list list; - va_start(list, format); - vprintf(format, list); - fflush(stdout); - va_end(list); -#endif -} -#endif - void util_print_dig(dig_t a, int pad) { #if RLC_DIG == 64 if (pad) { -- 2.40.1