From 1b2916c8451506adccf3ab0a56bbf836d9f3cb36 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Tue, 10 Jan 2023 20:57:56 +0000 Subject: Avoid copying shared_ptr when not necessary. --- src/configreader.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/configreader.cpp') diff --git a/src/configreader.cpp b/src/configreader.cpp index db164c665..97a483411 100644 --- a/src/configreader.cpp +++ b/src/configreader.cpp @@ -41,7 +41,7 @@ #include "configparser.h" #include "exitcodes.h" -ServerLimits::ServerLimits(std::shared_ptr tag) +ServerLimits::ServerLimits(const std::shared_ptr& tag) : MaxLine(tag->getUInt("maxline", 512, 512)) , MaxNick(tag->getUInt("maxnick", 30, 1, MaxLine)) , MaxChannel(tag->getUInt("maxchan", 60, 1, MaxLine)) @@ -56,7 +56,7 @@ ServerLimits::ServerLimits(std::shared_ptr tag) { } -ServerConfig::ServerPaths::ServerPaths(std::shared_ptr tag) +ServerConfig::ServerPaths::ServerPaths(const std::shared_ptr& tag) : Config(tag->getString("configdir", INSPIRCD_CONFIG_PATH, 1)) , Data(tag->getString("datadir", INSPIRCD_DATA_PATH, 1)) , Log(tag->getString("logdir", INSPIRCD_LOG_PATH, 1)) @@ -553,7 +553,7 @@ void ServerConfig::ApplyModules(User* user) } } -std::shared_ptr ServerConfig::ConfValue(const std::string& tag, std::shared_ptr def) const +const std::shared_ptr& ServerConfig::ConfValue(const std::string& tag, const std::shared_ptr& def) const { auto tags = insp::equal_range(config_data, tag); if (tags.empty()) -- cgit v1.3.1-10-gc9f91