Have a routine that iterates over the remote host list if it exists.
Remove the routine to get the remote host list; all accesses should be
through functions in ui/remote.c.
Change-Id: Idddceba76b50ce85ef8557e132d7552191c2fddc
Reviewed-on: https://code.wireshark.org/review/20217
Reviewed-by: Guy Harris <guy@alum.mit.edu>
iftype_cbx = gtk_combo_box_text_new_with_entry();
- ht = get_remote_host_list();
- if (g_hash_table_size (ht) > 0) {
+ if (recent_get_remote_host_list_size() > 0) {
/* Add remote hosts */
- g_hash_table_foreach (ht, iftype_combo_box_add_remote_host, iftype_cbx);
+ remote_host_list_foreach (iftype_combo_box_add_remote_host, iftype_cbx);
iftype_combo_box_add_remote_separators (iftype_cbx);
}
void RemoteCaptureDialog::fillComboBox()
{
- GHashTable *ht = get_remote_host_list();
+ int remote_host_list_size;
+
ui->hostCombo->addItem(QString(""));
- if (recent_get_remote_host_list_size() > 0) {
- g_hash_table_foreach(ht, fillBox, ui->hostCombo);
- ui->hostCombo->insertSeparator(g_hash_table_size(ht)+1);
+ remote_host_list_size = recent_get_remote_host_list_size();
+ if (remote_host_list_size > 0) {
+ remote_host_list_foreach(fillBox, ui->hostCombo);
+ ui->hostCombo->insertSeparator(remote_host_list_size+1);
ui->hostCombo->addItem(QString(tr("Clear list")));
}
}
return TRUE;
}
-GHashTable *get_remote_host_list(void)
+void
+remote_host_list_foreach(GHFunc func, gpointer user_data)
{
- return remote_host_list;
+ if (remote_host_list != NULL)
+ g_hash_table_foreach(remote_host_list, func, user_data);
}
static void
extern int recent_get_remote_host_list_size(void);
/**
- * Get the pointer of the remote_host_list.
+ * Iterate over all items in the remote_host_list, calling a
+ * function for each member
*
- * @return Pointer to the hash table
+ * @param func Function to be called
+ * @param user_data Argument to pass as user data to the function
*/
-extern GHashTable *get_remote_host_list(void);
+extern void remote_host_list_foreach(GHFunc func, gpointer user_data);
/**
* Free all entries of the remote_host_list.