1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-11-06 08:49:29 +02:00

Inline strSize().

Inlining strPtr() in fbff2995 does not seem to have caused any problems so do the same with strSize().
This commit is contained in:
David Steele
2020-07-10 08:00:18 -04:00
parent d5df3974b5
commit f1edf0ad10
2 changed files with 6 additions and 14 deletions

View File

@@ -801,19 +801,6 @@ strSubN(const String *this, size_t start, size_t size)
FUNCTION_TEST_RETURN(strNewN(this->buffer + start, size));
}
/**********************************************************************************************************************************/
size_t
strSize(const String *this)
{
FUNCTION_TEST_BEGIN();
FUNCTION_TEST_PARAM(STRING, this);
FUNCTION_TEST_END();
ASSERT(this != NULL);
FUNCTION_TEST_RETURN(this->size);
}
/**********************************************************************************************************************************/
String *
strTrim(String *this)

View File

@@ -152,7 +152,12 @@ String *strQuoteZ(const String *this, const char *quote);
String *strReplaceChr(String *this, char find, char replace);
// String size minus null-terminator, i.e. the same value that strlen() would return
size_t strSize(const String *this);
__attribute__((always_inline)) static inline size_t
strSize(const String *this)
{
ASSERT_INLINE(this != NULL);
return ((const StringConst *)this)->size;
}
// Format sizes (file, buffer, etc.) in human-readable form
String *strSizeFormat(const uint64_t fileSize);