- impl_val res = {0};
- token_t typ = psi_num_exp_exec(scope->macro->exp, &res, NULL, scope->cpp);
-
- switch (typ) {
- CASE_IMPLVAL_NUM_PRINTF(smart_str_append_printf, &str, res, true);
- default:
- assert(0);
- }
+#if HAVE_ASPRINTF
+ char *astr = NULL;
+ struct psi_dump dump = {{.hn = &astr},
+ .fun = (psi_dump_cb) asprintf};
+#else
+ struct psi_dump dump = {{.hn = &str},
+ .fun = (psi_dump_cb) smart_str_append_printf};
+#endif
+
+ psi_num_exp_dump(&dump, scope->macro->exp);
+
+#if HAVE_ASPRINTF
+ smart_str_appends_ex(&str, astr, 1);
+ free(astr);
+#endif