Skip to content

Commit 6966fbc

Browse files
committed
constexpr in shut
1 parent 7c08340 commit 6966fbc

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/jrd/shut.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
using namespace Jrd;
4141
using namespace Firebird;
4242

43-
const SSHORT SHUT_WAIT_TIME = 5;
43+
constexpr SSHORT SHUT_WAIT_TIME = 5;
4444

4545
// Shutdown lock data
4646
union shutdown_data
@@ -55,20 +55,20 @@ union shutdown_data
5555
// Low byte of shutdown_data::flag used by shutdown modes, see isc_dpb_shut_XXX
5656
// High byte used for additional flags
5757

58-
const SSHORT SHUT_flag_restoring = 0x0100; // database restore is in progress
58+
constexpr SSHORT SHUT_flag_restoring = 0x0100; // database restore is in progress
5959

6060
// Define this to true if you need to allow no-op behavior when requested shutdown mode
6161
// matches current. Logic of jrd8_create_database may need attention in this case too
62-
const bool IGNORE_SAME_MODE = false;
62+
constexpr bool IGNORE_SAME_MODE = false;
6363

64-
static void bad_mode(Database* dbb)
64+
[[noreturn]] static void bad_mode(const Database* dbb)
6565
{
6666
ERR_post(Arg::Gds(isc_bad_shutdown_mode) << Arg::Str(dbb->dbb_database_name));
6767
}
6868

69-
static void same_mode(Database* dbb)
69+
static void same_mode(const Database* dbb)
7070
{
71-
if (!IGNORE_SAME_MODE)
71+
if constexpr (!IGNORE_SAME_MODE)
7272
bad_mode(dbb);
7373
}
7474

@@ -344,8 +344,8 @@ void SHUT_online(thread_db* tdbb, SSHORT flag, Sync* guard)
344344
*
345345
**************************************/
346346
SET_TDBB(tdbb);
347-
Database* const dbb = tdbb->getDatabase();
348-
Jrd::Attachment* const attachment = tdbb->getAttachment();
347+
const Database* const dbb = tdbb->getDatabase();
348+
const Jrd::Attachment* const attachment = tdbb->getAttachment();
349349

350350
// Only platform's user locksmith can shutdown or bring online a database
351351

@@ -447,7 +447,7 @@ void SHUT_online(thread_db* tdbb, SSHORT flag, Sync* guard)
447447

448448
static void check_backup_state(thread_db* tdbb)
449449
{
450-
const auto dbb = tdbb->getDatabase();
450+
const auto* dbb = tdbb->getDatabase();
451451

452452
BackupManager::StateReadGuard stateGuard(tdbb);
453453

0 commit comments

Comments
 (0)