Extends the direct access model to other collections

This commit is contained in:
Felipe Zimmerle
2017-01-26 23:13:38 -03:00
committed by Felipe Zimmerle
parent ca24b6bb06
commit f2d149fc5f
157 changed files with 7711 additions and 4959 deletions

View File

@@ -155,11 +155,11 @@ void InMemoryPerProcess::resolveRegularExpression(const std::string& var,
}
std::string* InMemoryPerProcess::resolveFirst(const std::string& var) {
std::unique_ptr<std::string> InMemoryPerProcess::resolveFirst(const std::string& var) {
auto range = equal_range(var);
for (auto it = range.first; it != range.second; ++it) {
return &it->second;
return std::unique_ptr<std::string>(new std::string(it->second));
}
return NULL;

View File

@@ -82,7 +82,7 @@ class InMemoryPerProcess :
void del(const std::string& key) override;
std::string* resolveFirst(const std::string& var) override;
std::unique_ptr<std::string> resolveFirst(const std::string& var) override;
void resolveSingleMatch(const std::string& var,
std::vector<const Variable *> *l) override;

View File

@@ -161,7 +161,7 @@ void LMDB::lmdb_debug(int rc, std::string op, std::string scope) {
}
std::string* LMDB::resolveFirst(const std::string& var) {
std::unique_ptr<std::string> LMDB::resolveFirst(const std::string& var) {
int rc;
MDB_val mdb_key;
MDB_val mdb_value;
@@ -188,10 +188,9 @@ std::string* LMDB::resolveFirst(const std::string& var) {
goto end_get;
}
// FIXME: Memory leak here.
ret = new std::string(
ret = std::unique_ptr<std::string>(new std::string(
reinterpret_cast<char *>(mdb_value_ret.mv_data),
mdb_value_ret.mv_size);
mdb_value_ret.mv_size));
end_get:
mdb_dbi_close(m_env, dbi);

View File

@@ -61,7 +61,7 @@ class LMDB :
void del(const std::string& key) override;
std::string* resolveFirst(const std::string& var) override;
std::unique_ptr<std::string> resolveFirst(const std::string& var) override;
void resolveSingleMatch(const std::string& var,
std::vector<const Variable *> *l) override;