[Debtags-commits] [svn] r995 - central-database/trunk/c-tdb
Erich Schubert
erich at costa.debian.org
Tue Jul 19 15:37:02 UTC 2005
Author: erich
Date: Tue Jul 19 15:37:01 2005
New Revision: 995
Added:
central-database/trunk/c-tdb/hierarchy.cc
Modified:
central-database/trunk/c-tdb/ (props changed)
central-database/trunk/c-tdb/Makefile
central-database/trunk/c-tdb/mappkgtag.cc
central-database/trunk/c-tdb/mytdb.cc
Log:
Fixed tdb api problem, added 'hierarchy' tool which produces similar results as the current web frontend
Modified: central-database/trunk/c-tdb/Makefile
==============================================================================
--- central-database/trunk/c-tdb/Makefile (original)
+++ central-database/trunk/c-tdb/Makefile Tue Jul 19 15:37:01 2005
@@ -19,3 +19,4 @@
load-tags: load-tags.o mytdb.o pkgdb.o vocdb.o mappkgtag.o idlist.o
query: query.o mytdb.o pkgdb.o vocdb.o mappkgtag.o idlist.o
browse: browse.o mytdb.o pkgdb.o vocdb.o mappkgtag.o idlist.o
+hierarchy: hierarchy.o mytdb.o pkgdb.o vocdb.o mappkgtag.o idlist.o
Modified: central-database/trunk/c-tdb/mappkgtag.cc
==============================================================================
--- central-database/trunk/c-tdb/mappkgtag.cc (original)
+++ central-database/trunk/c-tdb/mappkgtag.cc Tue Jul 19 15:37:01 2005
@@ -4,7 +4,7 @@
using namespace std;
-MapDB::MapDB(const char* filename, int flags) : MyTDB(filename, flags) {};
+MapDB::MapDB(const char* filename, int flags) : MyTDB(filename, flags) {}
void MapDB::add_to_list(u_int32_t key, u_int32_t value) {
TDB_DATA k, d;
@@ -13,7 +13,10 @@
d = tdb_fetch(db, k);
if (d.dptr) {
- tdb_lockkeys(db, 1, &k);
+ // The lockkeys call has disappeared from the lib,
+ // albeit it's still in the header file...
+ //tdb_lockkeys(db, 1, &k);
+ tdb_lockall(db);
idlist* il = (idlist*) d.dptr;
if (d.dsize != il->memsize()) {
cerr << "Size is " << d.dsize << " but memsize is " << il->memsize() << " ( " << il->size << ")" << endl;
@@ -37,7 +40,10 @@
} else
cout << "Value " << value << " found at position " << pos << " in key " << key << endl;
free(d.dptr);
- tdb_unlockkeys(db);
+ // The unlockkeys call has disappeared from the lib,
+ // albeit it's still in the header file...
+ //tdb_unlockkeys(db);
+ tdb_unlockall(db);
} else {
idlist* ilneu = idlist::make(1,&value);
TDB_DATA newd;
Modified: central-database/trunk/c-tdb/mytdb.cc
==============================================================================
--- central-database/trunk/c-tdb/mytdb.cc (original)
+++ central-database/trunk/c-tdb/mytdb.cc Tue Jul 19 15:37:01 2005
@@ -34,11 +34,18 @@
TDB_DATA k[1];
k[0].dptr = (char*) key;
k[0].dsize = strlen(key);
- tdb_lockkeys(db, 1, k);
+
+ // The lockkeys call has disappeared from the lib,
+ // albeit it's still in the header file...
+ //tdb_lockkeys(db, 1, k);
+ tdb_lockall(db);
}
void MyTDB::unlock() {
- tdb_unlockkeys(db);
+ // The lockkeys call has disappeared from the lib,
+ // albeit it's still in the header file...
+ //tdb_unlockkeys(db);
+ tdb_unlockall(db);
}
int MyTDB::store_char_u32(const char* key, u_int32_t value, int flag) {
@@ -60,7 +67,7 @@
v = tdb_fetch(db, k);
if (!v.dptr) throw KeyNotFoundError();
- int value = value = * (int*) v.dptr;
+ int value = * (int*) v.dptr;
free(v.dptr);
return value;
}
More information about the Debtags-commits
mailing list