On 09/24/2010 01:46 PM, Denys Vlasenko wrote:
On Thu, 2010-09-23 at 14:59 +0200, Nikola Pajkovsky wrote:
> I'd like to start with rewriting these structures.
>
> extern set_string_t g_settings_setOpenGPGPublicKeys;
> extern set_string_t g_settings_setBlackListedPkgs;
> extern set_string_t g_settings_setBlackListedPaths;
>
> I think that for set_string is enough to use GList
>
> Next two lines will be char*
> extern std::string g_settings_sDatabase;
> extern std::string g_settings_sWatchCrashdumpArchiveDir;
>
> and I'd like end up with one simple structure like that
>
> struct settings {
> GList *opengpg;
> GList *black_listed_pkgs;
> GList *black_listed_paths;
> ...
> ...
> };
>
> what do you think?
How do you see this structure to be used?
For example, currently we use settings like this:
if (g_settings_nMaxCrashReportsSize> 0)
{
char *worst_dir = NULL;
while (g_settings_nMaxCrashReportsSize> 0
&& get_dirsize_find_largest_dir(DEBUG_DUMPS_DIR,&worst_dir,
name) / (1024*1024)>= g_settings_nMaxCrashReportsSize
&& worst_dir
) {
...
}
}
How will it look after the switch to structure?
Something like if I use structure.
if (settings->nMaxCrashReportsSize> 0)
{ // ^^ needs better name
char *worst_dir = NULL;
while (settings->nMaxCrashReportsSize> 0
&& get_dirsize_find_largest_dir(DEBUG_DUMPS_DIR,&worst_dir,
name) / (1024*1024)>= settings->nMaxCrashReportsSize
&& worst_dir
) {
...
}
}
In a first patchset, it will stay as it is except some varialbles won't be
*set_string_t* but GList..
--
Nikola