Skip to content

Commit

Permalink
refactorize: reflect recent changes in map_string_t
Browse files Browse the repository at this point in the history
Related to abrt/libreport#147

Signed-off-by: Jakub Filak <jfilak@redhat.com>
Signed-off-by: Martin Milata <mmilata@redhat.com>

Conflicts:

	src/daemon/abrt-action-save-package-data.c
	src/lib/abrt_conf.c
	src/plugins/abrt-action-analyze-xorg.c
  • Loading branch information
Jakub Filak committed May 7, 2014
1 parent b141809 commit 4d753e8
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 36 deletions.
30 changes: 15 additions & 15 deletions src/daemon/abrt-action-save-package-data.c
Expand Up @@ -56,43 +56,43 @@ static GList *parse_list(const char* list)
return l;
}

static void ParseCommon(map_string_h *settings, const char *conf_filename)
static void ParseCommon(map_string_t *settings, const char *conf_filename)
{
char *value;
const char *value;

value = g_hash_table_lookup(settings, "OpenGPGCheck");
value = get_map_string_item_or_NULL(settings, "OpenGPGCheck");
if (value)
{
settings_bOpenGPGCheck = string_to_bool(value);
g_hash_table_remove(settings, "OpenGPGCheck");
remove_map_string_item(settings, "OpenGPGCheck");
}

value = g_hash_table_lookup(settings, "BlackList");
value = get_map_string_item_or_NULL(settings, "BlackList");
if (value)
{
settings_setBlackListedPkgs = parse_list(value);
g_hash_table_remove(settings, "BlackList");
remove_map_string_item(settings, "BlackList");
}

value = g_hash_table_lookup(settings, "BlackListedPaths");
value = get_map_string_item_or_NULL(settings, "BlackListedPaths");
if (value)
{
settings_setBlackListedPaths = parse_list(value);
g_hash_table_remove(settings, "BlackListedPaths");
remove_map_string_item(settings, "BlackListedPaths");
}

value = g_hash_table_lookup(settings, "ProcessUnpackaged");
value = get_map_string_item_or_NULL(settings, "ProcessUnpackaged");
if (value)
{
settings_bProcessUnpackaged = string_to_bool(value);
g_hash_table_remove(settings, "ProcessUnpackaged");
remove_map_string_item(settings, "ProcessUnpackaged");
}

GHashTableIter iter;
char *name;
map_string_iter_t iter;
const char *name;
/*char *value; - already declared */
g_hash_table_iter_init(&iter, settings);
while (g_hash_table_iter_next(&iter, (void**)&name, (void**)&value))
init_map_string_iter(&iter, settings);
while (next_map_string_iter(&iter, &name, &value))
{
error_msg("Unrecognized variable '%s' in '%s'", name, conf_filename);
}
Expand Down Expand Up @@ -120,7 +120,7 @@ static void load_gpg_keys(void)

static int load_conf(const char *conf_filename)
{
map_string_h *settings = new_map_string();
map_string_t *settings = new_map_string();
if (!load_conf_file(conf_filename, settings, /*skip key w/o values:*/ false))
error_msg("Can't open '%s'", conf_filename);

Expand Down
10 changes: 5 additions & 5 deletions src/hooks/abrt-hook-ccpp.c
Expand Up @@ -500,14 +500,14 @@ int main(int argc, char** argv)
bool setting_MakeCompatCore;
bool setting_SaveBinaryImage;
{
map_string_h *settings = new_map_string();
map_string_t *settings = new_map_string();
load_conf_file(PLUGINS_CONF_DIR"/CCpp.conf", settings, /*skip key w/o values:*/ false);
char *value;
value = g_hash_table_lookup(settings, "MakeCompatCore");
const char *value;
value = get_map_string_item_or_NULL(settings, "MakeCompatCore");
setting_MakeCompatCore = value && string_to_bool(value);
value = g_hash_table_lookup(settings, "SaveBinaryImage");
value = get_map_string_item_or_NULL(settings, "SaveBinaryImage");
setting_SaveBinaryImage = value && string_to_bool(value);
value = g_hash_table_lookup(settings, "VerboseLog");
value = get_map_string_item_or_NULL(settings, "VerboseLog");
if (value)
g_verbose = xatoi_positive(value);
free_map_string(settings);
Expand Down
28 changes: 14 additions & 14 deletions src/lib/abrt_conf.c
Expand Up @@ -32,18 +32,18 @@ void free_abrt_conf_data()
g_settings_dump_location = NULL;
}

static void ParseCommon(map_string_h *settings, const char *conf_filename)
static void ParseCommon(map_string_t *settings, const char *conf_filename)
{
char *value;
const char *value;

value = g_hash_table_lookup(settings, "WatchCrashdumpArchiveDir");
value = get_map_string_item_or_NULL(settings, "WatchCrashdumpArchiveDir");
if (value)
{
g_settings_sWatchCrashdumpArchiveDir = xstrdup(value);
g_hash_table_remove(settings, "WatchCrashdumpArchiveDir");
remove_map_string_item(settings, "WatchCrashdumpArchiveDir");
}

value = g_hash_table_lookup(settings, "MaxCrashReportsSize");
value = get_map_string_item_or_NULL(settings, "MaxCrashReportsSize");
if (value)
{
char *end;
Expand All @@ -53,30 +53,30 @@ static void ParseCommon(map_string_h *settings, const char *conf_filename)
error_msg("Error parsing %s setting: '%s'", "MaxCrashReportsSize", value);
else
g_settings_nMaxCrashReportsSize = ul;
g_hash_table_remove(settings, "MaxCrashReportsSize");
remove_map_string_item(settings, "MaxCrashReportsSize");
}

value = g_hash_table_lookup(settings, "DumpLocation");
value = get_map_string_item_or_NULL(settings, "DumpLocation");
if (value)
{
g_settings_dump_location = xstrdup(value);
g_hash_table_remove(settings, "DumpLocation");
remove_map_string_item(settings, "DumpLocation");
}
else
g_settings_dump_location = xstrdup("/var/spool/abrt");

value = g_hash_table_lookup(settings, "DeleteUploaded");
value = get_map_string_item_or_NULL(settings, "DeleteUploaded");
if (value)
{
g_settings_delete_uploaded = string_to_bool(value);
g_hash_table_remove(settings, "DeleteUploaded");
remove_map_string_item(settings, "DeleteUploaded");
}

GHashTableIter iter;
char *name;
const char *name;
/*char *value; - already declared */
g_hash_table_iter_init(&iter, settings);
while (g_hash_table_iter_next(&iter, (void**)&name, (void**)&value))
init_map_string_iter(&iter, settings);
while (next_map_string_iter(&iter, &name, &value))
{
error_msg("Unrecognized variable '%s' in '%s'", name, conf_filename);
}
Expand All @@ -86,7 +86,7 @@ int load_abrt_conf()
{
free_abrt_conf_data();

map_string_h *settings = new_map_string();
map_string_t *settings = new_map_string();
if (!load_conf_file(CONF_DIR"/abrt.conf", settings, /*skip key w/o values:*/ false))
perror_msg("Can't open '%s'", CONF_DIR"/abrt.conf");

Expand Down
4 changes: 2 additions & 2 deletions src/plugins/abrt-action-generate-backtrace.c
Expand Up @@ -60,11 +60,11 @@ int main(int argc, char **argv)

export_abrt_envvars(0);

map_string_h *settings = new_map_string();
map_string_t *settings = new_map_string();
if (!load_conf_file(PLUGINS_CONF_DIR"/CCpp.conf", settings, /*skip key w/o values:*/ false))
error_msg("Can't open '%s'", PLUGINS_CONF_DIR"/CCpp.conf");

char *value = g_hash_table_lookup(settings, "DebuginfoLocation");
const char *value = get_map_string_item_or_NULL(settings, "DebuginfoLocation");
char *debuginfo_location;
if (value)
debuginfo_location = xstrdup(value);
Expand Down

0 comments on commit 4d753e8

Please sign in to comment.