lkml.org 
[lkml]   [2023]   [Aug]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] gpio: sim: replace memmove() + strstrip() with skip_spaces() + strim()
On Sat, Aug 12, 2023 at 08:57:48PM +0200, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> Turns out we can avoid the memmove() by using skip_spaces() and strim().
> We did that in gpio-consumer, let's do it in gpio-sim.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

...

> + strim(trimmed);
>
> - return dup;
> + return trimmed;

Can be also

return strim(trimmed);

If it's only about \n replacement, then

return strreplace(trimmed, '\n', '\0');

would work and in the next release be changed to kstrdup_and_replace().

> }

--
With Best Regards,
Andy Shevchenko


\
 
 \ /
  Last update: 2023-08-15 12:35    [W:0.028 / U:0.860 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site