From 7956eb5953c7fd63ea7a35a50a389d9649adef3a Mon Sep 17 00:00:00 2001 From: Cas Cremers Date: Sun, 14 Oct 2018 17:43:13 +0200 Subject: [PATCH] Removed a simple nested function. --- src/arachne.c | 42 ++++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/src/arachne.c b/src/arachne.c index 174f166..1868435 100644 --- a/src/arachne.c +++ b/src/arachne.c @@ -645,21 +645,39 @@ iterate_role_events (int (*func) ()) int iterate_role_sends (int (*func) ()) { - int send_wrapper (Protocol p, Role r, Roledef rd, int i) - { - if (rd->type == SEND) - { - return func (p, r, rd, i); - } - else - { - return 1; - } - } + Protocol p; - return iterate_role_events (send_wrapper); + p = sys->protocols; + while (p != NULL) + { + Role r; + + r = p->roles; + while (r != NULL) + { + Roledef rd; + int index; + + rd = r->roledef; + index = 0; + while (rd != NULL) + { + if (rd->type == SEND) + { + if (!func (p, r, rd, index)) + return 0; + } + index++; + rd = rd->next; + } + r = r->next; + } + p = p->next; + } + return 1; } + //! Create decryption role instance /** * Note that this does not add any bindings for the receives.