Skip to content

Commit 3d61133

Browse files
committed
inline constexpr in dyn
+ reduce repetition in initialization of dyn_fld
1 parent 1d6ba41 commit 3d61133

File tree

1 file changed

+21
-29
lines changed

1 file changed

+21
-29
lines changed

src/jrd/dyn.h

Lines changed: 21 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@
3131
#include "../common/classes/fb_string.h"
3232
#include "../common/dsc.h"
3333

34-
const char* const ALL_PRIVILEGES = "SIUDR"; // all applicable grant/revoke privileges
35-
const char* const EXEC_PRIVILEGES = "X"; // execute privilege
36-
const char* const USAGE_PRIVILEGES = "G"; // usage privilege
37-
const char* const ALL_DDL_PRIVILEGES = "CLO";
34+
inline constexpr const char* ALL_PRIVILEGES = "SIUDR"; // all applicable grant/revoke privileges
35+
inline constexpr const char* EXEC_PRIVILEGES = "X"; // execute privilege
36+
inline constexpr const char* USAGE_PRIVILEGES = "G"; // usage privilege
37+
inline constexpr const char* ALL_DDL_PRIVILEGES = "CLO";
3838

39-
const int DYN_MSG_FAC = 8;
39+
inline constexpr int DYN_MSG_FAC = FB_IMPL_MSG_FACILITY_DYN;
4040

4141

4242
namespace Jrd {
@@ -48,37 +48,29 @@ class dyn_fld
4848
{
4949
public:
5050
dsc dyn_dsc;
51-
bool dyn_null_flag;
52-
USHORT dyn_dtype;
53-
USHORT dyn_precision;
54-
USHORT dyn_charlen;
55-
SSHORT dyn_collation;
56-
SSHORT dyn_charset;
57-
SSHORT dyn_sub_type;
51+
bool dyn_null_flag = false;
52+
USHORT dyn_dtype = 0;
53+
USHORT dyn_precision = 0;
54+
USHORT dyn_charlen = 0;
55+
SSHORT dyn_collation = 0;
56+
SSHORT dyn_charset = 0;
57+
SSHORT dyn_sub_type = 0;
5858
QualifiedName dyn_fld_source;
5959
QualifiedName dyn_rel_name;
6060
QualifiedName dyn_fld_name;
61-
USHORT dyn_charbytelen; // Used to check modify operations on string types.
62-
const UCHAR* dyn_default_src;
63-
const UCHAR* dyn_default_val;
64-
bool dyn_drop_default;
65-
const UCHAR* dyn_computed_src;
66-
const UCHAR* dyn_computed_val;
67-
bool dyn_drop_computed;
61+
USHORT dyn_charbytelen = 0; // Used to check modify operations on string types.
62+
const UCHAR* dyn_default_src = nullptr;
63+
const UCHAR* dyn_default_val = nullptr;
64+
bool dyn_drop_default = false;
65+
const UCHAR* dyn_computed_src = nullptr;
66+
const UCHAR* dyn_computed_val = nullptr;
67+
bool dyn_drop_computed = false;
6868
public:
6969
explicit dyn_fld(MemoryPool& p)
70-
: dyn_null_flag(false), dyn_dtype(0), dyn_precision(0), dyn_charlen(0),
71-
dyn_collation(0), dyn_charset(0), dyn_sub_type(0), dyn_fld_source(p), dyn_rel_name(p),
72-
dyn_fld_name(p), dyn_charbytelen(0),
73-
dyn_default_src(0), dyn_default_val(0), dyn_drop_default(false),
74-
dyn_computed_src(0), dyn_computed_val(0), dyn_drop_computed(false)
70+
: dyn_fld_source(p), dyn_rel_name(p), dyn_fld_name(p)
7571
{ }
7672

77-
dyn_fld()
78-
: dyn_null_flag(false), dyn_dtype(0), dyn_precision(0), dyn_charlen(0),
79-
dyn_collation(0), dyn_charset(0), dyn_charbytelen(0),
80-
dyn_default_src(0), dyn_default_val(0), dyn_drop_default(false),
81-
dyn_computed_src(0), dyn_computed_val(0), dyn_drop_computed(false)
73+
dyn_fld() noexcept
8274
{ }
8375
};
8476

0 commit comments

Comments
 (0)