remove unclear function free_configmodule(), as we have end_configmodule() that do the same

This commit is contained in:
laurent
2022-08-18 09:47:44 +02:00
parent 983c956b77
commit 8b159d6ddc
3 changed files with 0 additions and 34 deletions
-5
View File
@@ -17,11 +17,6 @@ void end_configmodule(void)
* Possibly calls the `config_<config source>_end` function
This call should be used when all configurations have been read. The program will still be able to use parameter values allocated by the config module WHEN THE `PARAMFLAG_NOFREE` flag has been specified in the parameter definition. The config module can be reloaded later in the program (not fully tested as not used today)
```c
void free_configmodule(void)
```
This call should be used to definitely free all resources allocated by the config module. All parameters values allocated by the config module become unavailable and no further reload of the config module are allowed.
## Retrieving parameter's values
```c
-28
View File
@@ -352,34 +352,6 @@ void end_configmodule(void) {
}
}
/* free all memory used by config module */
/* should be called only at program exit */
void free_configmodule(void) {
if (cfgptr != NULL) {
end_configmodule();
if( cfgptr->cfgmode != NULL) free(cfgptr->cfgmode);
int n=0;
for(int i=0; i<cfgptr->numptrs ; i++) {
if (cfgptr->ptrs[i] != NULL) {
free(cfgptr->ptrs[i]);
cfgptr->ptrs[i]=NULL;
cfgptr->ptrsAllocated[i] = false;
n++;
}
}
printf ("[CONFIG] %u/%u persistent config value pointers have been released\n",n,cfgptr->numptrs);
cfgptr->numptrs=0;
printf ("[CONFIG] free %i config module parameter pointers\n",cfgptr->num_cfgP);
for (int i=0; i<cfgptr->num_cfgP; i++) {
if ( cfgptr->cfgP[i] != NULL) free(cfgptr->cfgP[i]);
}
free(cfgptr->argv_info);
free(cfgptr);
cfgptr=NULL;
}
}
-1
View File
@@ -665,7 +665,6 @@ int main(int argc, char **argv)
logInit();
loader_reset();
logTerm();
free_configmodule();
return (n_errors);
}