version 1.19.10.1, 2024/10/29 00:55:44
|
version 1.21, 2025/10/09 16:43:05
|
Line 190 cfg_getSection(cfg_root_t * __restrict cfg, const char
|
Line 190 cfg_getSection(cfg_root_t * __restrict cfg, const char
|
} |
} |
|
|
/* |
/* |
|
* cfg_delSection() - Delete entire section |
|
* |
|
* @cfg = Config root |
|
* @csSec = Config section //[{csSec}] |
|
* return: -1 error, 0 nothing deleted or >0 deleted attributes |
|
*/ |
|
int |
|
cfg_delSection(cfg_root_t * __restrict cfg, const char *csSec) |
|
{ |
|
int ret = 0; |
|
array_t *arr = NULL; |
|
struct tagCfg *av; |
|
register int i; |
|
|
|
if (!cfg) { |
|
cfg_SetErr(EINVAL, "Invalid argument(s)"); |
|
return -1; |
|
} |
|
if (csSec && !*csSec) |
|
csSec = NULL; |
|
|
|
arr = cfg_getSection(cfg, csSec); |
|
if (!arr) |
|
return ret; |
|
for (i = 0; i < array_Size(arr); i++) |
|
if ((av = array(arr, i, struct tagCfg*)) && AIT_ADDR(&av->cfg_attr)) |
|
if (cfg_unsetAttribute(cfg, csSec, AIT_GET_STR(&av->cfg_attr)) > 0) |
|
ret++; |
|
array_Destroy(&arr); |
|
return ret; |
|
} |
|
|
|
/* |
* cfg_findAttribute() - Find attribute position in config file |
* cfg_findAttribute() - Find attribute position in config file |
* |
* |
* @cfg = Config root |
* @cfg = Config root |