From owner-freebsd-hackers Sun Jul 11 3:30:29 1999 Delivered-To: freebsd-hackers@freebsd.org Received: from peach.ocn.ne.jp (peach.ocn.ne.jp [210.145.254.87]) by hub.freebsd.org (Postfix) with ESMTP id 75D2814E38 for ; Sun, 11 Jul 1999 03:30:25 -0700 (PDT) (envelope-from dcs@newsguy.com) Received: from newsguy.com by peach.ocn.ne.jp (8.9.1a/OCN) id TAA19999; Sun, 11 Jul 1999 19:30:06 +0900 (JST) Message-ID: <3788714D.4E666FFA@newsguy.com> Date: Sun, 11 Jul 1999 19:26:21 +0900 From: "Daniel C. Sobral" X-Mailer: Mozilla 4.6 [en] (Win98; I) X-Accept-Language: pt-BR,ja MIME-Version: 1.0 To: Assar Westerlund Cc: Dag-Erling Smorgrav , Jamie Howard , freebsd-hackers@FreeBSD.ORG, tech-userlevel@netbsd.org, tech@openbsd.org Subject: Re: Replacement for grep(1) (part 2) References: <5laet8b2l8.fsf@assaris.sics.se> <5lemij265u.fsf@assaris.sics.se> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Assar Westerlund wrote: > > > > And besides, I really don't think this is a grep function but actually > > > is useful for programs that don't have any strategy for handling out > > > of memory errors and might as well die (with a descriptive error > > > message, of course). Let's call it emalloc and let's put in somewhere > > > where it can be used. > > > > Too simple to warrant that, and other programs will likely want to > > handle the error differently. > > I don't agree. > > 1. this is a small function, but it's useful in lots of programs > 2. that helps lazy programmers write code that actually checks for > error returns instead of just ignoring them > 3. it helps lots of programs that don't do anything intelligent (or > for which there isn't much bright things to do) when allocating memory > fails > 4. having it in a library means it's more likely to be correct > (i.e. sz == 0) > > but then again, I don't get to decide what goes in *BSD libc/libutil. > In my library there's already a emalloc, ecalloc, and erealloc. OTOH, though, FreeBSD's malloc() is very unlikely to return an out of memory error. -- Daniel C. Sobral (8-DCS) dcs@newsguy.com dcs@freebsd.org I'm one of those bad things that happen to good people. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message