mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-22 17:23: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:
parent
b7383ee559
commit
7e2d0c0ad7
@ -228,11 +228,6 @@ namespace
|
|||||||
return std::isalpha(static_cast<unsigned char>(symbol));
|
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)
|
constexpr bool isSeparator(char symbol)
|
||||||
{
|
{
|
||||||
switch (symbol)
|
switch (symbol)
|
||||||
@ -1512,7 +1507,7 @@ namespace
|
|||||||
{
|
{
|
||||||
// This is deferred pattern
|
// This is deferred pattern
|
||||||
std::string_view period = getSubstringFromString(str, strLength, strOffset,
|
std::string_view period = getSubstringFromString(str, strLength, strOffset,
|
||||||
fb_strlen_constexpr(FormatStr::AM), false);
|
fb_strlen(FormatStr::AM), false);
|
||||||
deferredTokens.push_back({*it, period});
|
deferredTokens.push_back({*it, period});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,7 @@
|
|||||||
#define COMMON_COMMON_H
|
#define COMMON_COMMON_H
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#ifdef HAVE_STDLIB_H
|
#ifdef HAVE_STDLIB_H
|
||||||
#include <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
|
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 {
|
namespace Firebird {
|
||||||
|
Loading…
Reference in New Issue
Block a user