From 9404d50e3b4a27a1991c2c3dd43984005aaf848f Mon Sep 17 00:00:00 2001 From: drh Date: Tue, 19 Dec 2006 18:46:08 +0000 Subject: [PATCH] Use sqlite3_mprintf() instead of strdup() to reduce libc dependencies. Ticket #2114. (CVS 3532) FossilOrigin-Name: bf4a78cb315c0b1fca31c6f596ff0a8ece96860f --- manifest | 12 ++++++------ manifest.uuid | 2 +- src/tclsqlite.c | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/manifest b/manifest index 7d23bc1234..d3b2eb5b82 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Speed\simprovement:\sdo\snot\sjournal\sor\srollback\spages\sthat\sare\spulled\sout\sof\nthe\sfreelist.\s(CVS\s3531) -D 2006-12-18T18:34:51 +C Use\ssqlite3_mprintf()\sinstead\sof\sstrdup()\sto\sreduce\slibc\sdependencies.\nTicket\s#2114.\s(CVS\s3532) +D 2006-12-19T18:46:09 F Makefile.in 8e14898d41a53033ecb687d93c9cd5d109fb9ae3 F Makefile.linux-gcc 2d8574d1ba75f129aba2019f0b959db380a90935 F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028 @@ -99,7 +99,7 @@ F src/sqlite.h.in 2931f7ee2415e7a49fd12f386c23575046f0f540 F src/sqlite3ext.h 2c2156cc32a158e2b7bd9042d42accf94bff2e40 F src/sqliteInt.h 28d060f44a4a3ad1acb47bf1cef627c86ec45f5f F src/table.c 6d0da66dde26ee75614ed8f584a1996467088d06 -F src/tclsqlite.c e029f739bed90071789fe81a226d53e97a80a4d8 +F src/tclsqlite.c c23c6ce368073afec063f4412e1c8bbace75419e F src/test1.c 19786ff3274635b6eac27a89f842416f388f3654 F src/test2.c ca74a1d8aeb7d9606e8f6b762c5daf85c1a3f92b F src/test3.c 85135c09560c48bdb0a23c9b890ab405486b8ec9 @@ -423,7 +423,7 @@ F www/tclsqlite.tcl bb0d1357328a42b1993d78573e587c6dcbc964b9 F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0 F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b F www/whentouse.tcl 97e2b5cd296f7d8057e11f44427dea8a4c2db513 -P c734585e1a801bec2d393d000c323ba842c2292d -R f4b3ee85fc3b4b1abd3912c81ea3b7d4 +P 4dffc4c3c9c4ccc024669cec204c68e953333563 +R d722ef3cbdbb61ea286ca2e4cbabdf3a U drh -Z b8975ee2a0ac067044f47c4bbda872fe +Z 6e533d737b3ce3d6d280cb010efaffb1 diff --git a/manifest.uuid b/manifest.uuid index 5cb5c9a939..2ba4a2d907 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -4dffc4c3c9c4ccc024669cec204c68e953333563 \ No newline at end of file +bf4a78cb315c0b1fca31c6f596ff0a8ece96860f \ No newline at end of file diff --git a/src/tclsqlite.c b/src/tclsqlite.c index 7eec3af29f..ee13a9481c 100644 --- a/src/tclsqlite.c +++ b/src/tclsqlite.c @@ -11,7 +11,7 @@ ************************************************************************* ** A TCL Interface to SQLite ** -** $Id: tclsqlite.c,v 1.173 2006/09/02 14:17:00 drh Exp $ +** $Id: tclsqlite.c,v 1.174 2006/12/19 18:46:09 drh Exp $ */ #ifndef NO_TCL /* Omit this whole file if TCL is unavailable */ @@ -2055,7 +2055,7 @@ static int DbMain(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ sqlite3_open(zFile, &p->db); Tcl_DStringFree(&translatedFilename); if( SQLITE_OK!=sqlite3_errcode(p->db) ){ - zErrMsg = strdup(sqlite3_errmsg(p->db)); + zErrMsg = sqlite3_mprintf("%s", sqlite3_errmsg(p->db)); sqlite3_close(p->db); p->db = 0; } @@ -2065,7 +2065,7 @@ static int DbMain(void *cd, Tcl_Interp *interp, int objc,Tcl_Obj *const*objv){ if( p->db==0 ){ Tcl_SetResult(interp, zErrMsg, TCL_VOLATILE); Tcl_Free((char*)p); - free(zErrMsg); + sqlite3_free(zErrMsg); return TCL_ERROR; } p->maxStmt = NUM_PREPARED_STMTS;