Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Remove a few duplicate variable initializations in sqlite3BtreeCursor(). (CVS 2937) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
5e46ec01ff3fe8654fc267efbb12d2d1 |
User & Date: | danielk1977 2006-01-13 11:22:07.000 |
Context
2006-01-13
| ||
13:01 | Fix a vdbe stack overflow problem that could occur with a correlated sub-query. (CVS 2938) (check-in: caa7da807d user: danielk1977 tags: trunk) | |
11:22 | Remove a few duplicate variable initializations in sqlite3BtreeCursor(). (CVS 2937) (check-in: 5e46ec01ff user: danielk1977 tags: trunk) | |
06:33 | Minor modification to restoreOrClearCursorPosition() to improve efficiency. Do not allocate the extra 8-bytes if memory-management is not enabled. (CVS 2936) (check-in: dd70595542 user: danielk1977 tags: trunk) | |
Changes
Changes to src/btree.c.
1 2 3 4 5 6 7 8 9 10 11 | /* ** 2004 April 6 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | /* ** 2004 April 6 ** ** The author disclaims copyright to this source code. In place of ** a legal notice, here is a blessing: ** ** May you do good and not evil. ** May you find forgiveness for yourself and forgive others. ** May you share freely, never taking more than you give. ** ************************************************************************* ** $Id: btree.c,v 1.297 2006/01/13 11:22:07 danielk1977 Exp $ ** ** This file implements a external (disk-based) database using BTrees. ** For a detailed discussion of BTrees, refer to ** ** Donald E. Knuth, THE ART OF COMPUTER PROGRAMMING, Volume 3: ** "Sorting And Searching", pages 473-480. Addison-Wesley ** Publishing Company, Reading, Massachusetts. |
︙ | ︙ | |||
2707 2708 2709 2710 2711 2712 2713 | } pCur = sqliteMalloc( sizeof(*pCur) ); if( pCur==0 ){ rc = SQLITE_NOMEM; goto create_cursor_exception; } pCur->pgnoRoot = (Pgno)iTable; | < < < < | 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 | } pCur = sqliteMalloc( sizeof(*pCur) ); if( pCur==0 ){ rc = SQLITE_NOMEM; goto create_cursor_exception; } pCur->pgnoRoot = (Pgno)iTable; if( iTable==1 && sqlite3pager_pagecount(pBt->pPager)==0 ){ rc = SQLITE_EMPTY; goto create_cursor_exception; } rc = getAndInitPage(pBt, pCur->pgnoRoot, &pCur->pPage, 0); if( rc!=SQLITE_OK ){ goto create_cursor_exception; } /* Now that no other errors can occur, finish filling in the BtCursor ** variables, link the cursor into the BtShared list and set *ppCur (the ** output argument to this function). */ pCur->xCompare = xCmp ? xCmp : dfltCompare; pCur->pArg = pArg; pCur->pBtree = p; pCur->wrFlag = wrFlag; pCur->pNext = pBt->pCursor; if( pCur->pNext ){ pCur->pNext->pPrev = pCur; } pBt->pCursor = pCur; pCur->eState = CURSOR_INVALID; *ppCur = pCur; return SQLITE_OK; create_cursor_exception: if( pCur ){ |
︙ | ︙ |
Changes to src/os_common.h.
︙ | ︙ | |||
128 129 130 131 132 133 134 135 | ** sqlite3GenericRealloc ** sqlite3GenericOsFree ** sqlite3GenericAllocationSize ** ** Implementation of the os level dynamic memory allocation interface in terms ** of the standard malloc(), realloc() and free() found in many operating ** systems. No rocket science here. */ | > > > > > > > > | | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | ** sqlite3GenericRealloc ** sqlite3GenericOsFree ** sqlite3GenericAllocationSize ** ** Implementation of the os level dynamic memory allocation interface in terms ** of the standard malloc(), realloc() and free() found in many operating ** systems. No rocket science here. ** ** There are two versions of these four functions here. The version ** implemented here is only used if memory-management or memory-debugging is ** enabled. This version allocates an extra 8-bytes at the beginning of each ** block and stores the size of the allocation there. ** ** If neither memory-management or debugging is enabled, the second ** set of implementations is used instead. */ #if defined(SQLITE_ENABLE_MEMORY_MANAGEMENT) || defined (SQLITE_MEMDEBUG) void *sqlite3GenericMalloc(int n){ char *p = (char *)malloc(n+8); assert(n>0); assert(sizeof(int)<=8); if( p ){ *(int *)p = n; } |
︙ | ︙ | |||
169 170 171 172 173 174 175 176 177 178 179 | p = realloc(p, n); return p; } void sqlite3GenericFree(void *p){ assert(p); free(p); } int sqlite3GenericAllocationSize(void *p){ assert(0); } #endif | > > | 177 178 179 180 181 182 183 184 185 186 187 188 189 | p = realloc(p, n); return p; } void sqlite3GenericFree(void *p){ assert(p); free(p); } #if 0 /* Never actually invoked */ int sqlite3GenericAllocationSize(void *p){ assert(0); } #endif #endif |