hipl-core team mailing list archive
-
hipl-core team
-
Mailing list archive
-
Message #00033
[Branch ~hipl-core/hipl/trunk] Rev 4903: Remove some unnecessary '!= NULL' expressions in if/while conditionals.
------------------------------------------------------------
revno: 4903
committer: Diego Biurrun <diego@xxxxxxxxxx>
branch nick: trunk
timestamp: Fri 2010-08-20 13:14:25 +0200
message:
Remove some unnecessary '!= NULL' expressions in if/while conditionals.
modified:
lib/core/builder.c
--
lp:hipl
https://code.launchpad.net/~hipl-core/hipl/trunk
Your team HIPL core team is subscribed to branch lp:hipl.
To unsubscribe from this branch go to https://code.launchpad.net/~hipl-core/hipl/trunk/+edit-subscription
=== modified file 'lib/core/builder.c'
--- lib/core/builder.c 2010-08-19 10:43:06 +0000
+++ lib/core/builder.c 2010-08-20 11:14:25 +0000
@@ -903,8 +903,7 @@
/** @todo Optimize: stop when next parameter's type is greater than the
* searched one. */
- while ((current_param = hip_get_next_param_readwrite(msg, current_param))
- != NULL) {
+ while ((current_param = hip_get_next_param_readwrite(msg, current_param))) {
if (hip_get_param_type(current_param) == param_type) {
matched = current_param;
break;
@@ -994,8 +993,7 @@
goto out;
}
- while ((current_param = hip_get_next_param_readwrite(msg, current_param))
- != NULL) {
+ while ((current_param = hip_get_next_param_readwrite(msg, current_param))) {
last_used_pos = current_param;
}
@@ -1313,7 +1311,7 @@
HIP_DEBUG("Msg err: %d\n", hip_get_msg_err(msg));
HIP_DEBUG("Msg controls: 0x%04x\n", msg->control);
- while ((current_param = hip_get_next_param(msg, current_param)) != NULL) {
+ while ((current_param = hip_get_next_param(msg, current_param))) {
len = hip_get_param_contents_len(current_param);
/* Formula from base draft section 5.2.1. */
total_len = 11 + len - (len + 3) % 8;
@@ -1350,8 +1348,7 @@
goto out;
}
- while ((current_param = hip_get_next_param(msg, current_param))
- != NULL) {
+ while ((current_param = hip_get_next_param(msg, current_param))) {
if (!hip_check_param_contents_len(msg, current_param)) {
err = -EMSGSIZE;
HIP_ERROR("bad param len\n");
@@ -1442,8 +1439,7 @@
}
/* Checking of param types, lengths and ordering. */
- while ((current_param = hip_get_next_param(msg, current_param))
- != NULL) {
+ while ((current_param = hip_get_next_param(msg, current_param))) {
current_param_type = hip_get_param_type(current_param);
if (!hip_check_param_contents_len(msg, current_param)) {
err = -EMSGSIZE;
@@ -2991,7 +2987,7 @@
memcpy(&esp_anchor.anchors[0], active_anchor, hash_length);
/* send 0 if next_anchor not present */
- if (next_anchor != NULL) {
+ if (next_anchor) {
memcpy(&esp_anchor.anchors[hash_length], next_anchor, hash_length);
} else {
memset(&esp_anchor.anchors[hash_length], 0, hash_length);