/ Check-in [bf4a78cb]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Use sqlite3_mprintf() instead of strdup() to reduce libc dependencies. Ticket #2114. (CVS 3532)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:bf4a78cb315c0b1fca31c6f596ff0a8ece96860f
User & Date: drh 2006-12-19 18:46:09
Context
2006-12-19
18:47
Fix a typo in shell.c. Ticket #2111. (CVS 3533) check-in: 6f8a5623 user: drh tags: trunk
18:46
Use sqlite3_mprintf() instead of strdup() to reduce libc dependencies. Ticket #2114. (CVS 3532) check-in: bf4a78cb user: drh tags: trunk
2006-12-18
18:34
Speed improvement: do not journal or rollback pages that are pulled out of the freelist. (CVS 3531) check-in: 4dffc4c3 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/tclsqlite.c.

     7      7   **    May you do good and not evil.
     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** A TCL Interface to SQLite
    13     13   **
    14         -** $Id: tclsqlite.c,v 1.173 2006/09/02 14:17:00 drh Exp $
           14  +** $Id: tclsqlite.c,v 1.174 2006/12/19 18:46:09 drh Exp $
    15     15   */
    16     16   #ifndef NO_TCL     /* Omit this whole file if TCL is unavailable */
    17     17   
    18     18   #include "sqliteInt.h"
    19     19   #include "hash.h"
    20     20   #include "tcl.h"
    21     21   #include <stdlib.h>
................................................................................
  2051   2051     }
  2052   2052     memset(p, 0, sizeof(*p));
  2053   2053     zFile = Tcl_GetStringFromObj(objv[2], 0);
  2054   2054     zFile = Tcl_TranslateFileName(interp, zFile, &translatedFilename);
  2055   2055     sqlite3_open(zFile, &p->db);
  2056   2056     Tcl_DStringFree(&translatedFilename);
  2057   2057     if( SQLITE_OK!=sqlite3_errcode(p->db) ){
  2058         -    zErrMsg = strdup(sqlite3_errmsg(p->db));
         2058  +    zErrMsg = sqlite3_mprintf("%s", sqlite3_errmsg(p->db));
  2059   2059       sqlite3_close(p->db);
  2060   2060       p->db = 0;
  2061   2061     }
  2062   2062   #ifdef SQLITE_HAS_CODEC
  2063   2063     sqlite3_key(p->db, pKey, nKey);
  2064   2064   #endif
  2065   2065     if( p->db==0 ){
  2066   2066       Tcl_SetResult(interp, zErrMsg, TCL_VOLATILE);
  2067   2067       Tcl_Free((char*)p);
  2068         -    free(zErrMsg);
         2068  +    sqlite3_free(zErrMsg);
  2069   2069       return TCL_ERROR;
  2070   2070     }
  2071   2071     p->maxStmt = NUM_PREPARED_STMTS;
  2072   2072     p->interp = interp;
  2073   2073     zArg = Tcl_GetStringFromObj(objv[1], 0);
  2074   2074     Tcl_CreateObjCommand(interp, zArg, DbObjCmd, (char*)p, DbDeleteCmd);
  2075   2075