Revert "jira: Fix several performance issues relating to GSList usage"

This reverts commit c7809f7844.
g_slist_reverse seems to have introduced a segfault, so for now we'll go
with reduced performance while it's resolved..

This relates to issue #17
This commit is contained in:
Ikey Doherty
2015-09-12 11:44:05 +01:00
parent 9d77b3bc63
commit 2c44d1d899
+4 -10
View File
@@ -624,7 +624,7 @@ static bool parse_jira_cfg_field(const gchar *key, const gchar *value)
jira_cfg_field->value = g_strdup(value);
g_hash_table_insert(g_jira_cfg->template,jira_cfg_field->name, g_strdup(value));
}
g_jira_cfg->fields = g_slist_prepend(g_jira_cfg->fields, jira_cfg_field);
g_jira_cfg->fields = g_slist_append(g_jira_cfg->fields, jira_cfg_field);
g_strfreev(tokens);
return true;
}
@@ -700,9 +700,6 @@ static bool parse_jira_cfg_file(GKeyFile *config, const gchar *path)
}
++key;
}
if (g_jira_cfg->fields) {
g_jira_cfg->fields = g_slist_reverse(g_jira_cfg->fields);
}
g_strfreev(keys);
group = "JIRA-Search-Issues";
if (!parse_jira_cfg_str(path, key_file, group,"jql",&g_jira_cfg->jql, false, NULL)) {
@@ -760,7 +757,6 @@ bool parse_jira_issues(const gchar *jira_issues_json, GSList **jira_issues)
JsonNode *node, *key, *summary, *description, *status, *resolution = NULL;
JsonObject *object, *field, *record = NULL;
JsonArray *records = NULL;
GSList *issues = NULL;
if (!is_initialized()) {
return false;
@@ -812,15 +808,13 @@ bool parse_jira_issues(const gchar *jira_issues_json, GSList **jira_issues)
resolution = json_object_get_member(field,"name");
jira_issue->resolution = g_strdup(json_node_get_string(resolution));
}
issues = g_slist_prepend(issues, jira_issue);
*jira_issues = g_slist_append(*jira_issues, jira_issue);
}
}
if (!g_slist_length(issues)) {
fprintf(stderr, "Error: No matching JIRA issues found with filter: %s\n", g_jira_cfg->search_filter);
if (!g_slist_length(*jira_issues)) {
fprintf(stderr, "Error: No matching JIRA issues found with filter: %s\n",g_jira_cfg->search_filter);
return false;
}
*jira_issues = g_slist_reverse(issues);
return true;
}