#include <stdlib.h>
#include <stdarg.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
static int trace_user_generic_slow_printf(
const char *fmt, ...)
#ifndef LTT_TRACE
#else
{
/* Guess we need no more than 100 bytes. */
- int n, size = 100;
+ int n, size = 104;
char *p, *np;
va_list ap;
int ret;
+ size += ltt_align(size, sizeof(void*));
if ((p = malloc (size)) == NULL)
return -1;
va_end(ap);
/* If that worked, trace the string. */
if (n > -1 && n < size) {
- ret = trace_user_generic_slow_printf_param_buffer(p, n+1);
+ ret = trace_user_generic_slow_printf_param_buffer(p, n+1+ltt_align(n+1, sizeof(void*)));
free(p);
return ret;
}
size = n+1; /* precisely what is needed */
else /* glibc 2.0 */
size *= 2; /* twice the old size */
+ size += ltt_align(size, sizeof(void*));
if ((np = realloc (p, size)) == NULL) {
free(p);
return -1;
}
#endif //LTT_TRACE
+#ifdef __cplusplus
+} /* end of extern "C" */
+#endif
+
#endif //_LTT_FACILITY_CUSTOM_USER_GENERIC_H_