summaryrefslogtreecommitdiffstats
path: root/src/cli/report.cpp
diff options
context:
space:
mode:
authorNikola Pajkovsky <npajkovs@redhat.com>2010-10-04 11:37:50 +0200
committerNikola Pajkovsky <npajkovs@redhat.com>2010-10-06 11:22:21 +0200
commit2a43414497aa857d9dbf3e2dc04ac207d5730335 (patch)
tree10e9af140ea4afd98808802b1dadb7578dc2e4ff /src/cli/report.cpp
parent43c4ec48451330d8290d28c6ad1d2793ac3207fa (diff)
downloadabrt-2a43414497aa857d9dbf3e2dc04ac207d5730335.tar.gz
abrt-2a43414497aa857d9dbf3e2dc04ac207d5730335.tar.xz
abrt-2a43414497aa857d9dbf3e2dc04ac207d5730335.zip
report.cpp: split() uses GList
Signed-off-by: Nikola Pajkovsky <npajkovs@redhat.com>
Diffstat (limited to 'src/cli/report.cpp')
-rw-r--r--src/cli/report.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/cli/report.cpp b/src/cli/report.cpp
index 8099a92e..cb6e2081 100644
--- a/src/cli/report.cpp
+++ b/src/cli/report.cpp
@@ -15,9 +15,8 @@
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#include <cassert>
-#include <algorithm>
#include <termios.h>
+#include <glib.h>
#include "report.h"
#include "run-command.h"
#include "dbus.h"
@@ -445,13 +444,13 @@ static void read_from_stdin(const char *question, char *result, int result_size)
* Specifies a set of characters that delimit the
* tokens in the parsed string
*/
-static vector_string_t split(const char *s, const char delim)
+static GList *split(const char *s, const char delim)
{
- std::vector<std::string> elems;
+ GList *elems = NULL;
while (1)
{
const char *end = strchrnul(s, delim);
- elems.push_back(std::string(s, end - s));
+ elems = g_list_append(elems, xstrndup(s, end - s));
if (*end == '\0')
break;
s = end + 1;
@@ -505,7 +504,7 @@ static vector_string_t get_enabled_reporters(map_crash_data_t &crash_data)
}
/* Reporters found, now parse the list. */
- vector_string_t reporter_vec = split(reporters_iter->second.c_str(), ',');
+ GList *reporter_list = split(reporters_iter->second.c_str(), ',');
// Get informations about all plugins.
map_map_string_t plugins = call_GetPluginsInfo();
@@ -520,10 +519,17 @@ static vector_string_t get_enabled_reporters(map_crash_data_t &crash_data)
if (0 != strcmp(it->second["Type"].c_str(), "Reporter"))
continue;
// Skip plugins not used in this particular crash.
- if (reporter_vec.end() == std::find(reporter_vec.begin(), reporter_vec.end(), std::string(it->first)))
- continue;
- result.push_back(it->first);
+ for (GList *li = reporter_list; li != NULL; li = g_list_next(li))
+ {
+ if (strcmp((char*)li->data, it->first.c_str()) == 0)
+ result.push_back(it->first);
+ }
}
+
+ for (GList *li = reporter_list; li != NULL; li = g_list_next(li))
+ free((char*)li->data);
+ g_list_free(reporter_list);
+
return result;
}