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

Kay Sievers kay at vrfy.org
Wed Aug 21 13:16:44 PDT 2013


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.

Thanks,
Kay
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-replace-startswith-loop-with-optimizable-inline-fuct.patch
Type: application/octet-stream
Size: 2361 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/systemd-devel/attachments/20130821/e029b72e/attachment.obj>


More information about the systemd-devel mailing list