[systemd-devel] [PATCH 1/2] Optimize startswith() to macro

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Wed Aug 21 21:53:58 PDT 2013


On Thu, Aug 22, 2013 at 03:52:29AM +0200, Kay Sievers wrote:
> On Wed, Aug 21, 2013 at 10:16 PM, Kay Sievers <kay at vrfy.org> wrote:
> > On Wed, Aug 21, 2013 at 8:15 PM, WANG Chao <chaowang at redhat.com> wrote:
> >> Take this optimized code from Lennart[1]. Now startswith is a macro using
> >> strncmp and should be fast enough.
> >>
> >> [1]: http://lists.freedesktop.org/archives/systemd-devel/2013-July/011860.html
> >> ---
> >>  src/shared/macro.h |  5 +++++
> >>  src/shared/util.c  | 17 -----------------
> >>  2 files changed, 5 insertions(+), 17 deletions(-)
> >
> > It fails to compile, there are the prototypes in util.h still.
> > Also quite a few places do not include macro.h ...
> >
> > I guess it's easier and cleaner anyway to use simple static inline
> > functions instead of defines. Patch attached.
> 
> Zbigniew, mind checking if that patch makes sense?
> 
> You added the hasprefix a while ago, and you also proposed a version
> to unify the both.
> We really should get that topic sorted out now. :)
Looks correct, pushed this along with Shawn's patch.

Zbyszek


More information about the systemd-devel mailing list