From owner-cvs-src@FreeBSD.ORG Tue Apr 6 11:39:07 2004 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 86EAF16A4CF for ; Tue, 6 Apr 2004 11:39:07 -0700 (PDT) Received: from mail4.speakeasy.net (mail4.speakeasy.net [216.254.0.204]) by mx1.FreeBSD.org (Postfix) with ESMTP id 590B243D46 for ; Tue, 6 Apr 2004 11:39:07 -0700 (PDT) (envelope-from jhb@FreeBSD.org) Received: (qmail 31091 invoked from network); 6 Apr 2004 18:37:18 -0000 Received: from dsl027-160-063.atl1.dsl.speakeasy.net (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender ) encrypted SMTP for ; 6 Apr 2004 18:37:18 -0000 Received: from 10.50.40.205 (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.12.10/8.12.10) with ESMTP id i36IbCNE007435; Tue, 6 Apr 2004 14:37:15 -0400 (EDT) (envelope-from jhb@FreeBSD.org) From: John Baldwin To: Doug Barton Date: Tue, 6 Apr 2004 13:03:39 -0400 User-Agent: KMail/1.6 References: <200403270926.i2R9QMiP083177@repoman.freebsd.org> <200403291155.43206.jhb@FreeBSD.org> <406F5748.2080603@FreeBSD.org> In-Reply-To: <406F5748.2080603@FreeBSD.org> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200404061303.39729.jhb@FreeBSD.org> X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on server.baldwin.cx cc: cvs-src@FreeBSD.org cc: src-committers@FreeBSD.org cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/etc/rc.d mixer X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Apr 2004 18:39:07 -0000 On Saturday 03 April 2004 07:31 pm, Doug Barton wrote: > John Baldwin wrote: > >> 3. Remove an unecessary function, and therefore collapse one variable. > > > > Only unnecessary if you don't value abstraction. :) Now if you want to > > ever change the names of the mixer saved files due to a conflict or some > > such, you have to change it in multiple places rather than just one. > > You're right, and if there were more than just two spots, or the same > file name was used in more than one script, it would be worth a level of > abstraction. But since neither of those is true, (and since the file > name is very unlikely to change), it's not worth it. Also, FYI, the way > you did it is not the typical "Bourne shell'ish" way to abstract a file > name. It would be much more common (and infinitely more efficient) to > simply set a script variable with the file name, and then use that > throughout the script. Note that it is not a single file, but one per mixer, and that the name of the file is a function of the mixer device name. :) Also, I think arguing about efficiency here is probably rather moot. This is a shell script, not an RTOS kernel, and it is only executed at startup/shutdown, not in a fast path. Also, the extra fork's are for the /bin/sh text that is already in core since /bin/sh is already running. The fork's to run the mixer program are much more expensive than using `` to execute a shell function. It's a minor thing though, and I'm perfectly happy to leave it as it is, I just don't think the function was "unnecessary". Perhaps "over-generalized", but I'm currently very adverse to code duplication. *shrug* -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org