[systemd-devel] [PATCH 2/2] RFC: util: Avoid doing work on the string when it is not used
Holger Hans Peter Freyther
holger at freyther.de
Fri Apr 5 01:07:36 PDT 2013
On Fri, Apr 05, 2013 at 05:44:34AM +0200, Zbigniew Jędrzejewski-Szmek wrote:
Good Morning,
> It seems that this function must be invoked a bizillion times,
> so making it a bit leaner probably makes sense. Your implicit
> assumpition that the field is not prefixed by whitespace is
> almost certainly true in this case. But it would be better to
> mention it in the commit message. The strstrip on the line
> can simply be dropped. But notice that startswith returns
> the pointer to the end of the pattern (a relatively recent addition),
> so this can be simplified further.
True, I should have written about the assumption for the line start.
I will not revise the patch though as the _gid/_uid routines do not
appear to be used by the journald.
I just wanted to point out that for SELinux querying gid/uid at the
same time could make sense and that in general this loop is doing
more more work than is necessary.
cheers
holger
More information about the systemd-devel
mailing list