commit d98e2d672ac5aecffaf8d441df4bb11e68d59e15
parent 193e849da95c65069f306748ef3a92dca23e2807
Author: cfillion <cfillion@users.noreply.github.com>
Date: Fri, 2 Jun 2017 00:59:39 -0400
registry: mild refactoring...
Diffstat:
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/registry.cpp b/src/registry.cpp
@@ -295,13 +295,13 @@ auto Registry::getMainFiles(const Entry &entry) const -> vector<File>
return mainFiles;
}
-int64_t Registry::getOwner(const Path &path) const
+auto Registry::getOwner(const Path &path) const -> Entry::id_t
{
Entry entry{};
m_getOwner->bind(1, path.join('/'));
- int64_t id = 0;
+ Entry::id_t id = 0;
m_getOwner->exec([&] {
id = m_getOwner->intColumn(0);
diff --git a/src/registry.hpp b/src/registry.hpp
@@ -29,7 +29,9 @@
class Registry {
public:
struct Entry {
- int64_t id;
+ typedef int64_t id_t;
+
+ id_t id;
std::string remote;
std::string category;
std::string package;
@@ -57,7 +59,7 @@ public:
std::vector<Entry> getEntries(const std::string &) const;
std::vector<File> getFiles(const Entry &) const;
std::vector<File> getMainFiles(const Entry &) const;
- int64_t getOwner(const Path &) const;
+ Entry::id_t getOwner(const Path &) const;
Entry push(const Version *, std::vector<Path> *conflicts = nullptr);
void setPinned(const Entry &, bool pinned);
void forget(const Entry &);
@@ -94,7 +96,7 @@ namespace std
{
std::size_t operator()(const Registry::Entry &e) const
{
- return std::hash<int64_t>()(e.id);
+ return std::hash<Registry::Entry::id_t>()(e.id);
}
};
}