From: Markus Armbruster Date: Sat, 29 Oct 2016 09:19:19 +0000 (+0200) Subject: accept: Don't rely on rejection flag encoding X-Git-Tag: v4.4.0~87 X-Git-Url: http://git.pond.sub.org/?p=empserver;a=commitdiff_plain;h=c3f6dfda9db4f8a20fb6e1ccb88ae162648122f5 accept: Don't rely on rejection flag encoding Instead of enumerating all eight combinations of the three flags in a table, simply print each flag on its own, and drop the table. The old table depends on the flag encoding, the new code doesn't. Signed-off-by: Markus Armbruster --- diff --git a/src/lib/commands/acce.c b/src/lib/commands/acce.c index d3c8952a4..d5a02b5c8 100644 --- a/src/lib/commands/acce.c +++ b/src/lib/commands/acce.c @@ -79,17 +79,11 @@ acce(void) static void pr_accept(struct natstr *to, natid from) { - static char *rejects[] = { - /* must follow reject flags defined in nat.h */ - " YES YES YES", - " NO YES YES", - " YES NO YES", - " NO NO YES", - " YES YES NO ", - " NO YES NO ", - " YES NO NO ", - " NO NO NO ", - }; + static char *yes_no[] = { "YES", "NO " }; + int rej = getrejects(from, to); - pr(" %s", rejects[getrejects(from, to)]); + pr(" %s %s %s", + yes_no[(rej & REJ_TELE) != 0], + yes_no[(rej & REJ_ANNO) != 0], + yes_no[(rej & REJ_LOAN) != 0]); }