fix: add config item

This commit is contained in:
factosea 2024-02-27 21:11:31 +08:00 committed by facetosea
parent 71e4cb92fd
commit ec5b59c875
1 changed files with 9 additions and 9 deletions

View File

@ -442,15 +442,6 @@ int32_t cfgCheckRangeForDynUpdate(SConfig *pCfg, const char *name, const char *p
}
static int32_t cfgAddItem(SConfig *pCfg, SConfigItem *pItem, const char *name) {
int size = pCfg->array->size;
for (int32_t i = 0; i < size; ++i) {
SConfigItem *existItem = taosArrayGet(pCfg->array, i);
char xx[45];
if (existItem != NULL && strcmp(existItem->name, pItem->name) == 0) {
return 0;
}
}
pItem->stype = CFG_STYPE_DEFAULT;
pItem->name = taosStrdup(name);
if (pItem->name == NULL) {
@ -458,6 +449,15 @@ static int32_t cfgAddItem(SConfig *pCfg, SConfigItem *pItem, const char *name) {
return -1;
}
int size = pCfg->array->size;
for (int32_t i = 0; i < size; ++i) {
SConfigItem *existItem = taosArrayGet(pCfg->array, i);
if (existItem != NULL && strcmp(existItem->name, pItem->name) == 0) {
taosMemoryFree(pItem->name);
return 0;
}
}
int32_t len = strlen(name);
char lowcaseName[CFG_NAME_MAX_LEN + 1] = {0};
strntolower(lowcaseName, name, TMIN(CFG_NAME_MAX_LEN, len));