lkml.org 
[lkml]   [2022]   [Aug]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH linux-phy v2 1/4] string.h: Add str_has_proper_prefix()
On Wed, Aug 17, 2022 at 11:06 PM Marek Behún <kabel@kernel.org> wrote:
>
> Add str_has_proper_prefix(), similar to str_has_prefix(), but requires
> that the prefix is proper: the string itself must be longer than the
> prefix.
>
> Signed-off-by: Marek Behún <kabel@kernel.org>
> ---
> Andy, Kees, could you ack this if it is ok?

Seems to me there are too many strlen():s. One is hidden in strncmp().

Besides not the good naming (what 'proper' means), the entire function
is not needed. You may simply call

str_has_prefix() && p[len] != '\0';

Correct?

--
With Best Regards,
Andy Shevchenko

\
 
 \ /
  Last update: 2022-08-18 21:13    [W:0.108 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site