};
static struct watch *watches;
-WI_SCAN *wi_scans;
+WI_SCANS wi_scans;
static gboolean dhcpcd_try_open(gpointer data);
static gboolean dhcpcd_wpa_try_open(gpointer data);
WI_SCAN *w;
DHCPCD_WI_SCAN *dw;
- for (w = wi_scans; w; w = w->next) {
+ TAILQ_FOREACH(w, &wi_scans, next) {
for (dw = w->scans; dw; dw = dw->next)
if (dw == scan)
- break;
- if (dw)
- return w;
+ return w;
}
return NULL;
}
gtk_status_icon_set_from_icon_name(status_icon,
"network-offline");
gtk_status_icon_set_tooltip_text(status_icon, msg);
- dhcpcd_prefs_abort();
- dhcpcd_menu_abort();
- while (wi_scans) {
- w = wi_scans->next;
- dhcpcd_wi_scans_free(wi_scans->scans);
- g_free(wi_scans);
- wi_scans = w;
+ prefs_abort();
+ menu_abort();
+ wpa_abort();
+ while ((w = TAILQ_FIRST(&wi_scans))) {
+ TAILQ_REMOVE(&wi_scans, w, next);
+ dhcpcd_wi_scans_free(w->scans);
+ g_free(w);
}
dhcpcd_unwatch(-1, con);
g_timeout_add(DHCPCD_RETRYOPEN, dhcpcd_try_open, con);
if (scans == NULL && errno)
g_warning("%s: %s", i->ifname, strerror(errno));
errno = lerrno;
- for (w = wi_scans; w; w = w->next)
+ TAILQ_FOREACH(w, &wi_scans, next) {
if (w->interface == i)
break;
+ }
if (w == NULL) {
w = g_malloc(sizeof(*w));
w->interface = i;
- w->menu = NULL;
- w->next = wi_scans;
- wi_scans = w;
+ w->scans = scans;
+ w->ifmenu = NULL;
+ TAILQ_INIT(&w->menus);
+ TAILQ_INSERT_TAIL(&wi_scans, w, next);
} else {
txt = NULL;
msg = N_("New Access Point");
g_free(txt);
}
menu_update_scans(w, scans);
- dhcpcd_wi_scans_free(w->scans);
}
- w->scans = scans;
}
static void
notify_init(PACKAGE);
#endif
+ TAILQ_INIT(&wi_scans);
g_message(_("Connecting ..."));
con = dhcpcd_new();
if (con == NULL) {