From 8b159d6ddce4d4c59adf7ea4c55de10d60c21df4 Mon Sep 17 00:00:00 2001 From: laurent <laurent Thomas> Date: Thu, 18 Aug 2022 09:47:44 +0200 Subject: [PATCH] remove unclear function free_configmodule(), as we have end_configmodule() that do the same --- common/config/DOC/config/devusage/api.md | 5 ----- common/config/config_load_configmodule.c | 28 ------------------------ openair1/SIMULATION/NR_PHY/dlschsim.c | 1 - 3 files changed, 34 deletions(-) diff --git a/common/config/DOC/config/devusage/api.md b/common/config/DOC/config/devusage/api.md index 170e9b61f86..5bac70bcd10 100644 --- a/common/config/DOC/config/devusage/api.md +++ b/common/config/DOC/config/devusage/api.md @@ -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 diff --git a/common/config/config_load_configmodule.c b/common/config/config_load_configmodule.c index 922126b6887..3fedf3f0f9a 100644 --- a/common/config/config_load_configmodule.c +++ b/common/config/config_load_configmodule.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; - } -} diff --git a/openair1/SIMULATION/NR_PHY/dlschsim.c b/openair1/SIMULATION/NR_PHY/dlschsim.c index 9632c482086..21dadc12914 100644 --- a/openair1/SIMULATION/NR_PHY/dlschsim.c +++ b/openair1/SIMULATION/NR_PHY/dlschsim.c @@ -665,7 +665,6 @@ int main(int argc, char **argv) logInit(); loader_reset(); logTerm(); - free_configmodule(); return (n_errors); } -- GitLab