Re: [PATCH] gpio: sim: replace memmove() + strstrip() with skip_spaces() + strim()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 15, 2023 at 12:34 PM Andy Shevchenko
<andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
>
> On Sat, Aug 12, 2023 at 08:57:48PM +0200, Bartosz Golaszewski wrote:
> > From: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>
> >
> > 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@xxxxxxxxxxxxxxx>
>
> ...
>
> > +     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');

No, the user is free to pass all kinds of whitespaces after the
string. I'll queue it with the above change. Thanks.

Bart

>
> would work and in the next release be changed to kstrdup_and_replace().
>
> >  }
>
> --
> With Best Regards,
> Andy Shevchenko
>
>




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux