Skip to content

Commit

Permalink
shared/util: Move cb_data_new() helpers to util header
Browse files Browse the repository at this point in the history
The helper doesn't really belong to the session.h and ELL also does
define the helper in util.h header.
  • Loading branch information
Daniel Wagner committed Jul 2, 2013
1 parent f3775eb commit a727163
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 17 deletions.
17 changes: 0 additions & 17 deletions include/session.h
Expand Up @@ -56,23 +56,6 @@ enum connman_session_id_type {
CONNMAN_SESSION_ID_TYPE_LSM = 3,
};

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;
}

struct connman_session;

struct connman_session_config {
Expand Down
2 changes: 2 additions & 0 deletions plugins/session_policy_local.c
Expand Up @@ -42,6 +42,8 @@
#include <connman/dbus.h>
#include <connman/inotify.h>

#include "src/shared/util.h"

#define POLICYDIR STORAGEDIR "/session_policy_local"

#define MODE (S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | \
Expand Down
1 change: 1 addition & 0 deletions src/iptables.c
Expand Up @@ -35,6 +35,7 @@
#include <linux/netfilter_ipv4/ip_tables.h>

#include "connman.h"
#include "src/shared/util.h"

/*
* Some comments on how the iptables API works (some of them from the
Expand Down
1 change: 1 addition & 0 deletions src/nfacct.c
Expand Up @@ -28,6 +28,7 @@

#include "connman.h"
#include "src/shared/nfacct.h"
#include "src/shared/util.h"

static struct nfacct_info *nfacct;

Expand Down
19 changes: 19 additions & 0 deletions src/shared/util.h
Expand Up @@ -21,6 +21,8 @@
*
*/

#include <glib.h>

typedef void (*util_debug_func_t)(const char *str, void *user_data);

void util_debug(util_debug_func_t function, void *user_data,
Expand All @@ -29,3 +31,20 @@ void util_debug(util_debug_func_t function, void *user_data,

void util_hexdump(const char dir, const unsigned char *buf, size_t len,
util_debug_func_t function, void *user_data);

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;
}

0 comments on commit a727163

Please sign in to comment.