From 84a0dcba27a6beac8dea43b95ae61e50cdfb0526 Mon Sep 17 00:00:00 2001 From: Kp Date: Thu, 19 Dec 2013 22:52:03 +0000 Subject: [PATCH] Rename con_puts length template --- common/include/console.h | 9 +++------ common/include/fmtcheck.h | 2 ++ 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/common/include/console.h b/common/include/console.h index b0bd32217..d5a1f597d 100644 --- a/common/include/console.h +++ b/common/include/console.h @@ -37,17 +37,14 @@ typedef struct console_buffer void con_init(void); void con_puts(int level, const char *str, size_t len) __attribute_nonnull(); -static inline void con_puts(int level, const char *str) -{ - con_puts(level, str, strlen(str)); -} template -static inline void con_puts(int level, const char (&str)[len]) +static inline void con_puts_literal(int level, const char (&str)[len]) { con_puts(level, str, len - 1); } +#define con_puts(A1,S,...) (con_puts(A1,S, _dxx_call_puts_parameter2(1, ## __VA_ARGS__, strlen(S)))) void con_printf(int level, const char *fmt, ...) __attribute_format_printf(2, 3); -#define con_printf(A1,F,...) dxx_call_printf_checked(con_printf,con_puts,(A1),(F),##__VA_ARGS__) +#define con_printf(A1,F,...) dxx_call_printf_checked(con_printf,con_puts_literal,(A1),(F),##__VA_ARGS__) void con_showup(void); #endif diff --git a/common/include/fmtcheck.h b/common/include/fmtcheck.h index 2f71f45b0..3b650aca9 100644 --- a/common/include/fmtcheck.h +++ b/common/include/fmtcheck.h @@ -12,6 +12,8 @@ #define _dxx_printf_raise_error(N,S) (0) #endif +#define _dxx_call_puts_parameter2(A,B,...) B + #define _dxx_call_printf_unwrap_args(...) , ## __VA_ARGS__ #define _dxx_call_printf_delete_comma2(A,...) __VA_ARGS__ #define _dxx_call_printf_delete_comma(A,...) _dxx_call_printf_delete_comma2( A , ## __VA_ARGS__ )