summaryrefslogtreecommitdiff
path: root/tools/iptables-unit.c
diff options
context:
space:
mode:
authorZhang zhengguang <zhengguang.zhang@intel.com>2014-07-17 02:37:39 (GMT)
committerZhang zhengguang <zhengguang.zhang@intel.com>2014-07-17 02:37:39 (GMT)
commit1b9d0a62f59bb48c8deb2f0b98d9acdffdd9abe7 (patch)
tree6e991827d28537f7f40f20786c2354fd04a9fdad /tools/iptables-unit.c
parentfbe905ab58ecc31fe64c410c5f580cadc30e7f04 (diff)
downloadconnman-upstream/1.24.zip
connman-upstream/1.24.tar.gz
connman-upstream/1.24.tar.bz2
Imported Upstream version 1.24upstream/1.24
Diffstat (limited to 'tools/iptables-unit.c')
-rw-r--r--tools/iptables-unit.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/tools/iptables-unit.c b/tools/iptables-unit.c
index 8ddd919..b9273ce 100644
--- a/tools/iptables-unit.c
+++ b/tools/iptables-unit.c
@@ -27,7 +27,7 @@
#include "../src/connman.h"
-static connman_bool_t assert_rule(const char *table_name, const char *rule)
+static bool assert_rule(const char *table_name, const char *rule)
{
char *cmd, *output, **lines;
GError **error = NULL;
@@ -40,17 +40,17 @@ static connman_bool_t assert_rule(const char *table_name, const char *rule)
lines = g_strsplit(output, "\n", 0);
g_free(output);
- for (i = 0; lines[i] != NULL; i++) {
+ for (i = 0; lines[i]; i++) {
DBG("lines[%02d]: %s\n", i, lines[i]);
if (g_strcmp0(lines[i], rule) == 0)
break;
}
g_strfreev(lines);
- if (lines[i] == NULL)
- return FALSE;
+ if (!lines[i])
+ return false;
- return TRUE;
+ return true;
}
static void assert_rule_exists(const char *table_name, const char *rule)
@@ -408,7 +408,7 @@ static void test_firewall_basic0(void)
int err;
ctx = __connman_firewall_create();
- g_assert(ctx != NULL);
+ g_assert(ctx);
err = __connman_firewall_add_rule(ctx, "filter", "INPUT",
"-m mark --mark 999 -j LOG");
@@ -437,7 +437,7 @@ static void test_firewall_basic1(void)
int err;
ctx = __connman_firewall_create();
- g_assert(ctx != NULL);
+ g_assert(ctx);
err = __connman_firewall_add_rule(ctx, "filter", "INPUT",
"-m mark --mark 999 -j LOG");
@@ -462,7 +462,7 @@ static void test_firewall_basic2(void)
int err;
ctx = __connman_firewall_create();
- g_assert(ctx != NULL);
+ g_assert(ctx);
err = __connman_firewall_add_rule(ctx, "mangle", "INPUT",
"-j CONNMARK --restore-mark");
@@ -483,7 +483,7 @@ static void test_firewall_basic2(void)
static gchar *option_debug = NULL;
-static gboolean parse_debug(const char *key, const char *value,
+static bool parse_debug(const char *key, const char *value,
gpointer user_data, GError **error)
{
if (value)
@@ -491,7 +491,7 @@ static gboolean parse_debug(const char *key, const char *value,
else
option_debug = g_strdup("*");
- return TRUE;
+ return true;
}
static GOptionEntry options[] = {
@@ -512,8 +512,8 @@ int main(int argc, char *argv[])
context = g_option_context_new(NULL);
g_option_context_add_main_entries(context, options, NULL);
- if (g_option_context_parse(context, &argc, &argv, &error) == FALSE) {
- if (error != NULL) {
+ if (!g_option_context_parse(context, &argc, &argv, &error)) {
+ if (error) {
g_printerr("%s\n", error->message);
g_error_free(error);
} else
@@ -523,7 +523,7 @@ int main(int argc, char *argv[])
g_option_context_free(context);
- __connman_log_init(argv[0], option_debug, FALSE, FALSE,
+ __connman_log_init(argv[0], option_debug, false, false,
"Unit Tests Connection Manager", VERSION);
__connman_iptables_init();