Commit 725a576d authored by Michael Beck's avatar Michael Beck
Browse files

Fixed r28259 which broke hh and h modifier.

We must differentiate between the value type and the va_arg type ...

[r28262]
parent c4a605b6
......@@ -144,7 +144,7 @@ static int dispatch_snprintf(char *buf, size_t len, const char *fmt,
int res = 0;
switch (lc_arg_type) {
#define LC_ARG_TYPE(type,name) \
#define LC_ARG_TYPE(type,name,va_type) \
case lc_arg_type_ ## name: res = snprintf(buf, len, fmt, val->v_ ## name); break;
#include "lc_printf_arg_types.def"
#undef LC_ARG_TYPE
......@@ -491,7 +491,8 @@ int lc_evpprintf(const lc_arg_env_t *env, lc_appendable_t *app, const char *fmt,
/* Store the value according to argument information */
switch (occ.lc_arg_type) {
#define LC_ARG_TYPE(type,name) case lc_arg_type_ ## name: val.v_ ## name = va_arg(args, type); break;
#define LC_ARG_TYPE(type,name,va_type) \
case lc_arg_type_ ## name: val.v_ ## name = va_arg(args, va_type); break;
#include "lc_printf_arg_types.def"
#undef LC_ARG_TYPE
}
......
......@@ -64,13 +64,13 @@ typedef struct lc_arg_occ_t {
* @c ARG_TYPE macro is the name of the union member preceded by $c v_
*/
typedef union {
#define LC_ARG_TYPE(type,name) type v_ ## name;
#define LC_ARG_TYPE(type,name,va_type) type v_ ## name;
#include "lc_printf_arg_types.def"
#undef LC_ARG_TYPE
} lc_arg_value_t;
enum {
#define LC_ARG_TYPE(type,name) lc_arg_type_ ## name,
#define LC_ARG_TYPE(type,name,va_type) lc_arg_type_ ## name,
#include "lc_printf_arg_types.def"
#undef LC_ARG_TYPE
lc_arg_type_last
......
LC_ARG_TYPE(int, char)
LC_ARG_TYPE(int, short)
LC_ARG_TYPE(int, int)
LC_ARG_TYPE(long, long)
LC_ARG_TYPE(LC_LONGLONG, long_long)
LC_ARG_TYPE(double, double)
LC_ARG_TYPE(LC_LONGDOUBLE, long_double)
LC_ARG_TYPE(void *, ptr)
LC_ARG_TYPE(intmax_t, intmax_t)
LC_ARG_TYPE(ptrdiff_t, ptrdiff_t)
LC_ARG_TYPE(size_t, size_t)
/* type | name | va_arg type */
LC_ARG_TYPE(char, char, int)
LC_ARG_TYPE(short, short, int)
LC_ARG_TYPE(int, int, int)
LC_ARG_TYPE(long, long, long)
LC_ARG_TYPE(LC_LONGLONG, long_long, LC_LONGLONG)
LC_ARG_TYPE(double, double, double)
LC_ARG_TYPE(LC_LONGDOUBLE, long_double, LC_LONGDOUBLE)
LC_ARG_TYPE(void *, ptr, void *)
LC_ARG_TYPE(intmax_t, intmax_t, intmax_t)
LC_ARG_TYPE(ptrdiff_t, ptrdiff_t, ptrdiff_t)
LC_ARG_TYPE(size_t, size_t, size_t)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment