From a3d61e3d18f14aba3d3c63198e12f4bb8d9e187a Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Fri, 16 May 2025 15:21:48 +0100 Subject: Rename id to uniqueid to avoid shadowing. --- include/account.h | 2 +- src/nickcore.cpp | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/account.h b/include/account.h index 9ab0fea08..6f8bed01b 100644 --- a/include/account.h +++ b/include/account.h @@ -137,7 +137,7 @@ private: /* Channels which reference this core in some way (this is on their access list, akick list, is founder, successor, etc) */ Serialize::Checker > chanaccess; /* Unique identifier for the account. */ - uint64_t id; + uint64_t uniqueid; public: /* Name of the account. Find(display)->nc == this. */ Anope::string display; diff --git a/src/nickcore.cpp b/src/nickcore.cpp index e05bda442..424b3e313 100644 --- a/src/nickcore.cpp +++ b/src/nickcore.cpp @@ -21,7 +21,7 @@ Serialize::Checker NickCoreIdList(NICKCORE_TYPE); NickCore::NickCore(const Anope::string &coredisplay, uint64_t coreid) : Serializable(NICKCORE_TYPE) , chanaccess(CHANNELINFO_TYPE) - , id(coreid) + , uniqueid(coreid) , display(coredisplay) , aliases(NICKALIAS_TYPE) { @@ -252,25 +252,25 @@ NickCore *NickCore::FindId(uint64_t id) uint64_t NickCore::GetId() { - if (this->id) - return this->id; + if (this->uniqueid) + return this->uniqueid; // We base the account identifier on the account display at registration and // when the account was first registered. This should be unique enough that // it never collides. In the extremely rare case that it does generate a // duplicate id we try with a new suffix. uint64_t attempt = 0; - while (!this->id) + while (!this->uniqueid) { const auto newidstr = this->display + "\0" + Anope::ToString(this->registered) + "\0" + Anope::ToString(attempt++); const auto newid = Anope::hash_cs()(newidstr); if (NickCoreIdList->emplace(newid, this).second) { - this->id = newid; + this->uniqueid = newid; this->QueueUpdate(); break; } } - return this->id; + return this->uniqueid; } -- cgit