Skip to content

Commit 52856ad

Browse files
committed
constexpr + noexcept jrd
1 parent 7863e7d commit 52856ad

File tree

5 files changed

+186
-194
lines changed

5 files changed

+186
-194
lines changed

src/jrd/Attachment.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ string Jrd::Attachment::stringToUserCharSet(thread_db* tdbb, const string& str)
380380
return str;
381381

382382
HalfStaticArray<UCHAR, BUFFER_MEDIUM> buffer(str.length() * sizeof(ULONG));
383-
ULONG len = INTL_convert_bytes(tdbb, att_charset, buffer.begin(), buffer.getCapacity(),
383+
const ULONG len = INTL_convert_bytes(tdbb, att_charset, buffer.begin(), buffer.getCapacity(),
384384
CS_METADATA, (const BYTE*) str.c_str(), str.length(), ERR_post);
385385

386386
return string((char*) buffer.begin(), len);
@@ -454,8 +454,8 @@ static void runDBTriggers(thread_db* tdbb, TriggerAction action)
454454
{
455455
fb_assert(action == TRIGGER_CONNECT || action == TRIGGER_DISCONNECT);
456456

457-
Database* dbb = tdbb->getDatabase();
458-
Attachment* att = tdbb->getAttachment();
457+
const Database* dbb = tdbb->getDatabase();
458+
const Attachment* att = tdbb->getAttachment();
459459
fb_assert(dbb);
460460
fb_assert(att);
461461

@@ -641,7 +641,7 @@ void Jrd::Attachment::mergeStats(bool pageStatsOnly)
641641
}
642642

643643

644-
bool Attachment::hasActiveRequests() const
644+
bool Attachment::hasActiveRequests() const noexcept
645645
{
646646
for (const jrd_tra* transaction = att_transactions;
647647
transaction; transaction = transaction->tra_next)
@@ -661,7 +661,7 @@ bool Attachment::hasActiveRequests() const
661661
// Find an inactive incarnation of a system request. If necessary, clone it.
662662
Request* Jrd::Attachment::findSystemRequest(thread_db* tdbb, USHORT id, USHORT which)
663663
{
664-
static const int MAX_RECURSION = 100;
664+
constexpr int MAX_RECURSION = 100;
665665

666666
// If the request hasn't been compiled or isn't active, there're nothing to do.
667667

@@ -1084,7 +1084,7 @@ unsigned int Attachment::getActualIdleTimeout() const
10841084

10851085
void Attachment::setupIdleTimer(bool clear)
10861086
{
1087-
unsigned int timeout = clear ? 0 : getActualIdleTimeout();
1087+
const unsigned int timeout = clear ? 0 : getActualIdleTimeout();
10881088
if (!timeout || hasActiveRequests())
10891089
{
10901090
if (att_idle_timer)
@@ -1187,7 +1187,7 @@ ProfilerManager* Attachment::getProfilerManager(thread_db* tdbb)
11871187

11881188
ProfilerManager* Attachment::getActiveProfilerManagerForNonInternalStatement(thread_db* tdbb)
11891189
{
1190-
const auto request = tdbb->getRequest();
1190+
const auto* request = tdbb->getRequest();
11911191

11921192
return isProfilerActive() && !request->hasInternalStatement() ?
11931193
getProfilerManager(tdbb) :

src/jrd/Attachment.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ class Attachment : public pool_alloc<type_att>
753753
void signalShutdown(ISC_STATUS code);
754754

755755
void mergeStats(bool pageStatsOnly = false);
756-
bool hasActiveRequests() const;
756+
bool hasActiveRequests() const noexcept;
757757

758758
bool backupStateWriteLock(thread_db* tdbb, SSHORT wait);
759759
void backupStateWriteUnLock(thread_db* tdbb);
@@ -843,7 +843,7 @@ class Attachment : public pool_alloc<type_att>
843843
return user ? user->getUserName() : emptyName;
844844
}
845845

846-
void setInitialOptions(thread_db* tdbb, DatabaseOptions& options, bool newDb);
846+
void setInitialOptions(thread_db* tdbb, const DatabaseOptions& options, bool newDb);
847847

848848
const CoercionArray* getInitialBindings() const noexcept
849849
{
@@ -863,7 +863,7 @@ class Attachment : public pool_alloc<type_att>
863863
bool isProfilerActive();
864864
void releaseProfilerManager(thread_db* tdbb);
865865

866-
JProvider* getProvider()
866+
JProvider* getProvider() noexcept
867867
{
868868
fb_assert(att_provider);
869869
return att_provider;
@@ -1015,7 +1015,7 @@ class AttachmentsRefHolder
10151015
}
10161016
}
10171017

1018-
bool hasData() const
1018+
bool hasData() const noexcept
10191019
{
10201020
return m_attachments.hasData();
10211021
}

0 commit comments

Comments
 (0)