Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Oct 2015 12:14:34 -0700
From:      NGie Cooper <yaneurabeya@gmail.com>
To:        freebsd-arch <freebsd-arch@freebsd.org>
Subject:   [RFC] importing e* (embolic, estrdup, etc) functions from NetBSD (libc/libutil or libnetbsd)?
Message-ID:  <74F6DD3C-42F6-490B-A08E-245A1338A3E7@gmail.com>

next in thread | raw e-mail | index | archive | help
Hi all,
	While looking quickly through makefs upstream for fixing a PR, I =
realized that some years ago NetBSD has refactored a number of userland =
utilities (including makefs) to use their new e* function =
implementations of malloc, strndup, etc: =
http://man.netbsd.org/HEAD/usr/share/man/html3/efun.html (they have some =
other functions that we don=E2=80=99t have in libc/libutil in their =
libutil that might need to be ported as well).
	The basic overall difference is that when the failing case =
occurs, a function defined by esetfunc is called, it dumps out a =
diagnostic error message via esetfunc, then returns the original value =
[*].
	I was wondering if anyone had objections to adding this to =
libutil (I think it=E2=80=99d be handy because it would eliminate a lot =
of repetitive error handling in our user land code)? If there are major =
objections, I=E2=80=99ll take it and stuff it into libnetbsd.
Thanks!
-NGie

[*] Based on a quick glance over the code, =
estrlcpy/estrlcat/estrtoi/estrtou are exceptions to the rule. It =
modifies/saves errno before calling the error function: =
http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libutil/efun.c?rev=3D1.10&cont=
ent-type=3Dtext/x-cvsweb-markup&only_with_tag=3DMAIN=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?74F6DD3C-42F6-490B-A08E-245A1338A3E7>