freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
Re: [freetds] malloc/errno portability considerations
- From: "James K. Lowden" <jklowden AT freetds.org>
- To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] malloc/errno portability considerations
- Date: Wed, 5 Dec 2007 11:25:24 -0500
ZIGLIO, Frediano, VF-IT wrote:
> dbperror(NULL, SYBEMEM, errno);
>
> is not that portable. The reason is that not all malloc implementations
> set errno with ENOMEM. Why should replace the above line with
>
> dbperror(NULL, SYBEMEM, ENOMEM);
You're right, different OS's may set errno to ENOMEM or not. But the
purpose of the parameter is to pass the OS's error -- if any -- to the
error handler.
If the error handler wants to know the db-lib error, it has SYBEMEM. The
only way it can hope to report the underlying reason for the failure is by
examining os_error.
The application won't get the same answer on every OS. So what? It's not
FreeTDS's job to make all OS's behave the same way. In this case, it's
only job is to report what the OS said.
Which malloc were you thinking of, btw?
--jkl
-
[freetds] malloc/errno portability considerations,
ZIGLIO, Frediano, VF-IT, 12/05/2007
- Re: [freetds] malloc/errno portability considerations, James K. Lowden, 12/05/2007
-
Re: [freetds] malloc/errno portability considerations,
Christos Zoulas, 12/05/2007
- Re: [freetds] malloc/errno portability considerations, Reid, Roger L., 12/07/2007
Archive powered by MHonArc 2.6.24.