-C Handle\stransient\smalloc()\sfailures\sin\ssqlite3CreateFunc().\s(CVS\s4371)
-D 2007-09-03T11:04:22
+C Add\sa\smodule-destructor\sto\sthe\secho\smodule\s(test8.c)\sto\simprove\scode\scoverage.\s(CVS\s4372)
+D 2007-09-03T11:51:50
F Makefile.in bfcc303429a5d9dcd552d807ee016c77427418c3
F Makefile.linux-gcc 65241babba6faf1152bf86574477baab19190499
F README 9c4e2d6706bdcc3efdd773ce752a8cdab4f90028
F src/test5.c 3a6a5717a149d7ca2e6d14f5be72cf7555d54dc4
F src/test6.c 0513982dfef4da2a4154b538d2bf538b84ca21d3
F src/test7.c a9d509d0e9ad214b4772696f49f6e61be26213d1
-F src/test8.c 88e033aefdf5d5522dff46655a14ea7360fb1d26
+F src/test8.c 146cb2c2e7e9bac0e30e4890e7880ffe3e223a68
F src/test9.c b46c8fe02ac7cca1a7316436d8d38d50c66f4b2f
F src/test_async.c 8b6aa6a5701bf3cf52708db178379ee608b44b0c
F src/test_autoext.c 855157d97aa28cf84233847548bfacda21807436
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
-P ed2a2e0102c4fd2221096028d55a6f1d54f97274
-R a8071f6051ea0c2f23cdc36ae305ef4b
+P c0ce63196458c81e0859fc8a38f2dd2145a580bc
+R e4b27aa117d92ab923ab170f9a80b4a8
U danielk1977
-Z fb15b228bac149e738b86ec4993bbe7d
+Z 8ba1b1c43d2e7301aebcb9fd4022cc57
** is not included in the SQLite library. It is used for automated
** testing of the SQLite library.
**
-** $Id: test8.c,v 1.55 2007/08/29 12:31:28 danielk1977 Exp $
+** $Id: test8.c,v 1.56 2007/09/03 11:51:50 danielk1977 Exp $
*/
#include "sqliteInt.h"
#include "tcl.h"
return 0;
}
+typedef struct EchoModule EchoModule;
+struct EchoModule {
+ Tcl_Interp *interp;
+};
+
/*
** This function is called to do the work of the xConnect() method -
** to allocate the required in-memory structures for a newly connected
if( !pVtab ){
return SQLITE_NOMEM;
}
- pVtab->interp = (Tcl_Interp *)pAux;
+ pVtab->interp = ((EchoModule *)pAux)->interp;
pVtab->db = db;
/* Allocate echo_vtab.zThis */
char **pzErr
){
int rc = SQLITE_OK;
- appendToEchoModule((Tcl_Interp *)(pAux), "xCreate");
+ appendToEchoModule(((EchoModule *)pAux)->interp, "xCreate");
rc = echoConstructor(db, pAux, argc, argv, ppVtab, pzErr);
/* If there were two arguments passed to the module at the SQL level
sqlite3_vtab **ppVtab,
char **pzErr
){
- appendToEchoModule((Tcl_Interp *)(pAux), "xConnect");
+ appendToEchoModule(((EchoModule *)pAux)->interp, "xConnect");
return echoConstructor(db, pAux, argc, argv, ppVtab, pzErr);
}
return TCL_OK;
}
+static void moduleDestroy(void *p){
+ sqlite3_free(p);
+}
+
/*
** Register the echo virtual table module.
*/
Tcl_Obj *CONST objv[] /* Command arguments */
){
sqlite3 *db;
+ EchoModule *pMod;
if( objc!=2 ){
Tcl_WrongNumArgs(interp, 1, objv, "DB");
return TCL_ERROR;
}
if( getDbPointer(interp, Tcl_GetString(objv[1]), &db) ) return TCL_ERROR;
- sqlite3_create_module(db, "echo", &echoModule, (void *)interp);
+ pMod = sqlite3_malloc(sizeof(EchoModule));
+ pMod->interp = interp;
+ sqlite3_create_module_v2(db, "echo", &echoModule, (void*)pMod, moduleDestroy);
return TCL_OK;
}