Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Write sqlite3_initialize() calls in sqlite3_malloc() within SQLITE_OMIT_AUTOINIT. Ticket #3217. (CVS 5408) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
4961b0bbe8b9cf5fb27de7f2514e8ab3 |
User & Date: | drh 2008-07-14 12:52:53.000 |
Context
2008-07-14
| ||
15:11 | Remove the malloc2.test script since it was designed for use in versions of SQLite that predate SQLite's ability to recover from out-of-memory errors automatically. Removing this script causes no reduction in test coverage and removes potential problems reported by ticket #3213. (CVS 5409) (check-in: 5bfc962533 user: drh tags: trunk) | |
12:52 | Write sqlite3_initialize() calls in sqlite3_malloc() within SQLITE_OMIT_AUTOINIT. Ticket #3217. (CVS 5408) (check-in: 4961b0bbe8 user: drh tags: trunk) | |
12:38 | Fix a bug introduced by check-in (5406). Ticket #3216. (CVS 5407) (check-in: 518a24aa3e user: drh tags: trunk) | |
Changes
Changes to src/printf.c.
1 2 3 4 5 6 7 | /* ** The "printf" code that follows dates from the 1980's. It is in ** the public domain. The original comments are included here for ** completeness. They are very out-of-date but might be useful as ** an historical reference. Most of the "enhancements" have been backed ** out so that the functionality is now the same as standard printf(). ** | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | /* ** The "printf" code that follows dates from the 1980's. It is in ** the public domain. The original comments are included here for ** completeness. They are very out-of-date but might be useful as ** an historical reference. Most of the "enhancements" have been backed ** out so that the functionality is now the same as standard printf(). ** ** $Id: printf.c,v 1.91 2008/07/14 12:52:53 drh Exp $ ** ************************************************************************** ** ** The following modules is an enhanced replacement for the "printf" subroutines ** found in the standard C library. The following enhancements are ** supported: ** |
︙ | ︙ | |||
840 841 842 843 844 845 846 | ** Print into memory obtained from sqlite3_malloc(). Omit the internal ** %-conversion extensions. */ char *sqlite3_vmprintf(const char *zFormat, va_list ap){ char *z; char zBase[SQLITE_PRINT_BUF_SIZE]; StrAccum acc; | > | > > | > | 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 | ** Print into memory obtained from sqlite3_malloc(). Omit the internal ** %-conversion extensions. */ char *sqlite3_vmprintf(const char *zFormat, va_list ap){ char *z; char zBase[SQLITE_PRINT_BUF_SIZE]; StrAccum acc; #ifndef SQLITE_OMIT_AUTOINIT if( sqlite3_initialize() ) return 0; #endif sqlite3StrAccumInit(&acc, zBase, sizeof(zBase), SQLITE_MAX_LENGTH); sqlite3VXPrintf(&acc, 0, zFormat, ap); z = sqlite3StrAccumFinish(&acc); return z; } /* ** Print into memory obtained from sqlite3_malloc()(). Omit the internal ** %-conversion extensions. */ char *sqlite3_mprintf(const char *zFormat, ...){ va_list ap; char *z; #ifndef SQLITE_OMIT_AUTOINIT if( sqlite3_initialize() ) return 0; #endif va_start(ap, zFormat); z = sqlite3_vmprintf(zFormat, ap); va_end(ap); return z; } /* |
︙ | ︙ |
Changes to test/mutex2.test.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 2008 July 7 # # 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. # #*********************************************************************** # # Test scripts for deliberate failures of mutex routines. # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # 2008 July 7 # # 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. # #*********************************************************************** # # Test scripts for deliberate failures of mutex routines. # # $Id: mutex2.test,v 1.6 2008/07/14 12:52:53 drh Exp $ set testdir [file dirname $argv0] source $testdir/tester.tcl # deinitialize # catch {db close} |
︙ | ︙ | |||
44 45 46 47 48 49 50 | # Now that sqlite3_initialize() is failing, try to run various APIs that # require that SQLite be initialized. Verify that they fail. # do_test mutex2-2.1 { set ::disable_mutex_init 7 set rc [catch {sqlite db test.db} msg] lappend rc $msg | | | | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | # Now that sqlite3_initialize() is failing, try to run various APIs that # require that SQLite be initialized. Verify that they fail. # do_test mutex2-2.1 { set ::disable_mutex_init 7 set rc [catch {sqlite db test.db} msg] lappend rc $msg } {1 {}} ifcapable utf16 { do_test mutex2-2.2 { set db2 [sqlite3_open16 [utf16 test.db] {}] } {0} do_test mutex2-2.3 { sqlite3_complete16 [utf16 {SELECT * FROM t1;}] } {7} } do_test mutex2-2.4 { sqlite3_mprintf_int {This is a test %d,%d,%d} 1 2 3 } {} do_test mutex2-2.5 { sqlite3_auto_extension_sqr } {7} do_test mutex2-2.6 { sqlite3_reset_auto_extension } {} do_test mutex2-2.7 { |
︙ | ︙ |