Date: 23 Jul 2001 03:44:32 +0200 From: Assar Westerlund <assar@FreeBSD.org> To: Brian Somers <brian@Awfulhak.org> Cc: cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/lib/libutil ecalloc.c emalloc.3 emalloc.c erealloc.c estrdup.c Makefile libutil.h Message-ID: <5l4rs4h11b.fsf@assaris.sics.se> In-Reply-To: Brian Somers's message of "Mon, 23 Jul 2001 02:37:41 %2B0100" References: <200107230137.f6N1bfg13122@hak.lan.Awfulhak.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Brian Somers <brian@Awfulhak.org> writes:
> ptr = emalloc(n);
>
> will mean nothing to a regular C programmer (except that it's
> probably doing a malloc with some extra stuff).
Is it more obvious having xmalloc, xlmalloc, safe_malloc and all the
other names that this function has been called in different programs?
> if ((ptr = malloc(n)) == NULL) {
> fprintf(stderr, "malloc %lu failed\n", (unsigned long)n);
> exit(1);
> }
>
> would actually be portable.
Sure, and you would have 17 different versions of these, printing
different messages and sometimes not bothering to check the return
value at all.
> Adding routines such as these to our libraries and then using them
> from our programs just makes it irritating when you try to build
> something on another OS -- not to mention obfuscating our code base.
Just build an emalloc on that other OS. It's not a new problem.
/assar
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5l4rs4h11b.fsf>
