Magic symlinks redux
Ivan Voras
ivoras at freebsd.org
Fri Aug 22 10:16:29 UTC 2008
Luigi Rizzo wrote:
> On Fri, Aug 22, 2008 at 11:59:07AM +0200, Ivan Voras wrote:
> ...
>>> + efficiency of symlink_magic() might be improved too:
>>> e.g. the function could do a quick check for the presence of @ and return
>>> without allocation/deallocation if not found;
>> I think it's because the author wanted a single pass over the string (in
>> case of the "extended" @{...} syntax we can't just check if cp[0] ==
>> '@'). The first few lines of the symlink_magic loop ("if (cp[i] !=
>> '@')") effectively do what strchr() does.
>
> right, but doing the check upfront might save the uma_zalloc/zfree call
> in the common case.
Ok. The strings are so short that it's trivial to check them early.
More information about the freebsd-arch
mailing list