Re: [PATCH BlueZ v4 2/3] service: Add callbacks to track state changes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Mikel,

On Fri, Apr 26, 2013, Mikel Astiz wrote:
> +static GSList *state_callbacks;

I know it's not strictly speaking necessary but the convention in the
source tree is to explicitly initialize this kind of variables to NULL.

> +gboolean btd_service_remove_state_cb(guint id)

Please use bool instead of gboolean (since we're trying to avoid GLib
types whenever possible).

> +	for (l = state_callbacks; l != NULL; l = g_slist_next(l)) {
> +		struct service_state_callback *cb = l->data;
> +
> +		if (cb && cb->id == id) {
> +			state_callbacks = g_slist_remove_link(state_callbacks,
> +									l);

This leaks l. It should be delete_link() instead of remove_link(),
however I don't see why you shouldn't just use g_slist_remove(list, cb);
since that'll even fit on a single line in this case.

Johan
--
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




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux