Re: [PATCH 23/43] tools lib: Adopt skip_spaces() from the kernel sources
From: Joe Perches
Date: Tue Jul 02 2019 - 09:49:34 EST
On Tue, 2019-07-02 at 10:46 -0300, Arnaldo Carvalho de Melo wrote:
> Em Tue, Jul 02, 2019 at 02:12:40PM +0200, Jiri Olsa escreveu:
> > On Mon, Jul 01, 2019 at 11:25:56PM -0300, Arnaldo Carvalho de Melo wrote:
> > > From: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
> > >
> > > Same implementation, will be used to replace ad-hoc equivalent code in
> > > tools/.
[]
> > > diff --git a/tools/lib/string.c b/tools/lib/string.c
[]
> > > @@ -106,3 +107,16 @@ size_t __weak strlcpy(char *dest, const char *src, size_t size)
> > > }
> > > return ret;
> > > }
> > > +
> > > +/**
> > > + * skip_spaces - Removes leading whitespace from @str.
> > > + * @str: The string to be stripped.
> > > + *
> > > + * Returns a pointer to the first non-whitespace character in @str.
> > > + */
> > > +char *skip_spaces(const char *str)
> > > +{
> > > + while (isspace(*str))
> > > + ++str;
> > > + return (char *)str;
> > > +}
pity about duplicating losing the const