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

Kay Sievers kay at vrfy.org
Wed Aug 21 18:52:29 PDT 2013


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. :)

Kay


More information about the systemd-devel mailing list