remove unclear function free_configmodule(), as we have end_configmodule() that do the same
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -665,7 +665,6 @@ int main(int argc, char **argv)
|
||||
logInit();
|
||||
loader_reset();
|
||||
logTerm();
|
||||
free_configmodule();
|
||||
|
||||
return (n_errors);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user