diff options
Diffstat (limited to 'test/interactive-helper/libnoprofile.c')
-rw-r--r-- | test/interactive-helper/libnoprofile.c | 30 |
1 files changed, 12 insertions, 18 deletions
diff --git a/test/interactive-helper/libnoprofile.c b/test/interactive-helper/libnoprofile.c index 2cba6dc8b..f11b89899 100644 --- a/test/interactive-helper/libnoprofile.c +++ b/test/interactive-helper/libnoprofile.c @@ -7,17 +7,14 @@ #include <stdio.h> int vprintf(const char *format, va_list ap) { - static int (*func_fprintf)(const char *format, va_list ap) = NULL; - if (func_fprintf == NULL) - func_fprintf = (int (*) (const char *format, va_list ap)) dlsym(RTLD_NEXT, "vprintf"); - - va_list ap2; - va_copy(ap2, ap); if (strncmp(format, "profiling:", strlen("profiling:")) == 0) return 0; - int res = func_fprintf(format, ap2); - va_end(ap2); - return res; + + static int (*func_fprintf)(const char *format, va_list ap) = NULL; + if (func_fprintf == NULL) + func_fprintf = (int (*)(const char *format, va_list ap))dlsym(RTLD_NEXT, "vprintf"); + + return func_fprintf(format, ap); } int printf(const char *format, ...) { va_list ap; @@ -28,17 +25,14 @@ int printf(const char *format, ...) { } int vfprintf(FILE *stream, const char *format, va_list ap) { - static int (*func_vfprintf)(FILE *stream, const char *format, va_list ap) = NULL; - if (func_vfprintf == NULL) - func_vfprintf = (int (*) (FILE *stream, const char *format, va_list ap)) dlsym(RTLD_NEXT, "vfprintf"); - - va_list ap2; - va_copy(ap2, ap); if (strncmp(format, "profiling:", strlen("profiling:")) == 0) return 0; - int res = func_vfprintf(stream, format, ap2); - va_end(ap2); - return res; + + static int (*func_vfprintf)(FILE * stream, const char *format, va_list ap) = NULL; + if (func_vfprintf == NULL) + func_vfprintf = (int (*)(FILE * stream, const char *format, va_list ap))dlsym(RTLD_NEXT, "vfprintf"); + + return func_vfprintf(stream, format, ap); } int fprintf(FILE *stream, const char *format, ...) { |