Skip to content

Commit 7e2d0c0

Browse files
TreeHunter9Artyom Ivanov
andauthored
Change fb_strlen to constexpr version (#8267)
* Change fb_strlen to constexpr version * Remove copy of constexpr fb_strlen --------- Co-authored-by: Artyom Ivanov <[email protected]>
1 parent b7383ee commit 7e2d0c0

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

src/common/CvtFormat.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -228,11 +228,6 @@ namespace
228228
return std::isalpha(static_cast<unsigned char>(symbol));
229229
}
230230

231-
constexpr size_t fb_strlen_constexpr(const char* str)
232-
{
233-
return std::char_traits<char>::length(str);
234-
}
235-
236231
constexpr bool isSeparator(char symbol)
237232
{
238233
switch (symbol)
@@ -1512,7 +1507,7 @@ namespace
15121507
{
15131508
// This is deferred pattern
15141509
std::string_view period = getSubstringFromString(str, strLength, strOffset,
1515-
fb_strlen_constexpr(FormatStr::AM), false);
1510+
fb_strlen(FormatStr::AM), false);
15161511
deferredTokens.push_back({*it, period});
15171512
break;
15181513
}

src/common/common.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
#define COMMON_COMMON_H
5252

5353
#include <string.h>
54+
#include <string>
5455

5556
#ifdef HAVE_STDLIB_H
5657
#include <stdlib.h>
@@ -1026,9 +1027,9 @@ inline const TEXT* const FB_LONG_DAYS_UPPER[] =
10261027

10271028
const FB_SIZE_T FB_MAX_SIZEOF = ~FB_SIZE_T(0); // Assume FB_SIZE_T is unsigned
10281029

1029-
inline FB_SIZE_T fb_strlen(const char* str)
1030+
inline constexpr FB_SIZE_T fb_strlen(const char* str)
10301031
{
1031-
return static_cast<FB_SIZE_T>(strlen(str));
1032+
return static_cast<FB_SIZE_T>(std::char_traits<char>::length(str));
10321033
}
10331034

10341035
namespace Firebird {

0 commit comments

Comments
 (0)