From 3e3c2d7b07e3ba39a6d8052e8f132019ee855a9d Mon Sep 17 00:00:00 2001 From: Cas Cremers Date: Wed, 20 Aug 2008 17:20:32 +0200 Subject: [PATCH] Rewrote some code for humans to read, i.e. strcmp wrapper. --- src/compiler.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/compiler.c b/src/compiler.c index 06fbc4b..270ab9d 100644 --- a/src/compiler.c +++ b/src/compiler.c @@ -476,6 +476,13 @@ generateFreshClaimlabel (const System sys, const Protocol protocol, return label; } +//! Boolean sanity wrapper around C low level madness +int +isStringEqual (const char *s1, const char *s2) +{ + return (strcmp (s1, s2) == 0); +} + //! Create a claim and add it to the claims list, and add the role event. Claimlist claimCreate (const System sys, const Protocol protocol, const Role role, @@ -494,8 +501,8 @@ claimCreate (const System sys, const Protocol protocol, const Role role, if (switches.filterProtocol != NULL) { // only this protocol - if (strcmp - (switches.filterProtocol, TermSymb (protocol->nameterm)->text) != 0) + if (!isStringEqual + (switches.filterProtocol, TermSymb (protocol->nameterm)->text)) { // not this protocol; return return NULL; @@ -516,7 +523,7 @@ claimCreate (const System sys, const Protocol protocol, const Role role, { t = TermOp2 (t); } - if (strcmp (switches.filterLabel, TermSymb (t)->text) != 0) + if (!isStringEqual (switches.filterLabel, TermSymb (t)->text)) { // not this label; return return NULL;