Hi,
On Fri, 2013-03-15 at 13:50 +0100, Daniel Wagner wrote:
> From: Daniel Wagner <[email protected]>
>
> There is a common pattern when writing a callback function. Let's
> add a few helper for this.
>
> This is shamelessly stolen from oFono.
> ---
> include/types.h | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/include/types.h b/include/types.h
> index 0f671ec..051151a 100644
> --- a/include/types.h
> +++ b/include/types.h
Not in here, the contents of this file are to be cleaned up as specified
in the TODO file. Use src/connman.h instead?
> @@ -22,6 +22,8 @@
> #ifndef __CONNMAN_TYPES_H
> #define __CONNMAN_TYPES_H
>
> +#include <glib.h>
> +
> #ifdef __cplusplus
> extern "C" {
> #endif
> @@ -38,6 +40,23 @@ typedef int connman_bool_t;
> typedef unsigned char connman_uint8_t;
> typedef unsigned short connman_uint16_t;
>
> +struct cb_data {
> + void *cb;
> + void *user_data;
> + void *data;
> +};
> +
> +static inline struct cb_data *cb_data_new(void *cb, void *user_data)
> +{
> + struct cb_data *ret;
> +
> + ret = g_new0(struct cb_data, 1);
> + ret->cb = cb;
> + ret->user_data = user_data;
> +
> + return ret;
> +}
> +
> #ifdef __cplusplus
> }
> #endif
Cheers,
Patrik
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman