]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Cleanup LMDBIndexOps
authorFred Morcos <fred.morcos@open-xchange.com>
Wed, 16 Oct 2024 13:25:25 +0000 (15:25 +0200)
committerFred Morcos <fred.morcos@open-xchange.com>
Wed, 16 Oct 2024 13:57:48 +0000 (15:57 +0200)
ext/lmdb-safe/lmdb-typed.hh

index ce7af61154e4f99cdba751d7f93f0e12fcfb2196..ebf52bd0f8c7c6fedb4d183f3449c4de2f763e87 100644 (file)
@@ -145,21 +145,18 @@ struct LMDBIndexOps
 {
   explicit LMDBIndexOps(Parent* parent) : d_parent(parent){}
 
-  void put(MDBRWTransaction& txn, const Class& t, uint32_t id, int flags=0)
+  void put(MDBRWTransaction& txn, const Class& type, uint32_t idVal, int flags = 0)
   {
-    std::string sempty;
-    MDBInVal empty(sempty);
-
-    auto scombined = makeCombinedKey(keyConv(d_parent->getMember(t)), id);
+    auto scombined = makeCombinedKey(keyConv(d_parent->getMember(type)), idVal);
     MDBInVal combined(scombined);
 
     // if the entry existed already, this will just update the timestamp/txid in the LS header. This is intentional, so objects and their indexes always get synced together.
-    txn->put(d_idx, combined, empty, flags);
+    txn->put(d_idx, combined, string{}, flags);
   }
 
-  void del(MDBRWTransaction& txn, const Class& t, uint32_t id)
+  void del(MDBRWTransaction& txn, const Class& type, uint32_t idVal)
   {
-    auto scombined = makeCombinedKey(keyConv(d_parent->getMember(t)), id);
+    auto scombined = makeCombinedKey(keyConv(d_parent->getMember(type)), idVal);
     MDBInVal combined(scombined);
 
     int errCode = txn->del(d_idx, combined);
@@ -172,9 +169,9 @@ struct LMDBIndexOps
   {
     d_idx = env->openDB(str, flags);
   }
+
   MDBDbi d_idx;
   Parent* d_parent;
-
 };
 
 /** This is an index on a field in a struct, it derives from the LMDBIndexOps */