From 3f83fda46c14e47392ce3bb4d7aef5780a80ac78 Mon Sep 17 00:00:00 2001 From: Jozsef Kadlecsik Date: Tue, 31 May 2011 19:38:00 +0200 Subject: Whitespace and coding fixes detected by checkpatch.pl --- lib/types.c | 48 +++++++++++++++++++++++++----------------------- 1 file changed, 25 insertions(+), 23 deletions(-) (limited to 'lib/types.c') diff --git a/lib/types.c b/lib/types.c index c440993..7c16a30 100644 --- a/lib/types.c +++ b/lib/types.c @@ -1,7 +1,7 @@ /* Copyright 2007-2010 Jozsef Kadlecsik (kadlec@blackhole.kfki.hu) * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #include /* assert */ @@ -28,8 +28,8 @@ struct ipset { struct ipset *next; }; -static struct ipset_type *typelist = NULL; /* registered set types */ -static struct ipset *setlist = NULL; /* cached sets */ +static struct ipset_type *typelist; /* registered set types */ +static struct ipset *setlist; /* cached sets */ /** * ipset_cache_add - add a set to the cache @@ -57,7 +57,7 @@ ipset_cache_add(const char *name, const struct ipset_type *type, ipset_strlcpy(n->name, name, IPSET_MAXNAMELEN); n->type = type; n->family = family; - n->next = NULL; + n->next = NULL; if (setlist == NULL) { setlist = n; @@ -109,7 +109,7 @@ ipset_cache_del(const char *name) } if (match == NULL) return -EEXIST; - + free(match); return 0; } @@ -168,7 +168,7 @@ ipset_cache_swap(const char *from, const char *to) ipset_strlcpy(b->name, from, IPSET_MAXNAMELEN); return 0; } - + return -EEXIST; } @@ -178,7 +178,7 @@ ipset_cache_swap(const char *from, const char *to) bool ipset_match_typename(const char *name, const struct ipset_type *type) { - const char * const * alias = type->alias; + const char * const *alias = type->alias; if (STREQ(name, type->name)) return true; @@ -189,7 +189,7 @@ ipset_match_typename(const char *name, const struct ipset_type *type) alias++; } return false; -} +} static inline const struct ipset_type * create_type_get(struct ipset_session *session) @@ -215,17 +215,17 @@ create_type_get(struct ipset_session *session) if (ipset_match_typename(typename, t) && MATCH_FAMILY(t, family)) { if (match == NULL) { - match = t; - tmin = tmax = t->revision; + match = t; + tmin = tmax = t->revision; } else if (t->family == match->family) tmin = t->revision; - } + } } if (!match) return ipset_errptr(session, "Syntax error: unknown settype %s", typename); - + /* Family is unspecified yet: set from matching set type */ if (family == AF_UNSPEC && match->family != AF_UNSPEC) { family = match->family == AF_INET46 ? AF_INET : match->family; @@ -240,9 +240,11 @@ create_type_get(struct ipset_session *session) if (ret != 0) return NULL; - kmin = kmax = *(const uint8_t *)ipset_data_get(data, IPSET_OPT_REVISION); + kmin = kmax = *(const uint8_t *)ipset_data_get(data, + IPSET_OPT_REVISION); if (ipset_data_test(data, IPSET_OPT_REVISION_MIN)) - kmin = *(const uint8_t *)ipset_data_get(data, IPSET_OPT_REVISION_MIN); + kmin = *(const uint8_t *)ipset_data_get(data, + IPSET_OPT_REVISION_MIN); if (MAX(tmin, kmin) > MIN(tmax, kmax)) { if (kmin > tmax) @@ -266,7 +268,7 @@ create_type_get(struct ipset_session *session) family == AF_INET6 ? "INET6" : "UNSPEC", kmax, tmin); } - + /* Disable unsupported revisions */ for (match = NULL, t = typelist; t != NULL; t = t->next) { /* Skip revisions which are unsupported by the kernel */ @@ -274,16 +276,16 @@ create_type_get(struct ipset_session *session) continue; if (ipset_match_typename(typename, t) && MATCH_FAMILY(t, family)) { - if (t->revision < kmin || t->revision > kmax) - t->kernel_check = IPSET_KERNEL_MISMATCH; + if (t->revision < kmin || t->revision > kmax) + t->kernel_check = IPSET_KERNEL_MISMATCH; else if (match == NULL) - match = t; - } + match = t; + } } match->kernel_check = IPSET_KERNEL_OK; found: ipset_data_set(data, IPSET_OPT_TYPE, match); - + return match; } @@ -327,7 +329,7 @@ adt_type_get(struct ipset_session *session) return NULL; typename = ipset_data_get(data, IPSET_OPT_TYPENAME); - revision = ipset_data_get(data, IPSET_OPT_REVISION); + revision = ipset_data_get(data, IPSET_OPT_REVISION); family = ipset_data_family(data); /* Check registered types */ @@ -542,7 +544,7 @@ void ipset_cache_fini(void) { struct ipset *set; - + while (setlist) { set = setlist; setlist = setlist->next; -- cgit v1.2.3