lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CALkWK0m_W0c7AhCOZmMObq2MUjL83jL+YsM-qUmXz8j0MOFLiw@mail.gmail.com>
Date:	Wed, 4 Dec 2013 18:41:18 +0530
From:	Ramkumar Ramachandra <artagnon@...il.com>
To:	Arnaldo Carvalho de Melo <acme@...stprotocols.net>
Cc:	Jiri Olsa <jolsa@...hat.com>, LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v4 2/3] perf diff: color the Ratio column

Arnaldo Carvalho de Melo wrote:
>> The issue with this suggestion is that the prototype of
>> percent_color_snprintf() is:
>>
>>   int percent_color_snprintf(char *bf, size_t size, const char *fmt, ...)
>>
>> So, I can only pass value_color_snprintf() a va_list, making its prototype:
>>
>>   int value_color_snprintf(char *bf, size_t size, const char *fmt, va_list args)
>>
>> Is this worth the minor rename?
>
> That is ok, I'd say. Or if that would be a problem one could consider
> using a macro, perhaps.

If value_color_snprintf has the prototype mentioned above, I'd have to
build a va_list at each callsite; how is that convenient? Considering
the macro, can we just do

  #define percent_color_snprintf value_color_snprintf

in color.h?

>> On a related note, does percent_color_snprintf() need to be a variadic
>> function? It only seems to process one percent value.
>
> I think that there are places where it is passed as a pointer that
> expects it to have that prototype, this is from memory, so please check.

I meant that the function body itself seems to be wrong:

  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);

Unless I've misunderstood something horribly, doesn't `percent' just
get assigned to the last argument in the `args' va_list?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ