lkml.org 
[lkml]   [2015]   [Jun]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC/PATCH 5/8] drivers/base/core.c: Use strreplace
On Thu, Jun 04, 2015 at 11:37:12AM +0200, Rasmus Villemoes wrote:
> This eliminates a local variable and a little .text.

Hmm...

> *tmp = kstrdup(dev_name(dev), GFP_KERNEL);
> if (!*tmp)
> return NULL;
> - while ((s = strchr(*tmp, '!')))
> - s[0] = '/';
> + strreplace((char *)*tmp, '!', '/');
> return *tmp;

That cast isn't nice. Why not make it
s = kstrdup(...)
if (s)
strreplace(s, ...)
return *tmp = s;
instead?


\
 
 \ /
  Last update: 2015-06-05 01:01    [W:0.127 / U:0.176 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site