contact: Inline putcontact() into its only caller setcont()

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2016-10-23 17:52:17 +02:00
parent cf4e9bc89d
commit 00d0664bcd
3 changed files with 9 additions and 15 deletions

View file

@ -171,7 +171,6 @@ extern int getrejects(natid them, struct natstr *np);
extern int getcontact(struct natstr *np, natid them); extern int getcontact(struct natstr *np, natid them);
extern void putrel(struct natstr *np, natid them, int relate); extern void putrel(struct natstr *np, natid them, int relate);
extern void putreject(struct natstr *np, natid them, int how, int what); 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 void agecontact(struct natstr *np);
extern int influx(struct natstr *np); extern int influx(struct natstr *np);
extern struct natstr *nat_reset(struct natstr *, natid, char *, char *, extern struct natstr *nat_reset(struct natstr *, natid, char *, char *,

View file

@ -128,18 +128,6 @@ putreject(struct natstr *np, natid them, int how, int what)
np->nat_rejects[them] &= ~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 int
influx(struct natstr *np) influx(struct natstr *np)
{ {

View file

@ -28,7 +28,7 @@
* *
* Known contributors to this file: * Known contributors to this file:
* Dave Pare, 1994 * Dave Pare, 1994
* Markus Armbruster, 2005-2013 * Markus Armbruster, 2005-2016
*/ */
#include <config.h> #include <config.h>
@ -117,7 +117,14 @@ setcont(natid us, natid them, int contact)
if (CANT_HAPPEN(!np)) if (CANT_HAPPEN(!np))
return; 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); putnat(np);
} }