From 660c5a2db4f4fa74ef61d9a8df478458f234b4fc Mon Sep 17 00:00:00 2001 From: Patrick Pelissier Date: Wed, 1 Aug 2018 23:26:58 +0200 Subject: [PATCH] Add M_GET_STRING to transform a standard numerical C type into a string_t (with a method compatible with the operator GET_STR). --- m-core.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/m-core.h b/m-core.h index 21a1465b..f7e83e9c 100644 --- a/m-core.h +++ b/m-core.h @@ -1275,6 +1275,10 @@ /* Print a C variable if it is a standard type to the given file 'f'.*/ #define M_FPRINT_ARG(f, x) fprintf(f, M_PRINTF_FORMAT(x), x) +/* Transform a C variable into a string_t (needs m-string.h) */ +#define M_GET_STRING_ARG(string, x, append) \ + (append ? string_cat_printf : string_printf) (str, M_PRINTF_FORMAT(x), x) + #define M_SEPARATE_PER_SEMICOLON(a,b) a ; b /* Generic PRINT macro: print all its inputs regardless of the type