Date: Fri, 22 Aug 2008 12:16:16 +0200 From: Ivan Voras <ivoras@freebsd.org> To: freebsd-arch@freebsd.org Subject: Re: Magic symlinks redux Message-ID: <g8m3lf$u26$1@ger.gmane.org> In-Reply-To: <20080822101639.GA58256@onelab2.iet.unipi.it> References: <g8kv7v$sp2$1@ger.gmane.org> <20080822090448.GB57441@onelab2.iet.unipi.it> <g8m2lb$r78$1@ger.gmane.org> <20080822101639.GA58256@onelab2.iet.unipi.it>
next in thread | previous in thread | raw e-mail | index | archive | help
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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?g8m3lf$u26$1>