1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2026-05-22 10:15:16 +02:00

Remove unused functions.

These functions were either added with the intention that they would be used or they became obsolete over time.
This commit is contained in:
David Steele
2022-12-30 16:26:48 +07:00
parent 6f0c652e2c
commit cebbf0d012
33 changed files with 14 additions and 384 deletions
-8
View File
@@ -76,14 +76,6 @@ cryptoInit(void)
FUNCTION_LOG_RETURN_VOID();
}
/**********************************************************************************************************************************/
bool
cryptoIsInit(void)
{
FUNCTION_TEST_VOID();
FUNCTION_TEST_RETURN(BOOL, cryptoInitDone);
}
/**********************************************************************************************************************************/
void
cryptoRandomBytes(unsigned char *buffer, size_t size)
-3
View File
@@ -40,9 +40,6 @@ Functions
// Initialize crypto
void cryptoInit(void);
// Has crypto been initialized?
bool cryptoIsInit(void);
// Throw crypto errors
void cryptoError(bool error, const char *description);
FN_NO_RETURN void cryptoErrorCode(unsigned long code, const char *description);
-5
View File
@@ -172,11 +172,6 @@ size_t typeToLog(const char *typeName, char *buffer, size_t bufferSize);
#define FUNCTION_LOG_SIZE_FORMAT(value, buffer, bufferSize) \
cvtSizeToZ(value, buffer, bufferSize)
#define FUNCTION_LOG_SSIZE_TYPE \
ssize_t
#define FUNCTION_LOG_SSIZE_FORMAT(value, buffer, bufferSize) \
cvtSSizeToZ(value, buffer, bufferSize)
#define FUNCTION_LOG_TIME_TYPE \
time_t
#define FUNCTION_LOG_TIME_FORMAT(value, buffer, bufferSize) \
-41
View File
@@ -89,23 +89,6 @@ iniGet(const Ini *this, const String *section, const String *key)
FUNCTION_TEST_RETURN_CONST(STRING, varStr(iniGetInternal(this, section, key, true)));
}
/**********************************************************************************************************************************/
const String *
iniGetDefault(const Ini *this, const String *section, const String *key, const String *defaultValue)
{
FUNCTION_TEST_BEGIN();
FUNCTION_TEST_PARAM(INI, this);
FUNCTION_TEST_PARAM(STRING, section);
FUNCTION_TEST_PARAM(STRING, key);
FUNCTION_TEST_PARAM(STRING, defaultValue);
FUNCTION_TEST_END();
// Get the value
const Variant *result = iniGetInternal(this, section, key, false);
FUNCTION_TEST_RETURN_CONST(STRING, result == NULL ? defaultValue : varStr(result));
}
/**********************************************************************************************************************************/
StringList *
iniGetList(const Ini *this, const String *section, const String *key)
@@ -171,30 +154,6 @@ iniSectionKeyList(const Ini *this, const String *section)
FUNCTION_TEST_RETURN(STRING_LIST, result);
}
/**********************************************************************************************************************************/
StringList *
iniSectionList(const Ini *this)
{
FUNCTION_TEST_BEGIN();
FUNCTION_TEST_PARAM(INI, this);
FUNCTION_TEST_END();
ASSERT(this != NULL);
StringList *result = NULL;
MEM_CONTEXT_TEMP_BEGIN()
{
// Get the sections from the keyList
result = strLstNewVarLst(kvKeyList(this->store));
strLstMove(result, memContextPrior());
}
MEM_CONTEXT_TEMP_END();
FUNCTION_TEST_RETURN(STRING_LIST, result);
}
/**********************************************************************************************************************************/
void
iniParse(Ini *this, const String *content)
-6
View File
@@ -42,9 +42,6 @@ Getters/Setters
// Get an ini value -- error if it does not exist
const String *iniGet(const Ini *this, const String *section, const String *key);
// Get an ini value -- if it does not exist then return specified default
const String *iniGetDefault(const Ini *this, const String *section, const String *key, const String *defaultValue);
// Ini key list
StringList *iniGetList(const Ini *this, const String *section, const String *key);
@@ -54,9 +51,6 @@ bool iniSectionKeyIsList(const Ini *this, const String *section, const String *k
// List of keys for a section
StringList *iniSectionKeyList(const Ini *this, const String *section);
// List of sections
StringList *iniSectionList(const Ini *this);
/***********************************************************************************************************************************
Destructor
***********************************************************************************************************************************/
-13
View File
@@ -509,19 +509,6 @@ memContextFromAllocExtra(void *const allocExtra)
FUNCTION_TEST_RETURN(MEM_CONTEXT, (MemContext *)allocExtra - 1);
}
const MemContext *
memContextConstFromAllocExtra(const void *const allocExtra)
{
FUNCTION_TEST_BEGIN();
FUNCTION_TEST_PARAM_P(VOID, allocExtra);
FUNCTION_TEST_END();
ASSERT(allocExtra != NULL);
ASSERT(((MemContext *)allocExtra - 1)->allocExtra != 0);
FUNCTION_TEST_RETURN(MEM_CONTEXT, (MemContext *)allocExtra - 1);
}
/**********************************************************************************************************************************/
void
memContextCallbackSet(MemContext *this, void (*callbackFunction)(void *), void *callbackArgument)
-1
View File
@@ -272,7 +272,6 @@ void *memContextAllocExtra(MemContext *this);
// Get mem context using pointer to the memory allocated with the mem context
MemContext *memContextFromAllocExtra(void *allocExtra);
const MemContext *memContextConstFromAllocExtra(const void *allocExtra);
// Current memory context
MemContext *memContextCurrent(void);
-19
View File
@@ -384,25 +384,6 @@ cvtSizeToZ(size_t value, char *buffer, size_t bufferSize)
FUNCTION_TEST_RETURN(SIZE, result);
}
size_t
cvtSSizeToZ(ssize_t value, char *buffer, size_t bufferSize)
{
FUNCTION_TEST_BEGIN();
FUNCTION_TEST_PARAM(SSIZE, value);
FUNCTION_TEST_PARAM_P(CHARDATA, buffer);
FUNCTION_TEST_PARAM(SIZE, bufferSize);
FUNCTION_TEST_END();
ASSERT(buffer != NULL);
size_t result = (size_t)snprintf(buffer, bufferSize, "%zd", value);
if (result >= bufferSize)
THROW(AssertError, "buffer overflow");
FUNCTION_TEST_RETURN(SIZE, result);
}
/**********************************************************************************************************************************/
size_t
cvtTimeToZ(time_t value, char *buffer, size_t bufferSize)
-1
View File
@@ -86,7 +86,6 @@ mode_t cvtZToMode(const char *value);
// Convert size/ssize to zero-terminated string
size_t cvtSizeToZ(size_t value, char *buffer, size_t bufferSize);
size_t cvtSSizeToZ(ssize_t value, char *buffer, size_t bufferSize);
// Convert time_t to zero-terminated string
size_t cvtTimeToZ(time_t value, char *buffer, size_t bufferSize);
+5 -41
View File
@@ -116,7 +116,9 @@ typedef enum
pckTypeMapI32 = 3, // Maps to pckTypeI32
pckTypeMapI64 = 4, // Maps to pckTypeI64
pckTypeMapObj = 5, // Maps to pckTypeObj
pckTypeMapPtr = 6, // Maps to pckTypePtr
// The empty position 6 can be used for a new type that will be encoded entirely in the tag
pckTypeMapStr = 7, // Maps to pckTypeStr
pckTypeMapU32 = 8, // Maps to pckTypeU32
pckTypeMapU64 = 9, // Maps to pckTypeU64
@@ -162,10 +164,8 @@ static const PackTypeMapData packTypeMapData[] =
{
.type = pckTypeObj,
},
{
.type = pckTypePtr,
.valueMultiBit = true,
},
// Placeholders for unused type that can be encoded entirely in the tag
{0},
{
.type = pckTypeStr,
.valueSingleBit = true,
@@ -1079,23 +1079,6 @@ pckReadPack(PackRead *const this, PckReadPackParam param)
FUNCTION_TEST_RETURN(PACK, (Pack *)result);
}
/**********************************************************************************************************************************/
void *
pckReadPtr(PackRead *this, PckReadPtrParam param)
{
FUNCTION_TEST_BEGIN();
FUNCTION_TEST_PARAM(PACK_READ, this);
FUNCTION_TEST_PARAM(UINT, param.id);
FUNCTION_TEST_END();
ASSERT(this != NULL);
if (pckReadNullInternal(this, &param.id))
FUNCTION_TEST_RETURN_P(VOID, NULL);
FUNCTION_TEST_RETURN_P(VOID, (void *)(uintptr_t)pckReadTag(this, &param.id, pckTypeMapPtr, false));
}
/**********************************************************************************************************************************/
String *
pckReadStr(PackRead *this, PckReadStrParam param)
@@ -1778,25 +1761,6 @@ pckWritePack(PackWrite *const this, const Pack *const value, const PckWritePackP
FUNCTION_TEST_RETURN(PACK_WRITE, this);
}
/**********************************************************************************************************************************/
PackWrite *
pckWritePtr(PackWrite *this, const void *value, PckWritePtrParam param)
{
FUNCTION_TEST_BEGIN();
FUNCTION_TEST_PARAM(PACK_WRITE, this);
FUNCTION_TEST_PARAM_P(VOID, value);
FUNCTION_TEST_PARAM(UINT, param.id);
FUNCTION_TEST_PARAM(BOOL, param.defaultWrite);
FUNCTION_TEST_END();
ASSERT(this != NULL);
if (!pckWriteDefaultNull(this, param.defaultWrite, value == NULL))
pckWriteTag(this, pckTypeMapPtr, param.id, (uintptr_t)value);
FUNCTION_TEST_RETURN(PACK_WRITE, this);
}
/**********************************************************************************************************************************/
PackWrite *
pckWriteStr(PackWrite *this, const String *value, PckWriteStrParam param)
-26
View File
@@ -123,7 +123,6 @@ typedef enum
pckTypeObj = STRID5("obj", 0x284f0),
pckTypeMode = STRID5("mode", 0x291ed0),
pckTypePack = STRID5("pack", 0x58c300),
pckTypePtr = STRID5("ptr", 0x4a900),
pckTypeStr = STRID5("str", 0x4a930),
pckTypeStrId = STRID5("strid", 0x44ca930),
pckTypeTime = STRID5("time", 0x2b5340),
@@ -325,18 +324,6 @@ PackRead *pckReadPackReadConst(PackRead *this, PckReadPackParam param);
Pack *pckReadPack(PackRead *this, PckReadPackParam param);
// Read pointer. Use with extreme caution. Pointers cannot be sent to another host -- they must only be used locally.
typedef struct PckReadPtrParam
{
VAR_PARAM_HEADER;
unsigned int id;
} PckReadPtrParam;
#define pckReadPtrP(this, ...) \
pckReadPtr(this, (PckReadPtrParam){VAR_PARAM_INIT, __VA_ARGS__})
void *pckReadPtr(PackRead *this, PckReadPtrParam param);
// Read string
typedef struct PckReadStrParam
{
@@ -564,19 +551,6 @@ typedef struct PckWritePackParam
PackWrite *pckWritePack(PackWrite *this, const Pack *value, PckWritePackParam param);
// Write pointer. Use with extreme caution. Pointers cannot be sent to another host -- they must only be used locally.
typedef struct PckWritePtrParam
{
VAR_PARAM_HEADER;
bool defaultWrite;
unsigned int id;
} PckWritePtrParam;
#define pckWritePtrP(this, value, ...) \
pckWritePtr(this, value, (PckWritePtrParam){VAR_PARAM_INIT, __VA_ARGS__})
PackWrite *pckWritePtr(PackWrite *this, const void *value, PckWritePtrParam param);
// Write string
typedef struct PckWriteStrParam
{
-29
View File
@@ -872,35 +872,6 @@ strZNull(const String *this)
FUNCTION_TEST_RETURN_CONST(STRINGZ, this == NULL ? NULL : strZ(this));
}
/**********************************************************************************************************************************/
String *
strQuote(const String *this, const String *quote)
{
FUNCTION_TEST_BEGIN();
FUNCTION_TEST_PARAM(STRING, this);
FUNCTION_TEST_PARAM(STRING, quote);
FUNCTION_TEST_END();
ASSERT(this != NULL);
ASSERT(quote != NULL);
FUNCTION_TEST_RETURN(STRING, strQuoteZ(this, strZ(quote)));
}
String *
strQuoteZ(const String *this, const char *quote)
{
FUNCTION_TEST_BEGIN();
FUNCTION_TEST_PARAM(STRING, this);
FUNCTION_TEST_PARAM(STRINGZ, quote);
FUNCTION_TEST_END();
ASSERT(this != NULL);
ASSERT(quote != NULL);
FUNCTION_TEST_RETURN(STRING, strNewFmt("%s%s%s", quote, strZ(this), quote));
}
/**********************************************************************************************************************************/
String *
strReplaceChr(String *this, char find, char replace)
-4
View File
@@ -177,10 +177,6 @@ String *strPath(const String *this);
// Combine with a base path to get an absolute path
String *strPathAbsolute(const String *this, const String *base);
// Quote a string
String *strQuote(const String *this, const String *quote);
String *strQuoteZ(const String *this, const char *quote);
// Replace a substring with another string
String *strReplace(String *this, const String *replace, const String *with);
-35
View File
@@ -263,41 +263,6 @@ xmlNodeChildN(const XmlNode *this, const String *name, unsigned int index, bool
FUNCTION_TEST_RETURN(XML_NODE, child);
}
/**********************************************************************************************************************************/
unsigned int
xmlNodeChildTotal(const XmlNode *this, const String *name)
{
FUNCTION_TEST_BEGIN();
FUNCTION_TEST_PARAM(XML_NODE, this);
FUNCTION_TEST_END();
ASSERT(this != NULL);
unsigned int result = 0;
for (xmlNodePtr currentNode = this->node->children; currentNode != NULL; currentNode = currentNode->next)
{
if (currentNode->type == XML_ELEMENT_NODE && strEqZ(name, (char *)currentNode->name))
result++;
}
FUNCTION_TEST_RETURN(UINT, result);
}
/**********************************************************************************************************************************/
void
xmlNodeFree(XmlNode *this)
{
FUNCTION_TEST_BEGIN();
FUNCTION_TEST_PARAM(XML_NODE, this);
FUNCTION_TEST_END();
if (this != NULL)
memFree(this);
FUNCTION_TEST_RETURN_VOID();
}
/***********************************************************************************************************************************
Free document
***********************************************************************************************************************************/
-8
View File
@@ -80,18 +80,10 @@ xmlNodeChild(const XmlNode *const this, const String *const name, const bool err
// List of child nodes
XmlNodeList *xmlNodeChildList(const XmlNode *this, const String *name);
// Node child total
unsigned int xmlNodeChildTotal(const XmlNode *this, const String *name);
// Node content
String *xmlNodeContent(const XmlNode *this);
void xmlNodeContentSet(XmlNode *this, const String *content);
/***********************************************************************************************************************************
Node Destructor
***********************************************************************************************************************************/
void xmlNodeFree(XmlNode *this);
/***********************************************************************************************************************************
Node List Getters
***********************************************************************************************************************************/
-35
View File
@@ -367,20 +367,6 @@ cfgOptionGroupIdxTotal(ConfigOptionGroup groupId)
FUNCTION_TEST_RETURN(UINT, configLocal->optionGroup[groupId].indexTotal);
}
/**********************************************************************************************************************************/
bool
cfgOptionGroupValid(ConfigOptionGroup groupId)
{
FUNCTION_TEST_BEGIN();
FUNCTION_TEST_PARAM(ENUM, groupId);
FUNCTION_TEST_END();
ASSERT(configLocal != NULL);
ASSERT(groupId < CFG_OPTION_GROUP_TOTAL);
FUNCTION_TEST_RETURN(BOOL, configLocal->optionGroup[groupId].valid);
}
/**********************************************************************************************************************************/
unsigned int
cfgOptionIdxDefault(ConfigOption optionId)
@@ -612,16 +598,6 @@ cfgOptionIdxName(ConfigOption optionId, unsigned int optionIdx)
}
/**********************************************************************************************************************************/
bool
cfgOptionNegate(ConfigOption optionId)
{
FUNCTION_TEST_BEGIN();
FUNCTION_TEST_PARAM(ENUM, optionId);
FUNCTION_TEST_END();
FUNCTION_TEST_RETURN(BOOL, cfgOptionIdxNegate(optionId, cfgOptionIdxDefault(optionId)));
}
bool
cfgOptionIdxNegate(ConfigOption optionId, unsigned int optionIdx)
{
@@ -639,17 +615,6 @@ cfgOptionIdxNegate(ConfigOption optionId, unsigned int optionIdx)
FUNCTION_TEST_RETURN(BOOL, configLocal->option[optionId].index[optionIdx].negate);
}
/**********************************************************************************************************************************/
bool
cfgOptionReset(ConfigOption optionId)
{
FUNCTION_TEST_BEGIN();
FUNCTION_TEST_PARAM(ENUM, optionId);
FUNCTION_TEST_END();
FUNCTION_TEST_RETURN(BOOL, cfgOptionIdxReset(optionId, cfgOptionIdxDefault(optionId)));
}
bool
cfgOptionIdxReset(ConfigOption optionId, unsigned int optionIdx)
{
-5
View File
@@ -94,9 +94,6 @@ unsigned int cfgOptionGroupIdxToKey(ConfigOptionGroup groupId, unsigned int grou
// configuration. e.g., if pg1-path and pg8-path are configured then this function will return 2.
unsigned int cfgOptionGroupIdxTotal(ConfigOptionGroup groupId);
// Are any options in the group valid for the command?
bool cfgOptionGroupValid(ConfigOptionGroup groupId);
/***********************************************************************************************************************************
Option Functions
@@ -253,11 +250,9 @@ const String *cfgExe(void);
void cfgOptionDefaultSet(ConfigOption optionId, const Variant *defaultValue);
// Was the option negated?
bool cfgOptionNegate(ConfigOption optionId);
bool cfgOptionIdxNegate(ConfigOption optionId, unsigned int optionIdx);
// Was the option reset?
bool cfgOptionReset(ConfigOption optionId);
bool cfgOptionIdxReset(ConfigOption optionId, unsigned int optionIdx);
// Set config option
-22
View File
@@ -2786,28 +2786,6 @@ manifestValidate(Manifest *this, bool strict)
FUNCTION_LOG_RETURN_VOID();
}
/***********************************************************************************************************************************
Db functions and getters/setters
***********************************************************************************************************************************/
const ManifestDb *
manifestDbFind(const Manifest *this, const String *name)
{
FUNCTION_TEST_BEGIN();
FUNCTION_TEST_PARAM(MANIFEST, this);
FUNCTION_TEST_PARAM(STRING, name);
FUNCTION_TEST_END();
ASSERT(this != NULL);
ASSERT(name != NULL);
const ManifestDb *result = lstFind(this->pub.dbList, &name);
if (result == NULL)
THROW_FMT(AssertError, "unable to find '%s' in manifest db list", strZ(name));
FUNCTION_TEST_RETURN_CONST(MANIFEST_DB, result);
}
/***********************************************************************************************************************************
File functions and getters/setters
***********************************************************************************************************************************/
-2
View File
@@ -261,8 +261,6 @@ manifestDb(const Manifest *const this, const unsigned int dbIdx)
return lstGet(THIS_PUB(Manifest)->dbList, dbIdx);
}
const ManifestDb *manifestDbFind(const Manifest *this, const String *name);
// If the database requested is not found in the list, return the default passed rather than throw an error
FN_INLINE_ALWAYS const ManifestDb *
manifestDbFindDefault(const Manifest *const this, const String *const name, const ManifestDb *const dbDefault)
-18
View File
@@ -407,24 +407,6 @@ pgLsnToWalSegment(uint32_t timeline, uint64_t lsn, unsigned int walSegmentSize)
STRING, strNewFmt("%08X%08X%08X", timeline, (unsigned int)(lsn >> 32), (unsigned int)(lsn & 0xFFFFFFFF) / walSegmentSize));
}
uint64_t
pgLsnFromWalSegment(const String *const walSegment, const unsigned int walSegmentSize)
{
FUNCTION_TEST_BEGIN();
FUNCTION_TEST_PARAM(STRING, walSegment);
FUNCTION_TEST_PARAM(UINT, walSegmentSize);
FUNCTION_TEST_END();
ASSERT(walSegment != NULL);
ASSERT(strSize(walSegment) == 24);
ASSERT(walSegmentSize > 0);
FUNCTION_TEST_RETURN(
UINT64,
(cvtZSubNToUInt64Base(strZ(walSegment), 8, 8, 16) << 32) +
(cvtZSubNToUInt64Base(strZ(walSegment), 16, 8, 16) * walSegmentSize));
}
/**********************************************************************************************************************************/
uint32_t
pgTimelineFromWalSegment(const String *const walSegment)
+1 -2
View File
@@ -150,9 +150,8 @@ String *pgTablespaceId(unsigned int pgVersion, unsigned int pgCatalogVersion);
uint64_t pgLsnFromStr(const String *lsn);
String *pgLsnToStr(uint64_t lsn);
// Convert a timeline and lsn to a wal segment and vice versa
// Convert a timeline and lsn to a wal segment
String *pgLsnToWalSegment(uint32_t timeline, uint64_t lsn, unsigned int walSegmentSize);
uint64_t pgLsnFromWalSegment(const String *walSegment, unsigned int walSegmentSize);
// Get timeline from WAL segment name
uint32_t pgTimelineFromWalSegment(const String *walSegment);
+1 -1
View File
@@ -143,7 +143,7 @@ unit:
# ----------------------------------------------------------------------------------------------------------------------------
- name: type-string
total: 27
total: 26
feature: string
coverage:
-4
View File
@@ -81,10 +81,6 @@ String *hrnPackReadToStr(PackRead *read)
break;
}
case pckTypePtr:
strCatFmt(result, "%p", pckReadPtrP(read, .id = id));
break;
case pckTypeStr:
strCatFmt(result, "%s", strZ(pckReadStrP(read, .id = id)));
break;
-2
View File
@@ -27,9 +27,7 @@ testRun(void)
// *****************************************************************************************************************************
if (testBegin("Common"))
{
TEST_RESULT_BOOL(cryptoIsInit(), false, "crypto is not initialized");
TEST_RESULT_VOID(cryptoInit(), "initialize crypto");
TEST_RESULT_BOOL(cryptoIsInit(), true, "crypto is initialized");
TEST_RESULT_VOID(cryptoInit(), "initialize crypto again");
// -------------------------------------------------------------------------------------------------------------------------
+1 -8
View File
@@ -133,7 +133,7 @@ testRun(void)
}
// *****************************************************************************************************************************
if (testBegin("iniSet(), iniGet(), iniGetDefault(), iniSectionList(), and iniSectionKeyList()"))
if (testBegin("iniSet(), iniGet(), and iniSectionKeyList()"))
{
Ini *ini = NULL;
@@ -154,17 +154,10 @@ testRun(void)
TEST_ERROR(iniGet(ini, STRDEF("section2"), STRDEF("key2")), FormatError, "section 'section2', key 'key2' does not exist");
TEST_RESULT_STR_Z(iniGetDefault(ini, STRDEF("section1"), STRDEF("key1"), NULL), "11", "get section, key, int");
TEST_RESULT_STR(iniGetDefault(ini, STRDEF("section2"), STRDEF("key2"), NULL), NULL, "get section, key, NULL");
TEST_RESULT_STR_Z(iniGetDefault(ini, STRDEF("section3"), STRDEF("key3"), STRDEF("true")), "true", "get section, key, bool");
TEST_RESULT_INT(strLstSize(iniSectionKeyList(ini, STRDEF("bogus"))), 0, "get keys for missing section");
TEST_RESULT_STRLST_Z(iniSectionKeyList(ini, STRDEF("section1")), "key1\nkey2\n", "get keys for section");
TEST_RESULT_VOID(iniSet(ini, STRDEF("section2"), STRDEF("key2"), STRDEF("2")), "set section2, key");
TEST_RESULT_INT(strLstSize(iniSectionList(ini)), 2, "number of sections");
TEST_RESULT_STRLST_Z(iniSectionList(ini), "section1\nsection2\n", "get sections");
TEST_RESULT_BOOL(iniSectionKeyIsList(ini, STRDEF("section1"), STRDEF("key1")), false, "single value is not list");
TEST_RESULT_VOID(iniSet(ini, STRDEF("section2"), STRDEF("key2"), STRDEF("7")), "set section2, key");
TEST_RESULT_BOOL(iniSectionKeyIsList(ini, STRDEF("section2"), STRDEF("key2")), true, "section2, key2 is a list");
-1
View File
@@ -120,7 +120,6 @@ testRun(void)
"test5", .allocExtra = 16, .childQty = MEM_CONTEXT_QTY_MAX, .allocQty = MEM_CONTEXT_QTY_MAX, .callbackQty = 1);
TEST_RESULT_PTR(memContextAllocExtra(memContext), memContext + 1, "mem context alloc extra");
TEST_RESULT_PTR(memContextFromAllocExtra(memContext + 1), memContext, "mem context from alloc extra");
TEST_RESULT_PTR(memContextConstFromAllocExtra(memContext + 1), memContext, "const mem context from alloc extra");
memContextKeep();
TEST_RESULT_INT(
memContextChildMany(memContextTop())->listSize, MEM_CONTEXT_INITIAL_SIZE * 2, "increased child context list size");
+1 -7
View File
@@ -116,7 +116,7 @@ testRun(void)
}
// *****************************************************************************************************************************
if (testBegin("cvtSizeToZ() and cvtSSizeToZ()"))
if (testBegin("cvtSizeToZ()"))
{
char buffer[STACK_TRACE_PARAM_MAX];
@@ -124,12 +124,6 @@ testRun(void)
TEST_RESULT_UINT(cvtSizeToZ(4294967295, buffer, STACK_TRACE_PARAM_MAX), 10, "convert size to string");
TEST_RESULT_Z(buffer, "4294967295", " check buffer");
// ------------------------------------------------------------------------------------------------------------------------
TEST_ERROR(cvtSSizeToZ(-9999, buffer, 4), AssertError, "buffer overflow");
TEST_RESULT_UINT(cvtSSizeToZ(-9999, buffer, STACK_TRACE_PARAM_MAX), 5, "convert ssize to string");
TEST_RESULT_Z(buffer, "-9999", " check buffer");
}
// *****************************************************************************************************************************
+2 -15
View File
@@ -332,30 +332,17 @@ testRun(void)
TEST_ASSIGN(packRead, pckReadNew(pckFromBuf(BUFSTRDEF("\255\255\255\255\255\255\255\255\255\255"))), "new read");
TEST_ERROR(pckReadU64Internal(packRead), FormatError, "unterminated varint-128 integer");
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("pack/unpack pointer");
TEST_ASSIGN(packWrite, pckWriteNewP(.size = 1), "new write");
TEST_RESULT_VOID(pckWritePtrP(packWrite, NULL), "write default pointer");
TEST_RESULT_VOID(pckWritePtrP(packWrite, "sample"), "write pointer");
TEST_RESULT_VOID(pckWriteEndP(packWrite), "write end");
TEST_ASSIGN(packRead, pckReadNew(pckDup(pckWriteResult(packWrite))), "new read");
TEST_RESULT_Z(pckReadPtrP(packRead), NULL, "read default pointer");
TEST_RESULT_Z(pckReadPtrP(packRead, .id = 2), "sample", "read pointer");
TEST_RESULT_PTR(pckWriteResult(NULL), NULL, "null pack result");
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("read const packs");
TEST_ASSIGN(packWrite, pckWriteNewP(), "new write");
TEST_ASSIGN(packWrite, pckWriteNewP(.size = 1), "new write");
// Write pack to read as ptr/size
packSub = pckWriteNewP();
pckWriteU64P(packSub, 777);
pckWriteEndP(packSub);
TEST_RESULT_PTR(pckWriteResult(NULL), NULL, "null pack result");
TEST_RESULT_VOID(pckWritePackP(packWrite, pckWriteResult(packSub)), "write pack");
// Write pack to read as const
-6
View File
@@ -247,12 +247,6 @@ testRun(void)
TEST_RESULT_STR_Z(strUpper(strNew()), "", "empty upper");
}
// *****************************************************************************************************************************
if (testBegin("strQuote()"))
{
TEST_RESULT_STR_Z(strQuote(STRDEF("abcd"), STRDEF("'")), "'abcd'", "quote string");
}
// *****************************************************************************************************************************
if (testBegin("strReplace() and strReplaceChr()"))
{
-4
View File
@@ -54,10 +54,6 @@ testRun(void)
TEST_RESULT_STR(xmlNodeContent(NULL), NULL, " get null content for null node");
TEST_RESULT_VOID(xmlNodeFree(nodeMaxKeys), "free node");
TEST_RESULT_VOID(xmlNodeFree(NULL), "free null node");
TEST_RESULT_UINT(xmlNodeChildTotal(rootNode, STRDEF("Contents")), 2, "Contents child total");
TEST_RESULT_STR_Z(
xmlNodeContent(xmlNodeChild(xmlNodeChildN(rootNode, STRDEF("Contents"), 0, true), STRDEF("Key"), true)),
"test1.txt", "Contents index 0 Key");
+2 -3
View File
@@ -1541,7 +1541,7 @@ testRun(void)
TEST_RESULT_BOOL(cfgOptionTest(cfgOptConfig), false, "config is not set");
TEST_RESULT_INT(cfgOptionSource(cfgOptConfig), cfgSourceParam, "config is source param");
TEST_RESULT_BOOL(cfgOptionNegate(cfgOptConfig), true, "config is negated");
TEST_RESULT_BOOL(cfgOptionIdxNegate(cfgOptConfig, 0), true, "config is negated");
TEST_RESULT_INT(cfgOptionSource(cfgOptStanza), cfgSourceParam, "stanza is source param");
TEST_RESULT_STR_Z(cfgOptionStr(cfgOptStanza), "db", "stanza is set");
TEST_RESULT_INT(cfgOptionSource(cfgOptStanza), cfgSourceParam, "stanza is source param");
@@ -1671,7 +1671,6 @@ testRun(void)
TEST_RESULT_Z(cfgOptionGroupName(cfgOptGrpPg, 0), "pg1", "pg1 group display (cached)");
TEST_RESULT_STR_Z(cfgOptionStr(cfgOptPgPath), "/path/to/db", "default pg-path");
TEST_RESULT_STR_Z(varStr(cfgOptionVar(cfgOptPgPath)), "/path/to/db", "default pg-path as variant");
TEST_RESULT_BOOL(cfgOptionGroupValid(cfgOptGrpPg), true, "pg group is valid");
TEST_RESULT_UINT(cfgOptionGroupIdxTotal(cfgOptGrpPg), 3, "pg1, pg2, and pg256 are set");
TEST_RESULT_BOOL(cfgOptionIdxBool(cfgOptPgLocal, 1), true, "pg2-local is set");
TEST_RESULT_BOOL(cfgOptionIdxTest(cfgOptPgHost, 1), false, "pg2-host is not set (pg2-local override)");
@@ -1706,7 +1705,7 @@ testRun(void)
TEST_RESULT_INT(cfgOptionSource(cfgOptCompressLevel), cfgSourceConfig, "compress-level is source config");
TEST_RESULT_BOOL(cfgOptionBool(cfgOptBackupStandby), false, "backup-standby not is set");
TEST_RESULT_INT(cfgOptionSource(cfgOptBackupStandby), cfgSourceDefault, "backup-standby is source default");
TEST_RESULT_BOOL(cfgOptionReset(cfgOptBackupStandby), true, "backup-standby was reset");
TEST_RESULT_BOOL(cfgOptionIdxReset(cfgOptBackupStandby, 0), true, "backup-standby was reset");
TEST_RESULT_BOOL(cfgOptionBool(cfgOptDelta), true, "delta is set");
TEST_RESULT_INT(cfgOptionSource(cfgOptDelta), cfgSourceConfig, "delta is source config");
TEST_RESULT_INT(cfgOptionInt64(cfgOptBufferSize), 65536, "buffer-size is set");
+1 -2
View File
@@ -1780,8 +1780,7 @@ testRun(void)
// ManifestDb getters
const ManifestDb *db = NULL;
TEST_ERROR(manifestDbFind(manifest, STRDEF("bogus")), AssertError, "unable to find 'bogus' in manifest db list");
TEST_ASSIGN(db, manifestDbFind(manifest, STRDEF("postgres")), "manifestDbFind()");
TEST_ASSIGN(db, manifestDbFindDefault(manifest, STRDEF("postgres"), NULL), "manifestDbFind()");
TEST_RESULT_STR_Z(db->name, "postgres", "check name");
TEST_RESULT_STR_Z(
manifestDbFindDefault(manifest, STRDEF("bogus"), db)->name, "postgres", "manifestDbFindDefault() - return default");
-7
View File
@@ -129,13 +129,6 @@ testRun(void)
TEST_RESULT_STR_Z(pgLsnToWalSegment(1, 0xFFFFFFFFAAAAAAAA, 0x40000000), "00000001FFFFFFFF00000002", "lsn to wal segment");
TEST_RESULT_STR_Z(pgLsnToWalSegment(1, 0xFFFFFFFF40000000, 0x40000000), "00000001FFFFFFFF00000001", "lsn to wal segment");
TEST_RESULT_UINT(
pgLsnFromWalSegment(STRDEF("00000001FFFFFFFF000000AA"), 0x1000000), 0xFFFFFFFFAA000000, "16M wal segment to lsn");
TEST_RESULT_UINT(
pgLsnFromWalSegment(STRDEF("00000001FFFFFFFF00000002"), 0x40000000), 0xFFFFFFFF80000000, "1G wal segment to lsn");
TEST_RESULT_UINT(
pgLsnFromWalSegment(STRDEF("00000001FFFFFFFF00000001"), 0x40000000), 0xFFFFFFFF40000000, "1G wal segment to lsn");
TEST_RESULT_UINT(pgTimelineFromWalSegment(STRDEF("00000001FFFFFFFF000000AA")), 1, "timeline 1");
TEST_RESULT_UINT(pgTimelineFromWalSegment(STRDEF("F000000FFFFFFFFF000000AA")), 0xF000000F, "timeline F000000F");