summaryrefslogtreecommitdiff
path: root/vpn/vpn-agent.h
diff options
context:
space:
mode:
authorDaniel Wagner <daniel.wagner@bmw-carit.de>2013-07-22 16:22:53 +0200
committerDaniel Wagner <daniel.wagner@bmw-carit.de>2013-07-23 09:03:36 +0200
commitb89fa6d12ca7fd9b1fba558df8ef9f19d3d8eecf (patch)
treeb612a841f61476b5649e5d62f6c1bd3f76f441c4 /vpn/vpn-agent.h
parent0f3df75e22eeb8d2dd34aa3a45b442d2e05bfc2b (diff)
downloadconnman-b89fa6d12ca7fd9b1fba558df8ef9f19d3d8eecf.tar.gz
vpn: Convert to stdbool with coccinelle
This patch is completely generated by set of coccille rules and containts zero manual changes. The rule set is not really beautiful but it does the job. We might miss a few conversions but there should be none accidently wrong converted bool here. The rules are as following: //// Do not compare boolean expressions @@ expression E; symbol TRUE; symbol FALSE; @@ ( E - == TRUE | - TRUE == E + E | - E != TRUE + !E | - TRUE != E + !E | - E == FALSE + !E | - FALSE == E + !E | E - != FALSE | - FALSE != E + E ) //// Convert connman_bool_t to stdbool @@ connman_bool_t x; @@ x = ( - TRUE + true | - FALSE + false ) @@ identifier f; @@ connman_bool_t f(...) { <... - return TRUE; + return true; ...> } @@ identifier f; @@ connman_bool_t f(...) { <... - return FALSE; + return false; ...> } @r@ identifier f; parameter list[n] ps; identifier i; @@ f(ps, connman_bool_t i, ...) { ... } @@ identifier r.f; expression list [r.n] es; @@ f(es, ( - FALSE + false | - TRUE + true ) ,...) @r2@ type T; identifier f; parameter list[n] ps; identifier i; @@ T f(ps, connman_bool_t i, ...); @@ identifier r2.f; expression list [r.n] es; @@ f(es, ( - FALSE + false | - TRUE + true ) ,...) @@ typedef bool; @@ - connman_bool_t + bool //// Convert gboolean to stdbool @@ gboolean x; @@ x = ( - TRUE + true | - FALSE + false ) // Figure out which function signature will to be fixed... // when we have the defitition @r@ identifier f; parameter list[n] ps; identifier i; @@ f(ps, gboolean i, ...) { ... } // ... and now convert all call sites @@ identifier r.f; expression list [r.n] es; @@ f(es, ( - FALSE + false | - TRUE + true ) ,...) // Figure out which function signature will to be fixed... // when we have the declaration only @r2@ type T; identifier f; parameter list[n] ps; identifier i; @@ T f(ps, gboolean i, ...); // ... and now convert all call sites @@ identifier r2.f; expression list [r.n] es; @@ f(es, ( - FALSE + false | - TRUE + true ) ,...) // A handfull of the GLib hooks we can't change. Let's remember // all ther positions. // 1. timeouts @k1@ identifier f; position p; typedef gpointer; identifier ptr; @@ static gboolean@p f(gpointer ptr); @k2@ identifier f; position p; identifier ptr; @@ static gboolean@p f(gpointer ptr) { ... } // hash map iterator functions @k3@ identifier f; position p; identifier p1, p2, p3; @@ static gboolean@p f(gpointer p1, gpointer p2, gpointer p3) { ... } // 2. GIOChannel @k4@ identifier f; position p; typedef GIOChannel, GIOCondition; identifier ptr; identifier ch, cn; @@ static gboolean@p f(GIOChannel *ch, GIOCondition cn, gpointer ptr); @k5@ identifier f; position p; identifier ptr; identifier ch, cn; @@ static gboolean@p f(GIOChannel *ch, GIOCondition cn, gpointer ptr) { ... } // 3. GSourceFuncs @k6@ identifier f; position p; typedef GSource; identifier src; @@ static gboolean@p f(GSource *src, ...) { ... } // gdbus functions @k7@ identifier f; position p; typedef DBusConnection; identifier con; @@ static gboolean@p f(DBusConnection *con, ...) { ... } // Now convert all gboolean which are are not used for interactin // with GLib // Note here happens the magic! @@ typedef bool; position p != {k1.p,k2.p,k3.p,k4.p,k5.p,k6.p,k7.p}; @@ - gboolean@p + bool // Update all return types @@ identifier f; @@ bool f(...) { <... - return TRUE; + return true; ...> } @@ identifier f; @@ bool f(...) { <... - return FALSE; + return false; ...> } //// Last last rule is to fixup all missed call sites. In theory we should //// fixed them with some rules above but somehow coccinelle does not //// match. @@ identifier f =~ "^(__)?connman_.*" ; @@ f(..., ( - FALSE + false | - TRUE + true ) ,...)
Diffstat (limited to 'vpn/vpn-agent.h')
-rw-r--r--vpn/vpn-agent.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/vpn/vpn-agent.h b/vpn/vpn-agent.h
index 821d7596..c7328d7f 100644
--- a/vpn/vpn-agent.h
+++ b/vpn/vpn-agent.h
@@ -34,7 +34,7 @@ extern "C" {
void vpn_agent_append_host_and_name(DBusMessageIter *iter,
struct vpn_provider *provider);
-connman_bool_t vpn_agent_check_reply_has_dict(DBusMessage *reply);
+bool vpn_agent_check_reply_has_dict(DBusMessage *reply);
void vpn_agent_append_user_info(DBusMessageIter *iter,
struct vpn_provider *provider,
const char *username_str);