diff options
author | Sadie Powell <sadie@witchery.services> | 2024-03-18 12:42:41 +0000 |
---|---|---|
committer | Sadie Powell <sadie@witchery.services> | 2024-03-18 12:47:43 +0000 |
commit | 413fed474e7fbdc10128482284700f0fad41e31a (patch) | |
tree | 94b7d1ab522911c4c635f3b9cdd8a274fc6aee0c | |
parent | 60083834f802456382ffc63f0c908db3e2676feb (diff) |
Fix unnecessary uses of std::string.
-rw-r--r-- | include/convert.h | 5 | ||||
-rw-r--r-- | modules/database/db_old.cpp | 2 | ||||
-rw-r--r-- | src/hashcomp.cpp | 4 | ||||
-rw-r--r-- | src/process.cpp | 2 | ||||
-rw-r--r-- | src/threadengine.cpp | 2 |
5 files changed, 7 insertions, 8 deletions
diff --git a/include/convert.h b/include/convert.h index 3cdbcd787..2f06efda9 100644 --- a/include/convert.h +++ b/include/convert.h @@ -29,9 +29,8 @@ namespace Anope if (leftover) { - std::string extra; - std::getline(tmp, extra); - *leftover = extra; + leftover->clear(); + std::getline(tmp, leftover->str()); } else { diff --git a/modules/database/db_old.cpp b/modules/database/db_old.cpp index 55252177a..1cb4a699a 100644 --- a/modules/database/db_old.cpp +++ b/modules/database/db_old.cpp @@ -205,7 +205,7 @@ static Anope::string Hex(const char *data, size_t l) { const char hextable[] = "0123456789abcdef"; - std::string rv; + Anope::string rv; for (size_t i = 0; i < l; ++i) { unsigned char c = data[i]; diff --git a/src/hashcomp.cpp b/src/hashcomp.cpp index a32fee037..f5b026f54 100644 --- a/src/hashcomp.cpp +++ b/src/hashcomp.cpp @@ -106,7 +106,7 @@ bool sepstream::GetToken(Anope::string &token) if (!this->allow_empty) { this->pos = this->tokens.find_first_not_of(this->sep, this->pos); - if (this->pos == std::string::npos) + if (this->pos == Anope::string::npos) { this->pos = this->tokens.length() + 1; token.clear(); @@ -115,7 +115,7 @@ bool sepstream::GetToken(Anope::string &token) } size_t p = this->tokens.find(this->sep, this->pos); - if (p == std::string::npos) + if (p == Anope::string::npos) p = this->tokens.length(); token = this->tokens.substr(this->pos, p - this->pos); diff --git a/src/process.cpp b/src/process.cpp index bb31358c8..2c161de23 100644 --- a/src/process.cpp +++ b/src/process.cpp @@ -202,7 +202,7 @@ bool IRCDProto::Format(Anope::string &message, const Anope::map<Anope::string> & const auto &last = params.back(); - if (last.empty() || last[0] == ':' || last.find(' ') != std::string::npos) + if (last.empty() || last[0] == ':' || last.find(' ') != Anope::string::npos) buffer << ':'; buffer << last; } diff --git a/src/threadengine.cpp b/src/threadengine.cpp index 08765c4e4..625e97713 100644 --- a/src/threadengine.cpp +++ b/src/threadengine.cpp @@ -51,7 +51,7 @@ void Thread::Start() catch (const std::system_error &err) { this->flags[SF_DEAD] = true; - throw CoreException("Unable to create thread: " + std::string(err.what())); + throw CoreException("Unable to create thread: " + Anope::string(err.what())); } } |