Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libnpf - consistency with types
details: https://anonhg.NetBSD.org/src/rev/f218df1414be
branches: trunk
changeset: 771636:f218df1414be
user: christos <christos%NetBSD.org@localhost>
date: Sat Nov 26 23:42:27 2011 +0000
description:
- consistency with types
- prefer sizeof(*var)
diffstat:
lib/libnpf/npf.c | 20 +++++++++++---------
lib/libnpf/npf.h | 10 +++++-----
2 files changed, 16 insertions(+), 14 deletions(-)
diffs (115 lines):
diff -r 1712895c27a1 -r f218df1414be lib/libnpf/npf.c
--- a/lib/libnpf/npf.c Sat Nov 26 23:20:41 2011 +0000
+++ b/lib/libnpf/npf.c Sat Nov 26 23:42:27 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: npf.c,v 1.4 2011/11/26 23:11:19 rmind Exp $ */
+/* $NetBSD: npf.c,v 1.5 2011/11/26 23:42:27 christos Exp $ */
/*-
* Copyright (c) 2010-2011 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: npf.c,v 1.4 2011/11/26 23:11:19 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: npf.c,v 1.5 2011/11/26 23:42:27 christos Exp $");
#include <sys/types.h>
#include <netinet/in_systm.h>
@@ -79,7 +79,7 @@
{
nl_config_t *ncf;
- ncf = malloc(sizeof(nl_config_t));
+ ncf = malloc(sizeof(*ncf));
if (ncf == NULL) {
return NULL;
}
@@ -168,7 +168,7 @@
prop_dictionary_t rldict;
nl_rule_t *rl;
- rl = malloc(sizeof(nl_rule_t));
+ rl = malloc(sizeof(*rl));
if (rl == NULL) {
return NULL;
}
@@ -294,7 +294,8 @@
}
int
-_npf_rproc_setnorm(nl_rproc_t *rp, bool rnd, bool no_df, int minttl, int maxmss)
+_npf_rproc_setnorm(nl_rproc_t *rp, bool rnd, bool no_df, u_int minttl,
+ u_int maxmss)
{
prop_dictionary_t rpdict = rp->nrp_dict;
uint32_t fl;
@@ -343,7 +344,7 @@
*/
nl_nat_t *
-npf_nat_create(int type, int flags, u_int if_idx,
+npf_nat_create(int type, u_int flags, u_int if_idx,
npf_addr_t *addr, int af, in_port_t port)
{
nl_rule_t *rl;
@@ -409,13 +410,13 @@
*/
nl_table_t *
-npf_table_create(int id, int type)
+npf_table_create(u_int id, int type)
{
prop_dictionary_t tldict;
prop_array_t tblents;
nl_table_t *tl;
- tl = malloc(sizeof(nl_table_t));
+ tl = malloc(sizeof(*tl));
if (tl == NULL) {
return NULL;
}
@@ -509,7 +510,8 @@
*/
int
-npf_update_rule(int fd, char *rname, nl_rule_t *rl)
+/*ARGSUSED*/
+npf_update_rule(int fd, const char *rname __unused, nl_rule_t *rl)
{
prop_dictionary_t rldict = rl->nrl_dict;
int error;
diff -r 1712895c27a1 -r f218df1414be lib/libnpf/npf.h
--- a/lib/libnpf/npf.h Sat Nov 26 23:20:41 2011 +0000
+++ b/lib/libnpf/npf.h Sat Nov 26 23:42:27 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: npf.h,v 1.3 2011/11/26 23:11:19 rmind Exp $ */
+/* $NetBSD: npf.h,v 1.4 2011/11/26 23:42:27 christos Exp $ */
/*-
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -79,20 +79,20 @@
int npf_rproc_insert(nl_config_t *, nl_rproc_t *);
#ifdef _NPF_PRIVATE
-int _npf_rproc_setnorm(nl_rproc_t *, bool, bool, int, int);
+int _npf_rproc_setnorm(nl_rproc_t *, bool, bool, u_int, u_int);
int _npf_rproc_setlog(nl_rproc_t *, u_int);
#endif
-nl_nat_t * npf_nat_create(int, int, u_int, npf_addr_t *, int, in_port_t);
+nl_nat_t * npf_nat_create(int, u_int, u_int, npf_addr_t *, int, in_port_t);
int npf_nat_insert(nl_config_t *, nl_nat_t *, pri_t);
-nl_table_t * npf_table_create(int, int);
+nl_table_t * npf_table_create(u_int, int);
int npf_table_add_entry(nl_table_t *, npf_addr_t *, npf_netmask_t);
bool npf_table_exists_p(nl_config_t *, u_int);
int npf_table_insert(nl_config_t *, nl_table_t *);
void npf_table_destroy(nl_table_t *);
-int npf_update_rule(int, char *, nl_rule_t *);
+int npf_update_rule(int, const char *, nl_rule_t *);
int npf_sessions_send(int, const char *);
int npf_sessions_recv(int, const char *);
Home |
Main Index |
Thread Index |
Old Index