freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
Re: [freetds] [PATCH] useless CHECK_NULP in dblib.c:tdsdbopen()
- From: "Craig A. Berry" <craigberry AT mac.com>
- To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
- Subject: Re: [freetds] [PATCH] useless CHECK_NULP in dblib.c:tdsdbopen()
- Date: Fri, 20 Mar 2009 20:07:33 -0500
On Mar 20, 2009, at 7:27 PM, James K. Lowden wrote:
Craig A. Berry wrote:
The CHECK_NULP statement removed by the attached patch is not actually
checking anything except whether random data from the stack is non-
zero.
One of us is confused, Craig. How about the attached instead?
The macro:
#define CHECK_NULP(x, func, param_num, ret) if (!(x)) { dbperror(dbproc,
#SYBENULP, 0, func, (int) param_num); return ret; }
The function call:
tdsdbopen(LOGINREC * login, const char *server, int msdblib)
The check:
- CHECK_NULP(server, "dbopen", 2, NULL);
expands to:
if (!(server)) { dbperror(dbproc, 20176, 0, "dbopen", (int) 2);
return (void *)0; };
The check isn't against "random data from the stack"; it's against the
server argument.
I really wasn't clear (and hadn't looked at the macro long enough to understand it). It's dbproc, not server, that has been "fetched but not initialized". I'll try to actually think before replying further.
________________________________________
Craig A. Berry
mailto:craigberry AT mac.com
"... getting out of a sonnet is much more
difficult than getting in."
Brad Leithauser
-
[freetds] [PATCH] useless CHECK_NULP in dblib.c:tdsdbopen(),
Craig A. Berry, 03/20/2009
-
Re: [freetds] [PATCH] useless CHECK_NULP in dblib.c:tdsdbopen(),
James K. Lowden, 03/20/2009
-
Re: [freetds] [PATCH] useless CHECK_NULP in dblib.c:tdsdbopen(),
Craig A. Berry, 03/20/2009
-
Re: [freetds] [PATCH] useless CHECK_NULP in dblib.c:tdsdbopen(),
Craig A. Berry, 03/21/2009
-
Re: [freetds] [PATCH] useless CHECK_NULP in dblib.c:tdsdbopen(),
James K. Lowden, 03/21/2009
-
Re: [freetds] [PATCH] useless CHECK_NULP in dblib.c:tdsdbopen(),
Frediano Ziglio, 03/23/2009
- Re: [freetds] [PATCH] useless CHECK_NULP in dblib.c:tdsdbopen(), Craig A. Berry, 03/23/2009
- Re: [freetds] [PATCH] useless CHECK_NULP in dblib.c:tdsdbopen(), Frediano Ziglio, 03/23/2009
-
Re: [freetds] [PATCH] useless CHECK_NULP in dblib.c:tdsdbopen(),
Frediano Ziglio, 03/23/2009
-
Re: [freetds] [PATCH] useless CHECK_NULP in dblib.c:tdsdbopen(),
James K. Lowden, 03/21/2009
-
Re: [freetds] [PATCH] useless CHECK_NULP in dblib.c:tdsdbopen(),
Craig A. Berry, 03/21/2009
-
Re: [freetds] [PATCH] useless CHECK_NULP in dblib.c:tdsdbopen(),
Craig A. Berry, 03/20/2009
-
Re: [freetds] [PATCH] useless CHECK_NULP in dblib.c:tdsdbopen(),
James K. Lowden, 03/20/2009
Archive powered by MHonArc 2.6.24.