summaryrefslogtreecommitdiff
path: root/include/session.h
diff options
context:
space:
mode:
authorDaniel Wagner <daniel.wagner@bmw-carit.de>2013-07-22 16:21:09 +0200
committerDaniel Wagner <daniel.wagner@bmw-carit.de>2013-07-23 09:03:35 +0200
commit30773ab23a2d17e2e0a3550d60b20b5b833b2ed3 (patch)
tree61abb040cc7c1e69256751712bc8489ca942c7ed /include/session.h
parent8c2ca22ed91c34ea04e227be2c1ec1105b723198 (diff)
downloadconnman-30773ab23a2d17e2e0a3550d60b20b5b833b2ed3.tar.gz
include: 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 'include/session.h')
-rw-r--r--include/session.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/include/session.h b/include/session.h
index 0a979272..a99eb879 100644
--- a/include/session.h
+++ b/include/session.h
@@ -61,10 +61,10 @@ struct connman_session;
struct connman_session_config {
enum connman_session_id_type id_type;
char *id;
- connman_bool_t priority;
+ bool priority;
enum connman_session_roaming_policy roaming_policy;
enum connman_session_type type;
- connman_bool_t ecall;
+ bool ecall;
GSList *allowed_bearers;
};