This is holdover from an earlier version of the code and doesn't really
provide any benefit. Also, mark the topdir and dirname arguments const
since they should never be changed.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
-/* top level DB directory */
-static char *sqlite_topdir;
-
/* reusable pathname and sql command buffer */
static char buf[PATH_MAX];
/* reusable pathname and sql command buffer */
static char buf[PATH_MAX];
/* make a directory, ignoring EEXIST errors unless it's not a directory */
static int
/* make a directory, ignoring EEXIST errors unless it's not a directory */
static int
-mkdir_if_not_exist(char *dirname)
+mkdir_if_not_exist(const char *dirname)
{
int ret;
struct stat statbuf;
{
int ret;
struct stat statbuf;
* the "clients" table.
*/
int
* the "clients" table.
*/
int
-sqlite_maindb_init(char *topdir)
+sqlite_maindb_init(const char *topdir)
{
int ret;
char *err = NULL;
sqlite3_stmt *stmt = NULL;
{
int ret;
char *err = NULL;
sqlite3_stmt *stmt = NULL;
- sqlite_topdir = topdir;
-
- ret = mkdir_if_not_exist(sqlite_topdir);
+ ret = mkdir_if_not_exist(topdir);
- ret = snprintf(buf, PATH_MAX - 1, "%s/main.sqlite", sqlite_topdir);
+ ret = snprintf(buf, PATH_MAX - 1, "%s/main.sqlite", topdir);
#ifndef _SQLITE_H_
#define _SQLITE_H_
#ifndef _SQLITE_H_
#define _SQLITE_H_
-int sqlite_maindb_init(char *topdir);
+int sqlite_maindb_init(const char *topdir);
int sqlite_insert_client(const unsigned char *clname, const size_t namelen);
int sqlite_remove_client(const unsigned char *clname, const size_t namelen);
int sqlite_check_client(const unsigned char *clname, const size_t namelen);
int sqlite_insert_client(const unsigned char *clname, const size_t namelen);
int sqlite_remove_client(const unsigned char *clname, const size_t namelen);
int sqlite_check_client(const unsigned char *clname, const size_t namelen);