| OLD | NEW |
| 1 /* | 1 /* |
| 2 ** 2007 October 14 | 2 ** 2007 October 14 |
| 3 ** | 3 ** |
| 4 ** The author disclaims copyright to this source code. In place of | 4 ** The author disclaims copyright to this source code. In place of |
| 5 ** a legal notice, here is a blessing: | 5 ** a legal notice, here is a blessing: |
| 6 ** | 6 ** |
| 7 ** May you do good and not evil. | 7 ** May you do good and not evil. |
| 8 ** May you find forgiveness for yourself and forgive others. | 8 ** May you find forgiveness for yourself and forgive others. |
| 9 ** May you share freely, never taking more than you give. | 9 ** May you share freely, never taking more than you give. |
| 10 ** | 10 ** |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 } | 469 } |
| 470 } | 470 } |
| 471 | 471 |
| 472 /* | 472 /* |
| 473 ** Return the size of an outstanding allocation, in bytes. The | 473 ** Return the size of an outstanding allocation, in bytes. The |
| 474 ** size returned omits the 8-byte header overhead. This only | 474 ** size returned omits the 8-byte header overhead. This only |
| 475 ** works for chunks that are currently checked out. | 475 ** works for chunks that are currently checked out. |
| 476 */ | 476 */ |
| 477 static int memsys3Size(void *p){ | 477 static int memsys3Size(void *p){ |
| 478 Mem3Block *pBlock; | 478 Mem3Block *pBlock; |
| 479 if( p==0 ) return 0; | 479 assert( p!=0 ); |
| 480 pBlock = (Mem3Block*)p; | 480 pBlock = (Mem3Block*)p; |
| 481 assert( (pBlock[-1].u.hdr.size4x&1)!=0 ); | 481 assert( (pBlock[-1].u.hdr.size4x&1)!=0 ); |
| 482 return (pBlock[-1].u.hdr.size4x&~3)*2 - 4; | 482 return (pBlock[-1].u.hdr.size4x&~3)*2 - 4; |
| 483 } | 483 } |
| 484 | 484 |
| 485 /* | 485 /* |
| 486 ** Round up a request size to the next valid allocation size. | 486 ** Round up a request size to the next valid allocation size. |
| 487 */ | 487 */ |
| 488 static int memsys3Roundup(int n){ | 488 static int memsys3Roundup(int n){ |
| 489 if( n<=12 ){ | 489 if( n<=12 ){ |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 memsys3Size, | 678 memsys3Size, |
| 679 memsys3Roundup, | 679 memsys3Roundup, |
| 680 memsys3Init, | 680 memsys3Init, |
| 681 memsys3Shutdown, | 681 memsys3Shutdown, |
| 682 0 | 682 0 |
| 683 }; | 683 }; |
| 684 return &mempoolMethods; | 684 return &mempoolMethods; |
| 685 } | 685 } |
| 686 | 686 |
| 687 #endif /* SQLITE_ENABLE_MEMSYS3 */ | 687 #endif /* SQLITE_ENABLE_MEMSYS3 */ |
| OLD | NEW |