[systemd-devel] [PATCH] udev: Remove hard-coded string offsets when parsing kernel

Richard W.M. Jones rjones at redhat.com
Wed Nov 5 01:16:32 PST 2014


This avoids the hard-coded string offsets by using strlen.

It's a bit of a strange coding style.

Mainly I was interested to see if gcc could optimize this, and
(gcc-4.9.2 / x86-64 / -O2) it did - all calls to strlen are removed
from the assembly and replaced by constants.

When I compile systemd normally, it recommends using -O0 so of course
no optimization is done and all the calls to strlen are still there.

Rich.



More information about the systemd-devel mailing list