From: Joe Perches <joe@perches.com>
To: Steven Rostedt <rostedt@goodmis.org>,
LKML <linux-kernel@vger.kernel.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
Ingo Molnar <mingo@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Namhyung Kim <namhyung@kernel.org>,
Masami Hiramatsu <mhiramat@kernel.org>,
Tom Zanussi <zanussi@kernel.org>
Subject: Re: [PATCH v3] string.h: Add str_has_prefix() helper
Date: Fri, 21 Dec 2018 16:22:20 -0800 [thread overview]
Message-ID: <d984a6109e9f4a7df7d835850c00c449edf24dcc.camel@perches.com> (raw)
In-Reply-To: <20181221190629.6f7fdf74@gandalf.local.home>
On Fri, 2018-12-21 at 19:06 -0500, Steven Rostedt wrote:
> On Fri, 21 Dec 2018 18:13:16 -0500
> Steven Rostedt <rostedt@goodmis.org> wrote:
>
> > +static __always_inline int str_has_prefix(const char *str, const char *prefix)
>
> I'm thinking it is cleaner to have two helper functions and have them
> both return bool.
>
> static __always_inline bool str_has_prefix(const char *str, const char *prefix)
> {
> return !strncmp(str, prefix, strlen(prefix));
> }
>
> ( I still like to keep the __always_inline, it doesn't hurt )
>
> And I'll make a separate patch that adds:
>
> static __always_inline bool
> str_has_prefix_len(const char *str, const char *prefix, unsigned int *len)
> {
> *len = strlen(prefix);
> return !strncmp(str, prefix, *len) ? *len : 0;
> }
>
> Everyone OK with that?
I guess so as you're the one doing all the work.
Trivia:
Shouldn't the latter function use __kernel_size_t
as that's the actual return type of strlen?
Thanks for keeping at it.
next prev parent reply other threads:[~2018-12-22 0:22 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-21 23:13 Steven Rostedt
2018-12-21 23:19 ` Joe Perches
2018-12-21 23:25 ` Steven Rostedt
2018-12-21 23:38 ` Steven Rostedt
2018-12-22 9:28 ` Namhyung Kim
2018-12-22 12:22 ` Steven Rostedt
2018-12-23 3:23 ` Namhyung Kim
2018-12-21 23:44 ` Joe Perches
2018-12-22 0:00 ` Steven Rostedt
2018-12-22 0:06 ` Steven Rostedt
2018-12-22 0:22 ` Joe Perches [this message]
[not found] ` <CAHk-=wgfSR9qhEWf--Do11jUFHyVM+VEmwm5LBS2JsV0F5yakw@mail.gmail.com>
2018-12-22 0:37 ` Steven Rostedt
2018-12-22 10:58 ` Ingo Molnar
2018-12-22 13:16 ` Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d984a6109e9f4a7df7d835850c00c449edf24dcc.camel@perches.com \
--to=joe@perches.com \
--cc=akpm@linux-foundation.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.org \
--cc=rostedt@goodmis.org \
--cc=torvalds@linux-foundation.org \
--cc=zanussi@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®