Patchwork [06/11] libnsdb: Clean up some sparse warnings

login
register
mail settings
Submitter Chuck Lever
Date Oct. 19, 2012, 9:08 p.m.
Message ID <20121019210828.53119.2892.stgit@seurat.1015granger.net>
Download mbox | patch
Permalink /patch/192811/
State Accepted
Headers show

Comments

Chuck Lever - Oct. 19, 2012, 9:08 p.m.
Address the following sparse warnings in libnsdb.so:

nsdb.c:76:6: warning: symbol 'fedfs_base_dirname' was not declared. Should
it be static?
nsdb.c:87:6: warning: symbol 'fedfs_nsdbcerts_dirname' was not declared.
Should it be static?
nsdb.c:231:70: warning: Using plain integer as NULL pointer

sqlite.c:161:69: warning: Using plain integer as NULL pointer
sqlite.c:184:60: warning: Using plain integer as NULL pointer
sqlite.c:206:62: warning: Using plain integer as NULL pointer

Introduced by commit 0520ee72 "Initial commit" March 29, 2011.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---

 src/libnsdb/nsdb.c   |    7 ++++---
 src/libnsdb/sqlite.c |    7 ++++---
 2 files changed, 8 insertions(+), 6 deletions(-)

Patch

diff --git a/src/libnsdb/nsdb.c b/src/libnsdb/nsdb.c
index 4b35544..46b7845 100644
--- a/src/libnsdb/nsdb.c
+++ b/src/libnsdb/nsdb.c
@@ -73,7 +73,7 @@ 
 /**
  * Stores pathname of directory containing FedFS persistent state
  */
-char fedfs_base_dirname[PATH_MAX + 1] =
+static char fedfs_base_dirname[PATH_MAX + 1] =
 			FEDFS_DEFAULT_STATEDIR;
 
 /**
@@ -84,7 +84,7 @@  char fedfs_base_dirname[PATH_MAX + 1] =
 /**
  * Stores pathname of directory containing NSDB x509v3 certs
  */
-char fedfs_nsdbcerts_dirname[PATH_MAX + 1] =
+static char fedfs_nsdbcerts_dirname[PATH_MAX + 1] =
 			FEDFS_DEFAULT_STATEDIR "/" FEDFS_NSDBCERT_DIR;
 
 /**
@@ -228,7 +228,8 @@  nsdb_init_database(void)
 	 * This provides better performance and crash robustness.
 	 */
 	err_msg = NULL;
-	rc = sqlite3_exec(db, "PRAGMA journal_mode=TRUNCATE;", NULL, 0, &err_msg);
+	rc = sqlite3_exec(db, "PRAGMA journal_mode=TRUNCATE;",
+					NULL, NULL, &err_msg);
 	if (rc != SQLITE_OK) {
 		xlog(L_ERROR, "Failed to enable persistent journaling: %s",
 				err_msg);
diff --git a/src/libnsdb/sqlite.c b/src/libnsdb/sqlite.c
index 398303c..616dce3 100644
--- a/src/libnsdb/sqlite.c
+++ b/src/libnsdb/sqlite.c
@@ -158,7 +158,8 @@  nsdb_begin_transaction(sqlite3 *db)
 	int rc;
 
 	err_msg = NULL;
-	rc = sqlite3_exec(db, "BEGIN IMMEDIATE TRANSACTION;", NULL, 0, &err_msg);
+	rc = sqlite3_exec(db, "BEGIN IMMEDIATE TRANSACTION;",
+					NULL, NULL, &err_msg);
 	if (rc != SQLITE_OK) {
 		xlog(L_ERROR, "Failed to start transaction: %s", err_msg);
 		sqlite3_free(err_msg);
@@ -181,7 +182,7 @@  nsdb_end_transaction(sqlite3 *db)
 	int rc;
 
 	err_msg = NULL;
-	rc = sqlite3_exec(db, "COMMIT TRANSACTION;", NULL, 0, &err_msg);
+	rc = sqlite3_exec(db, "COMMIT TRANSACTION;", NULL, NULL, &err_msg);
 	if (rc != SQLITE_OK) {
 		xlog(L_ERROR, "Failed to commit transaction: %s", err_msg);
 		sqlite3_free(err_msg);
@@ -203,7 +204,7 @@  nsdb_rollback_transaction(sqlite3 *db)
 	int rc;
 
 	err_msg = NULL;
-	rc = sqlite3_exec(db, "ROLLBACK TRANSACTION;", NULL, 0, &err_msg);
+	rc = sqlite3_exec(db, "ROLLBACK TRANSACTION;", NULL, NULL, &err_msg);
 	if (rc != SQLITE_OK) {
 		xlog(L_ERROR, "Failed to roll back transaction: %s", err_msg);
 		sqlite3_free(err_msg);