On Fri, Sep 7, 2012 at 6:59 AM, Johan Hedberg <johan.hedberg@xxxxxxxxx> wrote: > Hi, > > On Tue, Sep 04, 2012, João Paulo Rechi Vita wrote: >> +static void set_auto_connect(gpointer data, gpointer user_data) >> +{ >> + struct btd_device *device = data; >> + gboolean enable = GPOINTER_TO_INT(user_data); >> + >> + device_set_auto_connect(device, enable); >> +} >> + >> static void call_adapter_powered_callbacks(struct btd_adapter *adapter, >> gboolean powered) >> { >> @@ -2125,7 +2133,10 @@ static void call_adapter_powered_callbacks(struct btd_adapter *adapter, >> btd_adapter_powered_cb cb = l->data; >> >> cb(adapter, powered); >> - } >> + } >> + >> + g_slist_foreach(adapter->devices, set_auto_connect, >> + GINT_TO_POINTER(powered)); > > Instead of this GINT_TO_POINTER magic on a variable that isn't even a > gint couldn't you just pass &powered to g_slist_foreach and then in the > callback do: > > gboolean enable = *(gboolean *) user_data; > > or > > gboolean *enable = user_data; > > device_set_auto_connect(device, *enable); > I'm sending an updated version now. -- João Paulo Rechi Vita Openbossa Labs - INdT -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html