Pass package pointer by reference when parsing database file

This commit is contained in:
Martchus 2022-04-20 22:52:50 +02:00
parent a780b26ef6
commit 6965d9b40b
2 changed files with 2 additions and 2 deletions

View File

@ -397,7 +397,7 @@ struct LIBPKG_EXPORT Package : public ReflectiveRapidJSON::JsonSerializable<Pack
static std::vector<PackageSpec> fromInfo(const std::string &info, bool isPackageInfo = false);
static std::shared_ptr<Package> fromDescription(const std::vector<std::string> &descriptionParts);
static void fromDatabaseFile(const std::string &archivePath, const std::function<bool(std::shared_ptr<Package>)> &visitor);
static void fromDatabaseFile(const std::string &archivePath, const std::function<bool(const std::shared_ptr<Package> &)> &visitor);
static std::shared_ptr<Package> fromPkgFile(const std::string &path);
static std::tuple<std::string_view, std::string_view, std::string_view> fileNameComponents(std::string_view fileName);
static std::shared_ptr<Package> fromPkgFileName(std::string_view fileName);

View File

@ -716,7 +716,7 @@ std::shared_ptr<Package> Package::fromDescription(const std::vector<std::string>
return package;
}
void Package::fromDatabaseFile(const std::string &archivePath, const std::function<bool(std::shared_ptr<Package>)> &visitor)
void Package::fromDatabaseFile(const std::string &archivePath, const std::function<bool(const std::shared_ptr<Package> &)> &visitor)
{
// walk though archive, file-by-file; parse files as soon as desc/files available and return via visitor
auto packages = std::unordered_map<std::string, std::vector<std::string>>();