-C Modify\sthe\samalgamation\sgenerator\sto\sidentify\severy\sAPI\susing\sthe\nSQLITE_API\smacro\swhich\sis\snormally\sdefined\sto\snothing\sbut\swhich\scan\nbe\soverridden\son\sthe\scompiler\scommand-line\sto\sbe\s"static"\sif\sdesired.\nTicket\s#2453.\s(CVS\s4125)
-D 2007-06-26T00:52:40
+C Try\sto\swork\saround\san\sMSVC\scompiler\sbug.\s\sTicket\s#2457.\s(CVS\s4126)
+D 2007-06-26T01:04:49
F Makefile.in 7f7485a4cc039476a42e534b3f26ec90e2f9753e
F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
F src/analyze.c 8d345472e0f4e44fc88f5cf489c16dcb77904525
F src/attach.c ba628db0c2b6a362f036d017bf1196cdfe4ebb37
F src/auth.c 5ea90bc93dfea46e9fe4bf531e14c7cd98219ecb
-F src/btree.c 4a282b7f8746bec2a3f59b03eee7c4046a345607
+F src/btree.c c1cc6660b01d9e9f4329a9ab559d6a991c2be638
F src/btree.h 1d527bf61ed176f980c34999d5793a0fd45dcf8c
F src/btreeInt.h ac1ab1fb624ffbe571786cd2bd9559f9ae336355
F src/build.c 50992d92e131a9aa9aa6657fb1ddc13e176fd70c
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P 96190cf13dd7219f483308fea92d703328aac4c7
-R 0a278f1a93b16895841922b584e0b14c
+P 474a52347d454ad499d7a78c88eb995c9d3254d1
+R b2bdfee21240066b385b15bc59a27391
U drh
-Z e9a004de1bf93d40a3ce2a532ab17bdd
+Z 5937892d2d6652ad5bd5b6e488145ae0
** May you share freely, never taking more than you give.
**
*************************************************************************
-** $Id: btree.c,v 1.391 2007/06/25 08:16:58 danielk1977 Exp $
+** $Id: btree.c,v 1.392 2007/06/26 01:04:49 drh Exp $
**
** This file implements a external (disk-based) database using BTrees.
** See the header comment on "btreeInt.h" for additional information.
}
/*
-** The GET_CELL_INFO() macro. Takes one argument, a pointer to a valid
-** btree cursor (type BtCursor*). This macro makes sure the BtCursor.info
-** field of the given cursor is valid. If it is not already valid, call
+** Make sure the BtCursor* given in the argument has a valid
+** BtCursor.info structure. If it is not already valid, call
** sqlite3BtreeParseCell() to fill it in.
**
** BtCursor.info is a cache of the information in the current cell.
** Using this cache reduces the number of calls to sqlite3BtreeParseCell().
+**
+** 2007-06-25: There is a bug in some versions of MSVC that cause the
+** compiler to crash when getCellInfo() is implemented as a macro.
+** But there is a measureable speed advantage to using the macro on gcc
+** (when less compiler optimizations like -Os or -O0 are used and the
+** compiler is not doing agressive inlining.) So we use a real function
+** for MSVC and a macro for everything else. Ticket #2457.
*/
#ifndef NDEBUG
static void assertCellInfo(BtCursor *pCur){
#else
#define assertCellInfo(x)
#endif
-
-#define GET_CELL_INFO(pCur) \
- if( pCur->info.nSize==0 ) \
+#ifdef _MSC_VER
+ /* Use a real function in MSVC to work around bugs in that compiler. */
+ static void getCellInfo(BtCursor *pCur){
+ if( pCur->info.nSize==0 ){
+ sqlite3BtreeParseCell(pCur->pPage, pCur->idx, &pCur->info);
+ }else{
+ assertCellInfo(pCur);
+ }
+ }
+#else /* if not _MSC_VER */
+ /* Use a macro in all other compilers so that the function is inlined */
+#define getCellInfo(pCur) \
+ if( pCur->info.nSize==0 ){ \
sqlite3BtreeParseCell(pCur->pPage, pCur->idx, &pCur->info); \
- else \
- assertCellInfo(pCur);
-
+ }else{ \
+ assertCellInfo(pCur); \
+ }
+#endif /* _MSC_VER */
/*
** Set *pSize to the size of the buffer needed to hold the value of
if( pCur->eState==CURSOR_INVALID ){
*pSize = 0;
}else{
- GET_CELL_INFO(pCur);
+ getCellInfo(pCur);
*pSize = pCur->info.nKey;
}
}
/* Not pointing at a valid entry - set *pSize to 0. */
*pSize = 0;
}else{
- GET_CELL_INFO(pCur);
+ getCellInfo(pCur);
*pSize = pCur->info.nData;
}
}
assert( pCur->idx>=0 && pCur->idx<pPage->nCell );
assert( offset>=0 );
- GET_CELL_INFO(pCur);
+ getCellInfo(pCur);
aPayload = pCur->info.pCell + pCur->info.nHeader;
nKey = (pPage->intKey ? 0 : pCur->info.nKey);
assert( pCur->eState==CURSOR_VALID );
pPage = pCur->pPage;
assert( pCur->idx>=0 && pCur->idx<pPage->nCell );
- GET_CELL_INFO(pCur);
+ getCellInfo(pCur);
aPayload = pCur->info.pCell;
aPayload += pCur->info.nHeader;
if( pPage->intKey ){