Magic symlinks redux

Luigi Rizzo rizzo at iet.unipi.it
Fri Aug 22 10:14:06 UTC 2008


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.

	cheers
	luigi


More information about the freebsd-arch mailing list