From owner-freebsd-current Wed Nov 13 6: 0:53 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8AAEC37B401; Wed, 13 Nov 2002 06:00:51 -0800 (PST) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id C417B43E4A; Wed, 13 Nov 2002 06:00:49 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id BAA02253; Thu, 14 Nov 2002 01:00:41 +1100 Date: Thu, 14 Nov 2002 01:13:13 +1100 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Archie Cobbs Cc: Mike Barcroft , Marc Recht , Garrett Wollman , Subject: Re: addition to cdefs In-Reply-To: <200211122349.gACNn5cX017668@arch20m.dellroad.org> Message-ID: <20021114010436.O5042-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Tue, 12 Nov 2002, Archie Cobbs wrote: > > Marc Recht writes: > > I've had the attached patch in my tree for a while. I'll try and get > > it and the patch committed today. > > static __inline void > __fd_zero(fd_set *p, __size_t n) > { > n = _howmany(n, _NFDBITS); > while (n > 0) > p->fds_bits[n--] = 0; > } > > That looks broken. Maybe you meant this: > > static __inline void > __fd_zero(fd_set *p, __size_t n) > { > n = _howmany(n, _NFDBITS); > while (n > 0) > p->fds_bits[--n] = 0; > } Both have large namespace pollution (p and n are in the application namespace). Both give huge code wih a copy of the function in every object file whose source file(s) include this header if inline functions are not actually inline (which happens if the compiler is gcc -O0 or non-gcc). > But why not just this? > > static __inline void > __fd_zero(fd_set *p, __size_t n) > { > memset(p->fds_bits, 0, _howmany(n, _NFDBITS)); > } As already pointed out in another reply, memset() gives the same namespace problems as this function exists to avoid. __builtin_memset() could be used if the compiler is gcc. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message