cleanup hostname list for filtering
[lttngtop.git] / src / lttngtop.c
index c31b9fd873644f8a3117ce5b001d3b4600a49c23..5cbdc0da6e015b4037d6308d379724368ec91d7e 100644 (file)
@@ -481,6 +481,7 @@ void init_lttngtop()
        copies = g_ptr_array_new();
        global_perf_liszt = g_hash_table_new(g_str_hash, g_str_equal);
        global_filter_list = g_hash_table_new(g_str_hash, g_str_equal);
+       global_host_list = g_hash_table_new(g_str_hash, g_str_equal);
 
        sem_init(&goodtodisplay, 0, 0);
        sem_init(&goodtoupdate, 0, 1);
@@ -633,14 +634,17 @@ static int parse_options(int argc, char **argv)
                                break;
                        case OPT_HOSTNAME:
                                toggle_filter = 1;
-                               hostname_filter_list = g_hash_table_new(g_str_hash,
-                                               g_str_equal);
                                tmp_str = strtok(opt_hostname, ",");
                                while (tmp_str) {
-                                       char *new_str = strdup(tmp_str);
-                                       g_hash_table_insert(hostname_filter_list,
-                                                       (gpointer) new_str,
-                                                       (gpointer) new_str);
+//                                     char *new_str = strdup(tmp_str);
+                                       struct host *host;
+
+                                       host = g_new0(struct host, 1);
+                                       host->hostname = strdup(tmp_str);
+                                       host->filter = 1;
+                                       g_hash_table_insert(global_host_list,
+                                                       (gpointer) host->hostname,
+                                                       (gpointer) host);
                                        tmp_str = strtok(NULL, ",");
                                }
                                break;
This page took 0.0221 seconds and 4 git commands to generate.