From: Patrick McHardy <kaber@trash.net>
To: jamal <hadi@cyberus.ca>
Cc: Maillist netdev <netdev@oss.sgi.com>
Subject: [PATCH PKT_SCHED 2/17]: Consistent comparision style in act_api.c
Date: Thu, 30 Dec 2004 04:39:21 +0100 [thread overview]
Message-ID: <41D37869.5040204@trash.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 112 bytes --]
Use consistent and more eye-friendly comparision style
in act_api.c: if (x != NULL) instead of if (NULL != x).
[-- Attachment #2: 02.diff --]
[-- Type: text/x-patch, Size: 8080 bytes --]
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/12/30 00:52:10+01:00 kaber@coreworks.de
# [PKT_SCHED]: Consistent comparision style in act_api.c
#
# Signed-off-by: Patrick McHardy <kaber@trash.net>
#
# net/sched/act_api.c
# 2004/12/30 00:52:03+01:00 kaber@coreworks.de +37 -40
# [PKT_SCHED]: Consistent comparision style in act_api.c
#
# Signed-off-by: Patrick McHardy <kaber@trash.net>
#
diff -Nru a/net/sched/act_api.c b/net/sched/act_api.c
--- a/net/sched/act_api.c 2004-12-30 04:01:01 +01:00
+++ b/net/sched/act_api.c 2004-12-30 04:01:01 +01:00
@@ -200,7 +200,7 @@
DPRINTK("tcf_action_destroy destroying %p next %p\n",
a, a->next ? a->next : NULL);
act = act->next;
- if (ACT_P_DELETED == a->ops->cleanup(a, bind))
+ if (a->ops->cleanup(a, bind) == ACT_P_DELETED)
module_put(a->ops->owner);
a->ops = NULL;
@@ -223,7 +223,7 @@
{
int err = -EINVAL;
- if ((NULL == a) || (NULL == a->ops) || (NULL == a->ops->dump))
+ if ((a == NULL) || (a->ops == NULL) || (a->ops->dump == NULL))
return err;
return a->ops->dump(skb, a, bind, ref);
}
@@ -235,8 +235,8 @@
unsigned char *b = skb->tail;
struct rtattr *r;
- if ((NULL == a) || (NULL == a->ops) || (NULL == a->ops->dump) ||
- (NULL == a->ops->kind))
+ if ((a == NULL) || (a->ops == NULL) || (a->ops->dump == NULL) ||
+ (a->ops->kind == NULL))
return err;
RTA_PUT(skb, TCA_KIND, IFNAMSIZ, a->ops->kind);
@@ -267,7 +267,7 @@
act = a->next;
RTA_PUT(skb, a->order, 0, NULL);
err = tcf_action_dump_1(skb, a, bind, ref);
- if (0 > err)
+ if (err < 0)
goto rtattr_failure;
r->rta_len = skb->tail - (u8*)r;
}
@@ -290,12 +290,12 @@
*err = -EINVAL;
- if (NULL == name) {
+ if (name == NULL) {
if (rtattr_parse(tb, TCA_ACT_MAX, RTA_DATA(rta),
RTA_PAYLOAD(rta)) < 0)
goto err_out;
kind = tb[TCA_ACT_KIND-1];
- if (NULL != kind) {
+ if (kind != NULL) {
sprintf(act_name, "%s", (char*)RTA_DATA(kind));
if (RTA_PAYLOAD(kind) >= IFNAMSIZ) {
printk("Action %s bad\n", (char*)RTA_DATA(kind));
@@ -312,14 +312,14 @@
a_o = tc_lookup_action_n(name);
}
#ifdef CONFIG_KMOD
- if (NULL == a_o) {
+ if (a_o == NULL) {
DPRINTK("tcf_action_init_1: trying to load module %s\n", act_name);
request_module(act_name);
a_o = tc_lookup_action_n(act_name);
}
#endif
- if (NULL == a_o) {
+ if (a_o == NULL) {
printk("failed to find %s\n", act_name);
goto err_out;
}
@@ -332,7 +332,7 @@
memset(a, 0, sizeof(*a));
/* backward compatibility for policer */
- if (NULL == name) {
+ if (name == NULL) {
*err = a_o->init(tb[TCA_ACT_OPTIONS-1], est, a, ovr, bind);
if (*err < 0) {
*err = -EINVAL;
@@ -414,7 +414,7 @@
/* place holder */
#endif
- if (NULL == h)
+ if (h == NULL)
goto errout;
if (a->type == TCA_OLD_COMPAT)
@@ -427,7 +427,7 @@
if (err < 0)
goto errout;
- if (NULL != a->ops && NULL != a->ops->get_stats)
+ if (a->ops != NULL && a->ops->get_stats != NULL)
if (a->ops->get_stats(skb, a) < 0)
goto errout;
@@ -464,7 +464,7 @@
x = (struct rtattr*) skb->tail;
RTA_PUT(skb, TCA_ACT_TAB, 0, NULL);
- if (0 > tcf_action_dump(skb, a, bind, ref))
+ if (tcf_action_dump(skb, a, bind, ref) < 0)
goto rtattr_failure;
x->rta_len = skb->tail - (u8*)x;
@@ -510,7 +510,7 @@
if (rtattr_parse(tb, TCA_ACT_MAX, RTA_DATA(rta), RTA_PAYLOAD(rta))<0)
goto err_out;
kind = tb[TCA_ACT_KIND-1];
- if (NULL != kind) {
+ if (kind != NULL) {
sprintf(act_name, "%s", (char*)RTA_DATA(kind));
if (RTA_PAYLOAD(kind) >= IFNAMSIZ) {
printk("tcf_action_get_1: action %s bad\n",
@@ -531,21 +531,21 @@
a_o = tc_lookup_action(kind);
#ifdef CONFIG_KMOD
- if (NULL == a_o) {
+ if (a_o == NULL) {
request_module (act_name);
a_o = tc_lookup_action_n(act_name);
}
#endif
- if (NULL == a_o) {
+ if (a_o == NULL) {
printk("failed to find %s\n", act_name);
goto err_out;
}
- if (NULL == a)
+ if (a == NULL)
goto err_mod;
a->ops = a_o;
- if (NULL == a_o->lookup || 0 == a_o->lookup(a, index)) {
+ if (a_o->lookup == NULL || a_o->lookup(a, index) == 0) {
a->ops = NULL;
err = -EINVAL;
goto err_mod;
@@ -579,7 +579,7 @@
char act_name[4 + IFNAMSIZ + 1];
struct tc_action_ops *a_o = NULL;
- if (NULL != kind) {
+ if (kind != NULL) {
sprintf(act_name, "%s", (char*)RTA_DATA(kind));
if (RTA_PAYLOAD(kind) >= IFNAMSIZ) {
printk("get_ao: action %s bad\n",
@@ -593,14 +593,13 @@
a_o = tc_lookup_action(kind);
#ifdef CONFIG_KMOD
- if (NULL == a_o) {
+ if (a_o == NULL) {
DPRINTK("get_ao: trying to load module %s\n", act_name);
request_module(act_name);
a_o = tc_lookup_action_n(act_name);
}
#endif
-
- if (NULL == a_o) {
+ if (a_o == NULL) {
printk("get_ao: failed to find %s\n", act_name);
return NULL;
}
@@ -614,7 +613,7 @@
struct tc_action *act = NULL;
act = kmalloc(sizeof(*act), GFP_KERNEL);
- if (NULL == act) { /* grrr .. */
+ if (act == NULL) {
printk("create_a: failed to alloc!\n");
return NULL;
}
@@ -636,7 +635,7 @@
struct tc_action *a = create_a(0);
int err = -EINVAL;
- if (NULL == a) {
+ if (a == NULL) {
printk("tca_action_flush: couldnt create tc_action\n");
return err;
}
@@ -654,7 +653,7 @@
goto err_out;
kind = tb[TCA_ACT_KIND-1];
- if (NULL == get_ao(kind, a))
+ if (get_ao(kind, a) == NULL)
goto err_out;
nlh = NLMSG_PUT(skb, pid, n->nlmsg_seq, RTM_DELACTION, sizeof(*t));
@@ -665,7 +664,7 @@
RTA_PUT(skb, TCA_ACT_TAB, 0, NULL);
err = a->ops->walk(skb, &dcb, RTM_DELACTION, a);
- if (0 > err)
+ if (err < 0)
goto rtattr_failure;
x->rta_len = skb->tail - (u8 *) x;
@@ -680,7 +679,6 @@
return err;
-
rtattr_failure:
module_put(a->ops->owner);
nlmsg_failure:
@@ -709,15 +707,15 @@
}
if (event == RTM_DELACTION && n->nlmsg_flags&NLM_F_ROOT) {
- if (NULL != tb[0] && NULL == tb[1])
+ if (tb[0] != NULL && tb[1] == NULL)
return tca_action_flush(tb[0], n, pid);
}
for (i=0; i < TCA_ACT_MAX_PRIO; i++) {
- if (NULL == tb[i])
+ if (tb[i] == NULL)
break;
act = create_a(i+1);
- if (NULL != a && a != act) {
+ if (a != NULL && a != act) {
a->next = act;
a = act;
} else
@@ -736,7 +734,7 @@
}
}
- if (RTM_GETACTION == event)
+ if (event == RTM_GETACTION)
ret = act_get_notify(pid, n, a_s, event);
else { /* delete */
struct sk_buff *skb;
@@ -791,7 +789,7 @@
x = (struct rtattr*) skb->tail;
RTA_PUT(skb, TCA_ACT_TAB, 0, NULL);
- if (0 > tcf_action_dump(skb, a, 0, 0))
+ if (tcf_action_dump(skb, a, 0, 0) < 0)
goto rtattr_failure;
x->rta_len = skb->tail - (u8*)x;
@@ -847,7 +845,7 @@
u32 pid = skb ? NETLINK_CB(skb).pid : 0;
int ret = 0, ovr = 0;
- if (NULL == tca[TCA_ACT_TAB-1]) {
+ if (tca[TCA_ACT_TAB-1] == NULL) {
printk("tc_ctl_action: received NO action attribs\n");
return -EINVAL;
}
@@ -894,14 +892,13 @@
if (rtattr_parse(rta, TCAA_MAX, attr, attrlen) < 0)
return NULL;
tb1 = rta[TCA_ACT_TAB - 1];
- if (NULL == tb1) {
+ if (tb1 == NULL)
return NULL;
- }
if (rtattr_parse(tb, TCA_ACT_MAX_PRIO, RTA_DATA(tb1),
NLMSG_ALIGN(RTA_PAYLOAD(tb1))) < 0)
return NULL;
- if (NULL == tb[0])
+ if (tb[0] == NULL)
return NULL;
if (rtattr_parse(tb2, TCA_ACT_MAX, RTA_DATA(tb[0]),
@@ -924,13 +921,13 @@
struct tcamsg *t = (struct tcamsg *) NLMSG_DATA(cb->nlh);
char *kind = find_dump_kind(cb->nlh);
- if (NULL == kind) {
+ if (kind == NULL) {
printk("tc_dump_action: action bad kind\n");
return 0;
}
a_o = tc_lookup_action_n(kind);
- if (NULL == a_o) {
+ if (a_o == NULL) {
printk("failed to find %s\n", kind);
return 0;
}
@@ -938,7 +935,7 @@
memset(&a, 0, sizeof(struct tc_action));
a.ops = a_o;
- if (NULL == a_o->walk) {
+ if (a_o->walk == NULL) {
printk("tc_dump_action: %s !capable of dumping table\n", kind);
goto rtattr_failure;
}
@@ -952,7 +949,7 @@
RTA_PUT(skb, TCA_ACT_TAB, 0, NULL);
ret = a_o->walk(skb, cb, RTM_GETACTION, &a);
- if (0 > ret)
+ if (ret < 0)
goto rtattr_failure;
if (ret > 0) {
reply other threads:[~2004-12-30 3:39 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=41D37869.5040204@trash.net \
--to=kaber@trash.net \
--cc=hadi@cyberus.ca \
--cc=netdev@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.