perf tools: Remove cast of non-variadic function to variadic
authorMichael Hudson-Doyle <michael.hudson@linaro.org>
Thu, 31 Oct 2013 23:47:45 +0000 (16:47 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 4 Dec 2013 18:55:49 +0000 (10:55 -0800)
commit 53805eca3d89b095062c11a6798689bb0af09216 upstream.

The 4fb71074a570 (perf ui/hist: Consolidate hpp helpers) cset introduced
a cast of percent_color_snprintf to a function pointer type with
varargs.  Change percent_color_snprintf to be variadic and remove the
cast.

The symptom of this was all percentages being reported as 0.00% in perf
report --stdio output on the armhf arch.

Signed-off-by: Michael Hudson-Doyle <michael.hudson@linaro.org>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Will Deacon <will.deacon@arm.com>
Cc: Jean Pihet <jean.pihet@linaro.org>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Will Deacon <will.deacon@arm.com>
Link: http://lkml.kernel.org/r/87zjppvw7y.fsf@canonical.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
tools/perf/ui/hist.c
tools/perf/util/color.c
tools/perf/util/color.h

index 4bf91b09d62db6684c9e66c985810303b3950af1..794bb1a120be3c075b03e0290ddd448ce2b925fd 100644 (file)
@@ -113,7 +113,7 @@ static u64 he_get_##_field(struct hist_entry *he)                           \
 static int hpp__color_##_type(struct perf_hpp *hpp, struct hist_entry *he)     \
 {                                                                              \
        return __hpp__fmt(hpp, he, he_get_##_field, " %6.2f%%",                 \
-                         (hpp_snprint_fn)percent_color_snprintf, true);        \
+                         percent_color_snprintf, true);                        \
 }
 
 #define __HPP_ENTRY_PERCENT_FN(_type, _field)                                  \
index 11e46da17bbb3c73ac53c1aac9aaa1ab50471a31..66e44a5019d538fff04d338bbf304b3dccecb4e2 100644 (file)
@@ -318,8 +318,15 @@ int percent_color_fprintf(FILE *fp, const char *fmt, double percent)
        return r;
 }
 
-int percent_color_snprintf(char *bf, size_t size, const char *fmt, double percent)
+int percent_color_snprintf(char *bf, size_t size, const char *fmt, ...)
 {
-       const char *color = get_percent_color(percent);
+       va_list args;
+       double percent;
+       const char *color;
+
+       va_start(args, fmt);
+       percent = va_arg(args, double);
+       va_end(args);
+       color = get_percent_color(percent);
        return color_snprintf(bf, size, color, fmt, percent);
 }
index dea082b7960210a17ccd2ee12d71a61a6192a503..fced3840e99c53bda892a466068c78e57c5982eb 100644 (file)
@@ -39,7 +39,7 @@ int color_fprintf(FILE *fp, const char *color, const char *fmt, ...);
 int color_snprintf(char *bf, size_t size, const char *color, const char *fmt, ...);
 int color_fprintf_ln(FILE *fp, const char *color, const char *fmt, ...);
 int color_fwrite_lines(FILE *fp, const char *color, size_t count, const char *buf);
-int percent_color_snprintf(char *bf, size_t size, const char *fmt, double percent);
+int percent_color_snprintf(char *bf, size_t size, const char *fmt, ...);
 int percent_color_fprintf(FILE *fp, const char *fmt, double percent);
 const char *get_percent_color(double percent);