lib: fix offset in tst_resm_hexd
Commit f72ca5b9c484 "lib: add tst_res_hexd for newlib"
broke tst_resm_hexd when I moved "offset = strlen(tmesg)"
before macro that expands varargs.
Fix it by moving offset initialisation after EXPAND_VAR_ARGS.
Signed-off-by: Jan Stancek <jstancek@redhat.com>
Acked-by: Cyril Hrubis <chrubis@suse.cz>
diff --git a/lib/tst_res.c b/lib/tst_res.c
index 261dec0..61daaeb 100644
--- a/lib/tst_res.c
+++ b/lib/tst_res.c
@@ -509,7 +509,7 @@
char tmesg[USERMESG];
static const size_t symb_num = 2; /* xx */
static const size_t size_max = 16;
- size_t offset = strlen(tmesg);
+ size_t offset;
size_t i;
char *pmesg = tmesg;
tst_res_func_t res_func;
@@ -520,6 +520,7 @@
res_func = tst_res__;
EXPAND_VAR_ARGS(tmesg, arg_fmt, USERMESG);
+ offset = strlen(tmesg);
if (size > size_max || size == 0 ||
(offset + size * (symb_num + 1)) >= USERMESG)