lkml.org 
[lkml]   [2008]   [Nov]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] kobject_add: use constant strings directly as fmt strings
On Wed, Nov 19, 2008 at 17:17, rae l <crquan@gmail.com> wrote:
> On Wed, Nov 19, 2008 at 11:57 PM, Greg KH <gregkh@suse.de> wrote:
>>> ret = kobject_add(&q->kobj, kobject_get(&disk_to_dev(disk)->kobj),
>>> - "%s", "queue");
>>> + "queue");
>>
>> Why? What does this change buy us?
>
> Dropping one parameter makes the function call a little faster, doesn't it?
>
> The results are the same,

Not that we should be able to measure it, but it should save some
cycles parsing the format character and retrieving the string pointer
from the stack, yes.

> so if the string is constant, why not use it directly as the fmt string?

It should be fine for strings, where you can be sure they can never
contain a '%', sure.

Thanks,
Kay


\
 
 \ /
  Last update: 2008-11-19 18:03    [W:0.253 / U:0.140 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site