lkml.org 
[lkml]   [2013]   [Nov]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] perf tools: Remove cast of non-variadic function to variadic
Em Thu, Oct 31, 2013 at 04:47:45PM -0700, Michael Hudson-Doyle escreveu:
> -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);
> }

As a bug fix I'm merging this now, but I wonder if, since we're doing
the va_start/end dance here, can't we call some color_vsnprintf variant
so as to avoid doing it twice?

I'll look into that after going thru more urgent stuff.

- Arnaldo


\
 
 \ /
  Last update: 2013-11-01 15:01    [W:0.060 / U:0.108 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site