1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-01 00:25:06 +02:00

Add STR() macro to create constant String objects from runtime strings.

The STRING_CONST() macro worked fine for constants but was not able to constify strings created at runtime.

Add the STR() macro to do this by using strlen() to get the size.

Also rename STRING_CONST() to STRDEF() for brevity and to match the other macro name.
This commit is contained in:
David Steele
2019-04-16 13:39:58 -04:00
parent a029eba8d5
commit 2dac4b5986
27 changed files with 156 additions and 142 deletions

View File

@ -506,7 +506,7 @@ pgVersionFromStr(const String *version)
MEM_CONTEXT_TEMP_BEGIN()
{
// If format is not number.number (9.4) or number only (10) then error
if (!regExpMatchOne(STRING_CONST("^[0-9]+[.]*[0-9]+$"), version))
if (!regExpMatchOne(STRDEF("^[0-9]+[.]*[0-9]+$"), version))
THROW_FMT(AssertError, "version %s format is invalid", strPtr(version));
// If there is a dot set the major and minor versions, else just the major