diff --git a/src/scytherprof b/src/scytherprof new file mode 100755 index 0000000..4881b5e --- /dev/null +++ b/src/scytherprof @@ -0,0 +1,5 @@ +#!/bin/sh + +scons gprof=yes +./scyther $* +gprof --flat-profile scyther diff --git a/src/termlists.c b/src/termlists.c index 838fc6f..d5900f1 100644 --- a/src/termlists.c +++ b/src/termlists.c @@ -109,25 +109,28 @@ termlistDestroy (Termlist tl) //! Determine whether a term is an element of a termlist. /** + * Term must be non-null. + * *@return True iff the term is an element of the termlist. */ -int -inTermlist (Termlist tl, Term term) +__inline__ int +inTermlist (Termlist tl, const Term term) { - if (tl == NULL) +#ifdef DEBUG + if (term == NULL) { - if (term == NULL) - return 1; - else - return 0; + error ("Trying to do inTermlist for a NULL term."); } - else +#endif + while (tl != NULL) { if (isTermEqual (tl->term, term)) - return 1; - else - return inTermlist (tl->next, term); + { + return 1; + } + tl = tl->next; } + return 0; } //! Equality of two term lists. diff --git a/src/termlists.h b/src/termlists.h index 1a2c7cf..908bb26 100644 --- a/src/termlists.h +++ b/src/termlists.h @@ -28,7 +28,7 @@ Termlist termlistShallow (Termlist tl); void termlistDelete (Termlist tl); void termlistDestroy (Termlist tl); void termlistPrint (Termlist tl); -int inTermlist (Termlist tl, Term term); +int inTermlist (Termlist tl, const Term term); int isTermlistEqual (Termlist tl1, Termlist tl2); Termlist termlistAdd (Termlist tl, Term term); Termlist termlistAppend (const Termlist tl, const Term term);