summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author/C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org>2008-01-17 17:43:38 +0000
committer/C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org>2008-01-17 17:43:38 +0000
commitf77677c542c1b42d6a76cd114ae8f2ea6b07641e (patch)
tree6a0f4a9ca8e7b4a9c56f31c9a501720197b9339b
parent1f2483506ca384e87158d44fa2d9db53daeb11c9 (diff)
downloadconntrack-tools-f77677c542c1b42d6a76cd114ae8f2ea6b07641e.tar.gz
conntrack-tools-f77677c542c1b42d6a76cd114ae8f2ea6b07641e.zip
Max Kellermann <max@duempel.org>:
eliminate local variable by returning from the loop
-rw-r--r--ChangeLog1
-rw-r--r--src/conntrack.c12
2 files changed, 6 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 5ba7041..01dcc05 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -55,6 +55,7 @@ o use C99 integers (uint32_t instead of u_int32_t)
= conntrack =
o check for malloc() failure in merge_opts
+o eliminate local variable by returning from the loop
= conntrackd =
o resolve global variable "alarm" conflict with alarm() function in unistd.h.
diff --git a/src/conntrack.c b/src/conntrack.c
index f170bed..4d0642c 100644
--- a/src/conntrack.c
+++ b/src/conntrack.c
@@ -156,19 +156,17 @@ void register_proto(struct ctproto_handler *h)
static struct ctproto_handler *findproto(char *name)
{
- struct ctproto_handler *cur, *handler = NULL;
+ struct ctproto_handler *cur;
if (!name)
- return handler;
+ return NULL;
list_for_each_entry(cur, &proto_list, head) {
- if (strcmp(cur->name, name) == 0) {
- handler = cur;
- break;
- }
+ if (strcmp(cur->name, name) == 0)
+ return cur;
}
- return handler;
+ return NULL;
}
static void