8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 14:43:03 +01:00

Change fb_strlen to constexpr version (#8267)

* Change fb_strlen to constexpr version

* Remove copy of constexpr fb_strlen

---------

Co-authored-by: Artyom Ivanov <artyom.ivanov@red-soft.ru>
This commit is contained in:
TreeHunter 2024-09-26 13:25:31 +03:00 committed by GitHub
parent b7383ee559
commit 7e2d0c0ad7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 8 deletions

View File

@ -228,11 +228,6 @@ namespace
return std::isalpha(static_cast<unsigned char>(symbol));
}
constexpr size_t fb_strlen_constexpr(const char* str)
{
return std::char_traits<char>::length(str);
}
constexpr bool isSeparator(char symbol)
{
switch (symbol)
@ -1512,7 +1507,7 @@ namespace
{
// This is deferred pattern
std::string_view period = getSubstringFromString(str, strLength, strOffset,
fb_strlen_constexpr(FormatStr::AM), false);
fb_strlen(FormatStr::AM), false);
deferredTokens.push_back({*it, period});
break;
}

View File

@ -51,6 +51,7 @@
#define COMMON_COMMON_H
#include <string.h>
#include <string>
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
@ -1026,9 +1027,9 @@ inline const TEXT* const FB_LONG_DAYS_UPPER[] =
const FB_SIZE_T FB_MAX_SIZEOF = ~FB_SIZE_T(0); // Assume FB_SIZE_T is unsigned
inline FB_SIZE_T fb_strlen(const char* str)
inline constexpr FB_SIZE_T fb_strlen(const char* str)
{
return static_cast<FB_SIZE_T>(strlen(str));
return static_cast<FB_SIZE_T>(std::char_traits<char>::length(str));
}
namespace Firebird {