Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Fix some VdbeMemCopy() related problems. (CVS 4787) |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
aca2bee8662c3adaa47b3e70b1ef3534 |
User & Date: | danielk1977 2008-02-14 15:31:52 |
Context
2008-02-14
| ||
23:24 | Fix a typo in a comment used to generate documentation. (CVS 4788) check-in: 65e66dd8 user: drh tags: trunk | |
15:31 | Fix some VdbeMemCopy() related problems. (CVS 4787) check-in: aca2bee8 user: danielk1977 tags: trunk | |
05:44 | Fix a problem in the ptrchng.test script. (CVS 4786) check-in: 30a45f07 user: danielk1977 tags: trunk | |
Changes
Changes to src/mem3.c.
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
...
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
|
** use of malloc(). All dynamically allocatable memory is ** contained in a static array, mem.aPool[]. The size of this ** fixed memory pool is SQLITE_MEMORY_SIZE bytes. ** ** This version of the memory allocation subsystem is used if ** and only if SQLITE_MEMORY_SIZE is defined. ** ** $Id: mem3.c,v 1.9 2008/02/13 18:25:27 danielk1977 Exp $ */ /* ** This version of the memory allocator is used only when ** SQLITE_MEMORY_SIZE is defined. */ #if defined(SQLITE_MEMORY_SIZE) ................................................................................ /* ** Return the size of an outstanding allocation, in bytes. The ** size returned omits the 8-byte header overhead. This only ** works for chunks that are currently checked out. */ int sqlite3MallocSize(void *p){ Mem3Block *pBlock = (Mem3Block*)p; assert( (pBlock[-1].u.hdr.size4x&1)!=0 ); return (pBlock[-1].u.hdr.size4x&~3)*2 - 4; } /* ** Chunk i is a free chunk that has been unlinked. Adjust its ** size parameters for check-out and return a pointer to the ** user portion of the chunk. */ |
|
>
>
|
|
|
>
>
|
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
...
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
|
** use of malloc(). All dynamically allocatable memory is ** contained in a static array, mem.aPool[]. The size of this ** fixed memory pool is SQLITE_MEMORY_SIZE bytes. ** ** This version of the memory allocation subsystem is used if ** and only if SQLITE_MEMORY_SIZE is defined. ** ** $Id: mem3.c,v 1.10 2008/02/14 15:31:52 danielk1977 Exp $ */ /* ** This version of the memory allocator is used only when ** SQLITE_MEMORY_SIZE is defined. */ #if defined(SQLITE_MEMORY_SIZE) ................................................................................ /* ** Return the size of an outstanding allocation, in bytes. The ** size returned omits the 8-byte header overhead. This only ** works for chunks that are currently checked out. */ int sqlite3MallocSize(void *p){ int iSize = 0; if( p ){ Mem3Block *pBlock = (Mem3Block*)p; assert( (pBlock[-1].u.hdr.size4x&1)!=0 ); iSize = (pBlock[-1].u.hdr.size4x&~3)*2 - 4; } return iSize; } /* ** Chunk i is a free chunk that has been unlinked. Adjust its ** size parameters for check-out and return a pointer to the ** user portion of the chunk. */ |
Changes to src/vdbemem.c.
536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 |
int rc = SQLITE_OK;
char *zBuf = 0;
/* If cell pTo currently has a reusable buffer, save a pointer to it
** in local variable zBuf. This function attempts to avoid freeing
** this buffer.
*/
if( pTo->xDel ){
sqlite3VdbeMemRelease(pTo);
}else if( pTo->flags&MEM_Dyn ){
zBuf = pTo->z;
}
/* Copy the contents of *pFrom to *pTo */
memcpy(pTo, pFrom, sizeof(*pFrom));
if( pTo->flags&(MEM_Str|MEM_Blob) && pTo->flags&MEM_Static ){
/* pFrom contained a pointer to a static string. In this case,
|
> | | < > | > |
536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 |
int rc = SQLITE_OK; char *zBuf = 0; /* If cell pTo currently has a reusable buffer, save a pointer to it ** in local variable zBuf. This function attempts to avoid freeing ** this buffer. */ if( pTo->flags&MEM_Dyn ){ if( pTo->xDel ){ sqlite3VdbeMemRelease(pTo); }else{ zBuf = pTo->z; } } /* Copy the contents of *pFrom to *pTo */ memcpy(pTo, pFrom, sizeof(*pFrom)); if( pTo->flags&(MEM_Str|MEM_Blob) && pTo->flags&MEM_Static ){ /* pFrom contained a pointer to a static string. In this case, |