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 --- include/libipset/data.h | 16 ++++++++-------- include/libipset/debug.h | 6 +++--- include/libipset/errcode.h | 10 +++++----- include/libipset/icmp.h | 8 ++++---- include/libipset/icmpv6.h | 8 ++++---- include/libipset/mnl.h | 4 ++-- include/libipset/nf_inet_addr.h | 4 ++-- include/libipset/parse.h | 42 ++++++++++++++++++++--------------------- include/libipset/pfxlen.h | 2 +- include/libipset/print.h | 4 ++-- include/libipset/session.h | 22 ++++++++++++--------- include/libipset/transport.h | 6 +++--- include/libipset/types.h | 15 ++++++++------- include/libipset/ui.h | 4 ++-- include/libipset/utils.h | 12 ++++++------ 15 files changed, 84 insertions(+), 79 deletions(-) (limited to 'include') diff --git a/include/libipset/data.h b/include/libipset/data.h index 7c7b5e1..3ba6f0a 100644 --- a/include/libipset/data.h +++ b/include/libipset/data.h @@ -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. */ #ifndef LIBIPSET_DATA_H @@ -68,7 +68,7 @@ enum ipset_opt { #define IPSET_FLAGS_ALL (~0LL) #define IPSET_CREATE_FLAGS \ - ( IPSET_FLAG(IPSET_OPT_FAMILY) \ + (IPSET_FLAG(IPSET_OPT_FAMILY) \ | IPSET_FLAG(IPSET_OPT_TYPENAME)\ | IPSET_FLAG(IPSET_OPT_TYPE) \ | IPSET_FLAG(IPSET_OPT_IP) \ @@ -86,7 +86,7 @@ enum ipset_opt { | IPSET_FLAG(IPSET_OPT_SIZE)) #define IPSET_ADT_FLAGS \ - ( IPSET_FLAG(IPSET_OPT_IP) \ + (IPSET_FLAG(IPSET_OPT_IP) \ | IPSET_FLAG(IPSET_OPT_IP_TO) \ | IPSET_FLAG(IPSET_OPT_CIDR) \ | IPSET_FLAG(IPSET_OPT_PORT) \ @@ -114,8 +114,8 @@ extern bool ipset_data_ignored(struct ipset_data *data, enum ipset_opt opt); extern int ipset_data_set(struct ipset_data *data, enum ipset_opt opt, const void *value); -extern const void * ipset_data_get(const struct ipset_data *data, - enum ipset_opt opt); +extern const void *ipset_data_get(const struct ipset_data *data, + enum ipset_opt opt); static inline bool ipset_data_test(const struct ipset_data *data, enum ipset_opt opt) @@ -124,13 +124,13 @@ ipset_data_test(const struct ipset_data *data, enum ipset_opt opt) } /* Shortcuts */ -extern const char * ipset_data_setname(const struct ipset_data *data); +extern const char *ipset_data_setname(const struct ipset_data *data); extern uint8_t ipset_data_family(const struct ipset_data *data); extern uint8_t ipset_data_cidr(const struct ipset_data *data); extern uint64_t ipset_data_flags(const struct ipset_data *data); extern void ipset_data_reset(struct ipset_data *data); -extern struct ipset_data * ipset_data_init(void); +extern struct ipset_data *ipset_data_init(void); extern void ipset_data_fini(struct ipset_data *data); extern size_t ipset_data_sizeof(enum ipset_opt opt, uint8_t family); diff --git a/include/libipset/debug.h b/include/libipset/debug.h index b0f4dfd..b9d5479 100644 --- a/include/libipset/debug.h +++ b/include/libipset/debug.h @@ -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. */ #ifndef LIBIPSET_DEBUG_H @@ -12,7 +12,7 @@ #include #include #define D(fmt, args...) \ - fprintf(stderr, "%s: %s: " fmt "\n", __FILE__, __FUNCTION__ , ## args) + fprintf(stderr, "%s: %s: " fmt "\n", __FILE__, __func__ , ## args) #define IF_D(test, fmt, args...) \ if (test) \ D(fmt , ## args) diff --git a/include/libipset/errcode.h b/include/libipset/errcode.h index ed56eb5..1593d89 100644 --- a/include/libipset/errcode.h +++ b/include/libipset/errcode.h @@ -1,7 +1,7 @@ /* Copyright 2007-2008 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. */ #ifndef LIBIPSET_ERRCODE_H @@ -13,9 +13,9 @@ struct ipset_session; /* Kernel error code to message table */ struct ipset_errcode_table { - int errcode; /* error code returned by the kernel */ - enum ipset_cmd cmd; /* issued command */ - const char *message; /* error message the code translated to */ + int errcode; /* error code returned by the kernel */ + enum ipset_cmd cmd; /* issued command */ + const char *message; /* error message the code translated to */ }; extern int ipset_errcode(struct ipset_session *session, enum ipset_cmd cmd, diff --git a/include/libipset/icmp.h b/include/libipset/icmp.h index 89604cd..e27fd4a 100644 --- a/include/libipset/icmp.h +++ b/include/libipset/icmp.h @@ -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. */ #ifndef LIBIPSET_ICMP_H @@ -9,8 +9,8 @@ #include /* uintxx_t */ -extern const char * id_to_icmp(uint8_t id); -extern const char * icmp_to_name(uint8_t type, uint8_t code); +extern const char *id_to_icmp(uint8_t id); +extern const char *icmp_to_name(uint8_t type, uint8_t code); extern int name_to_icmp(const char *str, uint16_t *typecode); #endif /* LIBIPSET_ICMP_H */ diff --git a/include/libipset/icmpv6.h b/include/libipset/icmpv6.h index b23c822..8295445 100644 --- a/include/libipset/icmpv6.h +++ b/include/libipset/icmpv6.h @@ -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. */ #ifndef LIBIPSET_ICMPV6_H @@ -9,8 +9,8 @@ #include /* uintxx_t */ -extern const char * id_to_icmpv6(uint8_t id); -extern const char * icmpv6_to_name(uint8_t type, uint8_t code); +extern const char *id_to_icmpv6(uint8_t id); +extern const char *icmpv6_to_name(uint8_t type, uint8_t code); extern int name_to_icmpv6(const char *str, uint16_t *typecode); #endif /* LIBIPSET_ICMPV6_H */ diff --git a/include/libipset/mnl.h b/include/libipset/mnl.h index c2b6d4c..0516ec7 100644 --- a/include/libipset/mnl.h +++ b/include/libipset/mnl.h @@ -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. */ #ifndef LIBIPSET_MNL_H diff --git a/include/libipset/nf_inet_addr.h b/include/libipset/nf_inet_addr.h index 0e0701e..6c94e15 100644 --- a/include/libipset/nf_inet_addr.h +++ b/include/libipset/nf_inet_addr.h @@ -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. */ #ifndef LIBIPSET_NF_INET_ADDR_H diff --git a/include/libipset/parse.h b/include/libipset/parse.h index 08f1089..9f64a70 100644 --- a/include/libipset/parse.h +++ b/include/libipset/parse.h @@ -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. */ #ifndef LIBIPSET_PARSE_H @@ -23,7 +23,7 @@ typedef int (*ipset_parsefn)(struct ipset_session *s, enum ipset_opt opt, const char *str); extern int ipset_parse_ether(struct ipset_session *session, - enum ipset_opt opt, const char *str); + enum ipset_opt opt, const char *str); extern int ipset_parse_port(struct ipset_session *session, enum ipset_opt opt, const char *str, const char *proto); @@ -35,23 +35,23 @@ extern int ipset_parse_tcp_port(struct ipset_session *session, extern int ipset_parse_single_tcp_port(struct ipset_session *session, enum ipset_opt opt, const char *str); extern int ipset_parse_proto(struct ipset_session *session, - enum ipset_opt opt, const char *str); + enum ipset_opt opt, const char *str); extern int ipset_parse_icmp(struct ipset_session *session, - enum ipset_opt opt, const char *str); + enum ipset_opt opt, const char *str); extern int ipset_parse_icmpv6(struct ipset_session *session, - enum ipset_opt opt, const char *str); + enum ipset_opt opt, const char *str); extern int ipset_parse_proto_port(struct ipset_session *session, enum ipset_opt opt, const char *str); extern int ipset_parse_family(struct ipset_session *session, - enum ipset_opt opt, const char *str); + enum ipset_opt opt, const char *str); extern int ipset_parse_ip(struct ipset_session *session, - enum ipset_opt opt, const char *str); + enum ipset_opt opt, const char *str); extern int ipset_parse_single_ip(struct ipset_session *session, enum ipset_opt opt, const char *str); extern int ipset_parse_net(struct ipset_session *session, - enum ipset_opt opt, const char *str); + enum ipset_opt opt, const char *str); extern int ipset_parse_range(struct ipset_session *session, - enum ipset_opt opt, const char *str); + enum ipset_opt opt, const char *str); extern int ipset_parse_netrange(struct ipset_session *session, enum ipset_opt opt, const char *str); extern int ipset_parse_iprange(struct ipset_session *session, @@ -63,31 +63,31 @@ extern int ipset_parse_ip4_single6(struct ipset_session *session, extern int ipset_parse_ip4_net6(struct ipset_session *session, enum ipset_opt opt, const char *str); extern int ipset_parse_name(struct ipset_session *session, - enum ipset_opt opt, const char *str); + enum ipset_opt opt, const char *str); extern int ipset_parse_before(struct ipset_session *session, - enum ipset_opt opt, const char *str); + enum ipset_opt opt, const char *str); extern int ipset_parse_after(struct ipset_session *session, - enum ipset_opt opt, const char *str); + enum ipset_opt opt, const char *str); extern int ipset_parse_setname(struct ipset_session *session, - enum ipset_opt opt, const char *str); + enum ipset_opt opt, const char *str); extern int ipset_parse_uint32(struct ipset_session *session, - enum ipset_opt opt, const char *str); + enum ipset_opt opt, const char *str); extern int ipset_parse_uint8(struct ipset_session *session, - enum ipset_opt opt, const char *str); + enum ipset_opt opt, const char *str); extern int ipset_parse_netmask(struct ipset_session *session, - enum ipset_opt opt, const char *str); + enum ipset_opt opt, const char *str); extern int ipset_parse_flag(struct ipset_session *session, - enum ipset_opt opt, const char *str); + enum ipset_opt opt, const char *str); extern int ipset_parse_typename(struct ipset_session *session, enum ipset_opt opt, const char *str); extern int ipset_parse_iface(struct ipset_session *session, enum ipset_opt opt, const char *str); extern int ipset_parse_output(struct ipset_session *session, - int opt, const char *str); + int opt, const char *str); extern int ipset_parse_ignored(struct ipset_session *session, - enum ipset_opt opt, const char *str); + enum ipset_opt opt, const char *str); extern int ipset_parse_elem(struct ipset_session *session, - enum ipset_opt opt, const char *str); + enum ipset_opt opt, const char *str); extern int ipset_call_parser(struct ipset_session *session, const struct ipset_arg *arg, const char *str); diff --git a/include/libipset/pfxlen.h b/include/libipset/pfxlen.h index ba94dd9..58b4b4f 100644 --- a/include/libipset/pfxlen.h +++ b/include/libipset/pfxlen.h @@ -12,7 +12,7 @@ {.ip6 = { \ __constant_htonl(a), __constant_htonl(b), \ __constant_htonl(c), __constant_htonl(d), \ - }} + } } /* * This table works for both IPv4 and IPv6; diff --git a/include/libipset/print.h b/include/libipset/print.h index a3f5b95..1d537bd 100644 --- a/include/libipset/print.h +++ b/include/libipset/print.h @@ -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. */ #ifndef LIBIPSET_PRINT_H diff --git a/include/libipset/session.h b/include/libipset/session.h index 9301ccd..467bb2f 100644 --- a/include/libipset/session.h +++ b/include/libipset/session.h @@ -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. */ #ifndef LIBIPSET_SESSION_H @@ -21,10 +21,14 @@ struct ipset_session; struct ipset_data; struct ipset_handle; -extern struct ipset_data * ipset_session_data(const struct ipset_session *session); -extern struct ipset_handle * ipset_session_handle(const struct ipset_session *session); -extern const struct ipset_type * ipset_saved_type(const struct ipset_session *session); -extern void ipset_session_lineno(struct ipset_session *session, uint32_t lineno); +extern struct ipset_data * + ipset_session_data(const struct ipset_session *session); +extern struct ipset_handle * + ipset_session_handle(const struct ipset_session *session); +extern const struct ipset_type * + ipset_saved_type(const struct ipset_session *session); +extern void ipset_session_lineno(struct ipset_session *session, + uint32_t lineno); enum ipset_err_type { IPSET_ERROR, @@ -47,8 +51,8 @@ extern int ipset_session_report(struct ipset_session *session, }) extern void ipset_session_report_reset(struct ipset_session *session); -extern const char * ipset_session_error(const struct ipset_session *session); -extern const char * ipset_session_warning(const struct ipset_session *session); +extern const char *ipset_session_error(const struct ipset_session *session); +extern const char *ipset_session_warning(const struct ipset_session *session); #define ipset_session_data_set(session, opt, value) \ ipset_data_set(ipset_session_data(session), opt, value) @@ -93,7 +97,7 @@ extern int ipset_cmd(struct ipset_session *session, enum ipset_cmd cmd, typedef int (*ipset_outfn)(const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); -extern struct ipset_session * ipset_session_init(ipset_outfn outfn); +extern struct ipset_session *ipset_session_init(ipset_outfn outfn); extern int ipset_session_fini(struct ipset_session *session); extern void ipset_debug_msg(const char *dir, void *buffer, int len); diff --git a/include/libipset/transport.h b/include/libipset/transport.h index b22e073..a9209cd 100644 --- a/include/libipset/transport.h +++ b/include/libipset/transport.h @@ -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. */ #ifndef LIBIPSET_TRANSPORT_H @@ -12,7 +12,7 @@ #include /* mnl_cb_t */ -#include /* enum ipset_cmd */ +#include /* enum ipset_cmd */ struct ipset_handle; diff --git a/include/libipset/types.h b/include/libipset/types.h index d8973db..d3a0b4c 100644 --- a/include/libipset/types.h +++ b/include/libipset/types.h @@ -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. */ #ifndef LIBIPSET_TYPES_H @@ -97,13 +97,14 @@ extern int ipset_cache_swap(const char *from, const char *to); extern int ipset_cache_init(void); extern void ipset_cache_fini(void); -extern const struct ipset_type * ipset_type_get(struct ipset_session *session, - enum ipset_cmd cmd); -extern const struct ipset_type * ipset_type_check(struct ipset_session *session); +extern const struct ipset_type * + ipset_type_get(struct ipset_session *session, enum ipset_cmd cmd); +extern const struct ipset_type * + ipset_type_check(struct ipset_session *session); extern int ipset_type_add(struct ipset_type *type); -extern const struct ipset_type * ipset_types(void); -extern const char * ipset_typename_resolve(const char *str); +extern const struct ipset_type *ipset_types(void); +extern const char *ipset_typename_resolve(const char *str); extern bool ipset_match_typename(const char *str, const struct ipset_type *t); diff --git a/include/libipset/ui.h b/include/libipset/ui.h index b05b737..4c9a163 100644 --- a/include/libipset/ui.h +++ b/include/libipset/ui.h @@ -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. */ #ifndef LIBIPSET_UI_H diff --git a/include/libipset/utils.h b/include/libipset/utils.h index 2c88a83..df5b59e 100644 --- a/include/libipset/utils.h +++ b/include/libipset/utils.h @@ -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. */ #ifndef LIBIPSET_UTILS_H @@ -11,10 +11,10 @@ #include /* struct in[6]_addr */ /* String equality tests */ -#define STREQ(a,b) (strcmp(a,b) == 0) -#define STRNEQ(a,b,n) (strncmp(a,b,n) == 0) -#define STRCASEQ(a,b) (strcasecmp(a,b) == 0) -#define STRNCASEQ(a,b,n) (strncasecmp(a,b,n) == 0) +#define STREQ(a, b) (strcmp(a, b) == 0) +#define STRNEQ(a, b, n) (strncmp(a, b, n) == 0) +#define STRCASEQ(a, b) (strcasecmp(a, b) == 0) +#define STRNCASEQ(a, b, n) (strncasecmp(a, b, n) == 0) /* Stringify tokens */ #define _STR(c) #c -- cgit v1.2.3