We really dont care about macro expanded per-db error prefix
authorPanu Matilainen <pmatilai@redhat.com>
Tue, 30 Mar 2010 23:04:21 +0000 (02:04 +0300)
committerPanu Matilainen <pmatilai@redhat.com>
Tue, 30 Mar 2010 23:04:21 +0000 (02:04 +0300)
lib/backend/db3.c
lib/rpmdb.c
lib/rpmdb_internal.h

index 0bbdaad..075dd9d 100644 (file)
@@ -18,6 +18,8 @@ static int _debug = 1;        /* XXX if < 0 debugging, > 0 unusual error returns */
 
 #include "debug.h"
 
+static const char * _errpfx = "rpmdb";
+
 static int cvtdberr(dbiIndex dbi, const char * msg, int error, int printit)
 {
     if (printit && error) {
@@ -113,7 +115,7 @@ static int db_init(dbiIndex dbi, const char * dbhome, DB_ENV ** dbenvp)
 
     dbenv->set_alloc(dbenv, rmalloc, rrealloc, NULL);
     dbenv->set_errcall(dbenv, NULL);
-    dbenv->set_errpfx(dbenv, rpmdb->db_errpfx);
+    dbenv->set_errpfx(dbenv, _errpfx);
 
 #if (DB_VERSION_MAJOR >= 4 && DB_VERSION_MINOR >= 5)
     /* 
@@ -412,7 +414,7 @@ int dbiClose(dbiIndex dbi, unsigned int flags)
        if (rc || dbenv == NULL) goto exit;
 
        dbenv->set_errcall(dbenv, NULL);
-       dbenv->set_errpfx(dbenv, rpmdb->db_errpfx);
+       dbenv->set_errpfx(dbenv, _errpfx);
 #if !(DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR >= 3)
        xx = dbenv->set_verbose(dbenv, DB_VERB_CHKPOINT,
                (dbi->dbi_verbose & DB_VERB_CHKPOINT));
index cc2d33c..f050a31 100644 (file)
@@ -566,11 +566,10 @@ static int unblockSignals(sigset_t * oldMask)
 #define _DB_PERMS      0644
 
 #define _DB_MAJOR      -1
-#define        _DB_ERRPFX      "rpmdb"
 
 static struct rpmdb_s const dbTemplate = {
     _DB_ROOT,  _DB_HOME, _DB_FULLPATH, _DB_FLAGS, _DB_MODE, _DB_PERMS,
-    _DB_MAJOR, _DB_ERRPFX
+    _DB_MAJOR,
 };
 
 rpmop rpmdbOp(rpmdb rpmdb, rpmdbOpX opx)
@@ -670,7 +669,6 @@ int rpmdbClose(rpmdb db)
        if (xx && rc == 0) rc = xx;
        db->_dbi[dbix] = NULL;
     }
-    db->db_errpfx = _free(db->db_errpfx);
     db->db_root = _free(db->db_root);
     db->db_home = _free(db->db_home);
     db->db_fullpath = _free(db->db_fullpath);
@@ -720,7 +718,6 @@ rpmdb newRpmdb(const char * root,
                int mode, int perms, int flags)
 {
     rpmdb db = xcalloc(sizeof(*db), 1);
-    const char * epfx = _DB_ERRPFX;
     static int _initialized = 0;
 
     if (!_initialized) {
@@ -746,7 +743,6 @@ rpmdb newRpmdb(const char * root,
     }
     db->db_root = rpmGetPath((root && *root) ? root : _DB_ROOT, NULL);
     db->db_fullpath = rpmGenPath(db->db_root, db->db_home, NULL);
-    db->db_errpfx = rpmExpand( (epfx && *epfx ? epfx : _DB_ERRPFX), NULL);
     /* XXX remove environment after chrooted operations, for now... */
     db->db_remove_env = (!rstreq(db->db_root, "/") ? 1 : 0);
     db->_dbi = xcalloc(dbiTagsMax, sizeof(*db->_dbi));
index 761bac0..55f692b 100644 (file)
@@ -117,7 +117,6 @@ struct rpmdb_s {
     int                db_mode;        /*!< open mode */
     int                db_perms;       /*!< open permissions */
     int                db_api;         /*!< Berkeley API type */
-    char       * db_errpfx;
     int                db_remove_env;
     int                db_chrootDone;  /*!< If chroot(2) done, ignore db_root. */
     int                db_mkdirDone;   /*!< Has db_home been created? */