[asterisk-commits] twilson: branch twilson/sqlite_astdb r323369 - in /team/twilson/sqlite_astdb:...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jun 14 11:22:54 CDT 2011
Author: twilson
Date: Tue Jun 14 11:22:52 2011
New Revision: 323369
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=323369
Log:
Address review comments of tzafrir and tilghman
Modified:
team/twilson/sqlite_astdb/configure
team/twilson/sqlite_astdb/configure.ac
team/twilson/sqlite_astdb/main/db.c
Modified: team/twilson/sqlite_astdb/configure.ac
URL: http://svnview.digium.com/svn/asterisk/team/twilson/sqlite_astdb/configure.ac?view=diff&rev=323369&r1=323368&r2=323369
==============================================================================
--- team/twilson/sqlite_astdb/configure.ac (original)
+++ team/twilson/sqlite_astdb/configure.ac Tue Jun 14 11:22:52 2011
@@ -1971,8 +1971,8 @@
AST_EXT_LIB_CHECK([SQLITE3], [sqlite3], [sqlite3_open], [sqlite3.h], [${PTHREAD_LIBS}], [${PTHREAD_CFLAGS}])
if test "${PBX_SQLITE3}" != 1; then
- AC_MSG_NOTICE(*** Asterisk now uses SQLite3 for the internal Asterisk database.)
- AC_MSG_NOTICE(*** Please install the SQLite3 development package.)
+ AC_MSG_WARN(*** Asterisk now uses SQLite3 for the internal Asterisk database.)
+ AC_MSG_WARN(*** Please install the SQLite3 development package.)
exit 1
fi
Modified: team/twilson/sqlite_astdb/main/db.c
URL: http://svnview.digium.com/svn/asterisk/team/twilson/sqlite_astdb/main/db.c?view=diff&rev=323369&r1=323368&r2=323369
==============================================================================
--- team/twilson/sqlite_astdb/main/db.c (original)
+++ team/twilson/sqlite_astdb/main/db.c Tue Jun 14 11:22:52 2011
@@ -39,6 +39,7 @@
#include <unistd.h>
#include <signal.h>
#include <dirent.h>
+#include <sqlite3.h>
#include "asterisk/channel.h"
#include "asterisk/file.h"
@@ -48,7 +49,6 @@
#include "asterisk/cli.h"
#include "asterisk/utils.h"
#include "asterisk/manager.h"
-#include <sqlite3.h>
#include "db1-ast/include/db.h"
/*** DOCUMENTATION
@@ -228,7 +228,7 @@
static int db_open(void)
{
char *dbname;
- struct stat st;
+ struct stat dont_care;
int convert;
if (!(dbname = alloca(strlen(ast_config_AST_DB) + sizeof(".sqlite3")))) {
return -1;
@@ -236,7 +236,7 @@
strcpy(dbname, ast_config_AST_DB);
strcat(dbname, ".sqlite3");
- convert = stat(dbname, &st) && !stat(ast_config_AST_DB, &st);
+ convert = stat(dbname, &dont_care) && !stat(ast_config_AST_DB, &dont_care);
ast_mutex_lock(&dblock);
if (sqlite3_open_v2(dbname, &astdb, SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_NOMUTEX, NULL) != SQLITE_OK) {
@@ -286,6 +286,7 @@
sqlite3_exec(astdb, sql, NULL, NULL, &errmsg);
if (errmsg) {
ast_log(LOG_WARNING, "Error executing SQL: %s\n", errmsg);
+ sqlite3_free(errmsg);
res = -1;
}
@@ -860,7 +861,6 @@
for (;;) {
/* We're ok with spurious wakeups, so we don't worry about a predicate */
ast_cond_wait(&dbcond, &dblock);
- ast_debug(10, "Committing astdb transaction\n");
if (ast_db_commit_transaction()) {
ast_db_rollback_transaction();
}
@@ -877,7 +877,6 @@
{
pthread_t syncthread;
- sqlite3_config(SQLITE_CONFIG_SINGLETHREAD);
if (db_init()) {
return -1;
}
More information about the asterisk-commits
mailing list