pgbackrest.git / summary / log / commit / refs
commit cebbf0d012ad7204c4770efa3308daddc267415f
Author: David Steele <david@pgmasters.net>
Date: Fri Dec 30 09:26:48 2022 +0000
Remove unused functions.
These functions were either added with the intention that they would be used or they became obsolete over time.
src/common/crypto/common.c | 8 ------
src/common/crypto/common.h | 3 ---
src/common/debug.h | 5 ----
src/common/ini.c | 41 ----------------------------
src/common/ini.h | 6 -----
src/common/memContext.c | 13 ---------
src/common/memContext.h | 1 -
src/common/type/convert.c | 19 -------------
src/common/type/convert.h | 1 -
src/common/type/pack.c | 46 ++++----------------------------
src/common/type/pack.h | 26 ------------------
src/common/type/string.c | 29 --------------------
src/common/type/string.h | 4 ---
src/common/type/xml.c | 35 ------------------------
src/common/type/xml.h | 8 ------
src/config/config.c | 35 ------------------------
src/config/config.h | 5 ----
src/info/manifest.c | 22 ---------------
src/info/manifest.h | 2 --
src/postgres/interface.c | 18 -------------
src/postgres/interface.h | 3 +--
test/define.yaml | 2 +-
test/src/common/harnessPack.c | 4 ---
test/src/module/common/cryptoTest.c | 2 --
test/src/module/common/iniTest.c | 9 +------
test/src/module/common/memContextTest.c | 1 -
test/src/module/common/typeConvertTest.c | 8 +-----
test/src/module/common/typePackTest.c | 17 ++----------
test/src/module/common/typeStringTest.c | 6 -----
test/src/module/common/typeXmlTest.c | 4 ---
test/src/module/config/parseTest.c | 5 ++--
test/src/module/info/manifestTest.c | 3 +--
test/src/module/postgres/interfaceTest.c | 7 -----
33 files changed, 14 insertions(+), 384 deletions(-)
diff --git a/src/common/crypto/common.c b/src/common/crypto/common.c
index 026f6afe1..70bcd564a 100644
--- a/src/common/crypto/common.c
+++ b/src/common/crypto/common.c
@@ -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)
diff --git a/src/common/crypto/common.h b/src/common/crypto/common.h
index c95772f5b..3d02c67ef 100644
--- a/src/common/crypto/common.h
+++ b/src/common/crypto/common.h
@@ -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);
diff --git a/src/common/debug.h b/src/common/debug.h
index 3819b1f96..96989a22f 100644
--- a/src/common/debug.h
+++ b/src/common/debug.h
@@ -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) \
diff --git a/src/common/ini.c b/src/common/ini.c
index c2171929c..90ecebe83 100644
--- a/src/common/ini.c
+++ b/src/common/ini.c
@@ -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)
diff --git a/src/common/ini.h b/src/common/ini.h
index 9cd56b886..b5def53d9 100644
--- a/src/common/ini.h
+++ b/src/common/ini.h
@@ -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
***********************************************************************************************************************************/
diff --git a/src/common/memContext.c b/src/common/memContext.c
index a9244e3ed..68a04b399 100644
--- a/src/common/memContext.c
+++ b/src/common/memContext.c
@@ -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)
diff --git a/src/common/memContext.h b/src/common/memContext.h
index aedecb826..c1316c235 100644
--- a/src/common/memContext.h
+++ b/src/common/memContext.h
@@ -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);
diff --git a/src/common/type/convert.c b/src/common/type/convert.c
index 3e5015718..0893f707b 100644
--- a/src/common/type/convert.c
+++ b/src/common/type/convert.c
@@ -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)
diff --git a/src/common/type/convert.h b/src/common/type/convert.h
index 4d371ad09..09edffdb9 100644
--- a/src/common/type/convert.h
+++ b/src/common/type/convert.h
@@ -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);
diff --git a/src/common/type/pack.c b/src/common/type/pack.c
index fd6df3d07..9384448f4 100644
--- a/src/common/type/pack.c
+++ b/src/common/type/pack.c
@@ -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, ¶m.id))
- FUNCTION_TEST_RETURN_P(VOID, NULL);
-
- FUNCTION_TEST_RETURN_P(VOID, (void *)(uintptr_t)pckReadTag(this, ¶m.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)
diff --git a/src/common/type/pack.h b/src/common/type/pack.h
index 01c1edfaa..b88dced21 100644
--- a/src/common/type/pack.h
+++ b/src/common/type/pack.h
@@ -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
{
diff --git a/src/common/type/string.c b/src/common/type/string.c
index c3f60707b..7344dda66 100644
--- a/src/common/type/string.c
+++ b/src/common/type/string.c
@@ -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)
diff --git a/src/common/type/string.h b/src/common/type/string.h
index 58c3972b9..a4cf79892 100644
--- a/src/common/type/string.h
+++ b/src/common/type/string.h
@@ -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);
diff --git a/src/common/type/xml.c b/src/common/type/xml.c
index 5be2c3a37..e651eca32 100644
--- a/src/common/type/xml.c
+++ b/src/common/type/xml.c
@@ -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
***********************************************************************************************************************************/
diff --git a/src/common/type/xml.h b/src/common/type/xml.h
index 15dc875bd..a20628eb9 100644
--- a/src/common/type/xml.h
+++ b/src/common/type/xml.h
@@ -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
***********************************************************************************************************************************/
diff --git a/src/config/config.c b/src/config/config.c
index 6e41d365f..c05310c7a 100644
--- a/src/config/config.c
+++ b/src/config/config.c
@@ -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)
{
diff --git a/src/config/config.h b/src/config/config.h
index 2ab2a25a9..35fe108b2 100644
--- a/src/config/config.h
+++ b/src/config/config.h
@@ -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
diff --git a/src/info/manifest.c b/src/info/manifest.c
index 0bf6148d7..a5751040d 100644
--- a/src/info/manifest.c
+++ b/src/info/manifest.c
@@ -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
***********************************************************************************************************************************/
diff --git a/src/info/manifest.h b/src/info/manifest.h
index 2173ccb09..c0febb54e 100644
--- a/src/info/manifest.h
+++ b/src/info/manifest.h
@@ -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)
diff --git a/src/postgres/interface.c b/src/postgres/interface.c
index 09efaf78b..06ba5ebb8 100644
--- a/src/postgres/interface.c
+++ b/src/postgres/interface.c
@@ -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)
diff --git a/src/postgres/interface.h b/src/postgres/interface.h
index a2371fd2e..998bdb096 100644
--- a/src/postgres/interface.h
+++ b/src/postgres/interface.h
@@ -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);
diff --git a/test/define.yaml b/test/define.yaml
index a70e63c44..bad91d58b 100644
--- a/test/define.yaml
+++ b/test/define.yaml
@@ -143,7 +143,7 @@ unit:
# ----------------------------------------------------------------------------------------------------------------------------
- name: type-string
- total: 27
+ total: 26
feature: string
coverage:
diff --git a/test/src/common/harnessPack.c b/test/src/common/harnessPack.c
index 368435d46..c42a6abca 100644
--- a/test/src/common/harnessPack.c
+++ b/test/src/common/harnessPack.c
@@ -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;
diff --git a/test/src/module/common/cryptoTest.c b/test/src/module/common/cryptoTest.c
index 599f53ca6..95704e2d2 100644
--- a/test/src/module/common/cryptoTest.c
+++ b/test/src/module/common/cryptoTest.c
@@ -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");
// -------------------------------------------------------------------------------------------------------------------------
diff --git a/test/src/module/common/iniTest.c b/test/src/module/common/iniTest.c
index 035949ccc..70f35235e 100644
--- a/test/src/module/common/iniTest.c
+++ b/test/src/module/common/iniTest.c
@@ -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");
diff --git a/test/src/module/common/memContextTest.c b/test/src/module/common/memContextTest.c
index ec0fb5918..f0a1e1bae 100644
--- a/test/src/module/common/memContextTest.c
+++ b/test/src/module/common/memContextTest.c
@@ -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");
diff --git a/test/src/module/common/typeConvertTest.c b/test/src/module/common/typeConvertTest.c
index 9e3531a74..45863b411 100644
--- a/test/src/module/common/typeConvertTest.c
+++ b/test/src/module/common/typeConvertTest.c
@@ -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");
}
// *****************************************************************************************************************************
diff --git a/test/src/module/common/typePackTest.c b/test/src/module/common/typePackTest.c
index e77c652ac..dc7ea7648 100644
--- a/test/src/module/common/typePackTest.c
+++ b/test/src/module/common/typePackTest.c
@@ -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
diff --git a/test/src/module/common/typeStringTest.c b/test/src/module/common/typeStringTest.c
index 8115932e3..70de97ff5 100644
--- a/test/src/module/common/typeStringTest.c
+++ b/test/src/module/common/typeStringTest.c
@@ -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()"))
{
diff --git a/test/src/module/common/typeXmlTest.c b/test/src/module/common/typeXmlTest.c
index 670e7a4d3..f8f583b37 100644
--- a/test/src/module/common/typeXmlTest.c
+++ b/test/src/module/common/typeXmlTest.c
@@ -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");
diff --git a/test/src/module/config/parseTest.c b/test/src/module/config/parseTest.c
index 8c35526b8..bce95e2db 100644
--- a/test/src/module/config/parseTest.c
+++ b/test/src/module/config/parseTest.c
@@ -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");
diff --git a/test/src/module/info/manifestTest.c b/test/src/module/info/manifestTest.c
index 6b3ea9435..909d9b695 100644
--- a/test/src/module/info/manifestTest.c
+++ b/test/src/module/info/manifestTest.c
@@ -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");
diff --git a/test/src/module/postgres/interfaceTest.c b/test/src/module/postgres/interfaceTest.c
index 40e6d0740..db9d42d83 100644
--- a/test/src/module/postgres/interfaceTest.c
+++ b/test/src/module/postgres/interfaceTest.c
@@ -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");
[parent: 6f0c652e2c50]