Work around a bug in the Borland C compiler. Ticket #172. (CVS 765)

FossilOrigin-Name: 3ef2925650bfbeb4ee5dbd0aaf8e606fc4cd2be1
This commit is contained in:
drh 2002-10-20 15:53:03 +00:00
parent 2678058853
commit 315555ca50
3 changed files with 16 additions and 11 deletions

View File

@ -1,5 +1,5 @@
C Make\ssure\smalloc(0)\salways\sreturns\sNULL.\s\sFix\sfor\sticket\s#171.\s(CVS\s764)
D 2002-10-20T15:46:23
C Work\saround\sa\sbug\sin\sthe\sBorland\sC\scompiler.\s\sTicket\s#172.\s(CVS\s765)
D 2002-10-20T15:53:04
F Makefile.in d6c9a85c2a5e696843201d090dcf8bf2f8716f2a
F Makefile.linux-gcc b86a99c493a5bfb402d1d9178dcdc4bd4b32f906
F README f1de682fbbd94899d50aca13d387d1b3fd3be2dd
@ -37,7 +37,7 @@ F src/pager.h 6991c9c2dc5e4c7f2df4d4ba47d1c6458f763a32
F src/parse.y 818b03a73f6b3b8b284b515c5b1d9998d4663dc3
F src/printf.c 5c50fc1da75c8f5bf432b1ad17d91d6653acd167
F src/random.c 19e8e00fe0df32a742f115773f57651be327cabe
F src/select.c 74a025cd6887b636fc06a79ff6246c4eb6826ec4
F src/select.c 987e0c6134f157905f4531b4c0191ca078c81ef2
F src/shell.c 9e9a6eb6bca07f01e6472a603f908a0127ea50ff
F src/shell.tcl 27ecbd63dd88396ad16d81ab44f73e6c0ea9d20e
F src/sqlite.h.in d3999a9c6374675779058d6cfe5431131618e92b
@ -149,7 +149,7 @@ F www/speed.tcl a20a792738475b68756ea7a19321600f23d1d803
F www/sqlite.tcl ae3dcfb077e53833b59d4fcc94d8a12c50a44098
F www/tclsqlite.tcl 1db15abeb446aad0caf0b95b8b9579720e4ea331
F www/vdbe.tcl 2013852c27a02a091d39a766bc87cff329f21218
P d0af59fe6b9d5d026786e7cce1c49c208a0335cc
R 70da8919be02ff08191d05376cb545cc
P 4622b7ce8f4727a6405ddf4f0af701db86da86bf
R be2bc0a24e02b5cac45ad5a3ae26a77c
U drh
Z 4581abd0f3d516911470f2cb2d447f4c
Z 65dec2fc5948c9e002373b1beb73bd0e

View File

@ -1 +1 @@
4622b7ce8f4727a6405ddf4f0af701db86da86bf
3ef2925650bfbeb4ee5dbd0aaf8e606fc4cd2be1

View File

@ -12,10 +12,11 @@
** This file contains C code routines that are called by the parser
** to handle SELECT statements in SQLite.
**
** $Id: select.c,v 1.112 2002/09/08 17:23:43 drh Exp $
** $Id: select.c,v 1.113 2002/10/20 15:53:04 drh Exp $
*/
#include "sqliteInt.h"
/*
** Allocate a new Select structure and return a pointer to that
** structure.
@ -724,6 +725,11 @@ static const char *selectOpName(int id){
return z;
}
/*
** Forward declaration
*/
static int fillInColumnList(Parse*, Select*);
/*
** Given a SELECT statement, generate a Table structure that describes
** the result set of that SELECT.
@ -732,7 +738,6 @@ Table *sqliteResultSetOfSelect(Parse *pParse, char *zTabName, Select *pSelect){
Table *pTab;
int i;
ExprList *pEList;
static int fillInColumnList(Parse*, Select*);
if( fillInColumnList(pParse, pSelect) ){
return 0;
@ -1286,12 +1291,12 @@ static int multiSelect(Parse *pParse, Select *p, int eDest, int iParm){
** to a column in table number iFrom, change that reference to the
** same column in table number iTo.
*/
static void changeTablesInList(ExprList*, int, int); /* Forward Declaration */
static void changeTables(Expr *pExpr, int iFrom, int iTo){
if( pExpr==0 ) return;
if( pExpr->op==TK_COLUMN && pExpr->iTable==iFrom ){
pExpr->iTable = iTo;
}else{
static void changeTablesInList(ExprList*, int, int);
changeTables(pExpr->pLeft, iFrom, iTo);
changeTables(pExpr->pRight, iFrom, iTo);
changeTablesInList(pExpr->pList, iFrom, iTo);
@ -1320,6 +1325,7 @@ static void changeTablesInList(ExprList *pList, int iFrom, int iTo){
** changes to pExpr so that it refers directly to the source table
** of the subquery rather the result set of the subquery.
*/
static void substExprList(ExprList*,int,ExprList*,int); /* Forward Decl */
static void substExpr(Expr *pExpr, int iTable, ExprList *pEList, int iSub){
if( pExpr==0 ) return;
if( pExpr->op==TK_COLUMN && pExpr->iTable==iTable && pExpr->iColumn>=0 ){
@ -1344,7 +1350,6 @@ static void substExpr(Expr *pExpr, int iTable, ExprList *pEList, int iSub){
changeTables(pExpr, iSub, iTable);
}
}else{
static void substExprList(ExprList*,int,ExprList*,int);
substExpr(pExpr->pLeft, iTable, pEList, iSub);
substExpr(pExpr->pRight, iTable, pEList, iSub);
substExprList(pExpr->pList, iTable, pEList, iSub);