From owner-freebsd-arch@FreeBSD.ORG Fri Aug 22 10:14:06 2008 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A7D6106567B; Fri, 22 Aug 2008 10:14:06 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.9.129]) by mx1.freebsd.org (Postfix) with ESMTP id C2B038FC46; Fri, 22 Aug 2008 10:14:05 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id 3202E7309C; Fri, 22 Aug 2008 12:16:39 +0200 (CEST) Date: Fri, 22 Aug 2008 12:16:39 +0200 From: Luigi Rizzo To: Ivan Voras Message-ID: <20080822101639.GA58256@onelab2.iet.unipi.it> References: <20080822090448.GB57441@onelab2.iet.unipi.it> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4.2.3i Cc: freebsd-arch@freebsd.org Subject: Re: Magic symlinks redux X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Aug 2008 10:14:06 -0000 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