- Added some code optimizations after using gprof.

This commit is contained in:
ccremers 2004-07-20 08:51:23 +00:00
parent ff0c29142e
commit a588c90952
3 changed files with 20 additions and 12 deletions

5
src/scytherprof Executable file
View File

@ -0,0 +1,5 @@
#!/bin/sh
scons gprof=yes
./scyther $*
gprof --flat-profile scyther

View File

@ -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.

View File

@ -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);