From 00d0664bcd6ca48e69804de47c2222e6606663ef Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sun, 23 Oct 2016 17:52:17 +0200 Subject: [PATCH] contact: Inline putcontact() into its only caller setcont() Signed-off-by: Markus Armbruster --- include/nat.h | 1 - src/lib/common/nat.c | 12 ------------ src/lib/subs/rej.c | 11 +++++++++-- 3 files changed, 9 insertions(+), 15 deletions(-) diff --git a/include/nat.h b/include/nat.h index 20f7ba88..3a4e021b 100644 --- a/include/nat.h +++ b/include/nat.h @@ -171,7 +171,6 @@ extern int getrejects(natid them, struct natstr *np); extern int getcontact(struct natstr *np, natid them); extern void putrel(struct natstr *np, natid them, int relate); extern void putreject(struct natstr *np, natid them, int how, int what); -extern void putcontact(struct natstr *np, natid them, int contact); extern void agecontact(struct natstr *np); extern int influx(struct natstr *np); extern struct natstr *nat_reset(struct natstr *, natid, char *, char *, diff --git a/src/lib/common/nat.c b/src/lib/common/nat.c index 2a42a38f..f5372e78 100644 --- a/src/lib/common/nat.c +++ b/src/lib/common/nat.c @@ -128,18 +128,6 @@ putreject(struct natstr *np, natid them, int how, int what) np->nat_rejects[them] &= ~what; } -void -putcontact(struct natstr *np, natid them, int contact) -{ - if (CANT_HAPPEN(contact < 0)) - contact = 0; - if (CANT_HAPPEN(contact > 255)) - contact = 255; - - if (np->nat_contact[them] < contact) - np->nat_contact[them] = contact; -} - int influx(struct natstr *np) { diff --git a/src/lib/subs/rej.c b/src/lib/subs/rej.c index f9060560..de11e817 100644 --- a/src/lib/subs/rej.c +++ b/src/lib/subs/rej.c @@ -28,7 +28,7 @@ * * Known contributors to this file: * Dave Pare, 1994 - * Markus Armbruster, 2005-2013 + * Markus Armbruster, 2005-2016 */ #include @@ -117,7 +117,14 @@ setcont(natid us, natid them, int contact) if (CANT_HAPPEN(!np)) return; - putcontact(np, them, contact); + + if (CANT_HAPPEN(contact < 0)) + contact = 0; + if (CANT_HAPPEN(contact > 255)) + contact = 255; + + if (np->nat_contact[them] < contact) + np->nat_contact[them] = contact; putnat(np); }