Rewrote some code for humans to read, i.e. strcmp wrapper.

This commit is contained in:
Cas Cremers 2008-08-20 17:20:32 +02:00
parent 8f01637528
commit 3e3c2d7b07

View File

@ -476,6 +476,13 @@ generateFreshClaimlabel (const System sys, const Protocol protocol,
return label; 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. //! Create a claim and add it to the claims list, and add the role event.
Claimlist Claimlist
claimCreate (const System sys, const Protocol protocol, const Role role, 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) if (switches.filterProtocol != NULL)
{ {
// only this protocol // only this protocol
if (strcmp if (!isStringEqual
(switches.filterProtocol, TermSymb (protocol->nameterm)->text) != 0) (switches.filterProtocol, TermSymb (protocol->nameterm)->text))
{ {
// not this protocol; return // not this protocol; return
return NULL; return NULL;
@ -516,7 +523,7 @@ claimCreate (const System sys, const Protocol protocol, const Role role,
{ {
t = TermOp2 (t); t = TermOp2 (t);
} }
if (strcmp (switches.filterLabel, TermSymb (t)->text) != 0) if (!isStringEqual (switches.filterLabel, TermSymb (t)->text))
{ {
// not this label; return // not this label; return
return NULL; return NULL;