diff --git a/src/role.c b/src/role.c index 1138d68..33e8347 100644 --- a/src/role.c +++ b/src/role.c @@ -319,15 +319,15 @@ roledef_iterate_events (Roledef rd, int (*func) ()) * but this just shows the use of the iteration. */ int -roledef_length (const Roledef rd) +roledef_length (Roledef rd) { int count = 0; - int countplus (Roledef rd) - { - count++; - return 1; - } - roledef_iterate_events (rd, countplus); + + while (rd != NULL) + { + count++; + rd = rd->next; + } return count; } diff --git a/src/role.h b/src/role.h index ecc0b8f..5669c51 100644 --- a/src/role.h +++ b/src/role.h @@ -185,7 +185,7 @@ Role roleCreate (Term nameterm); void rolePrint (Role r); void rolesPrint (Role r); int roledef_iterate_events (Roledef rd, int (*func) ()); -int roledef_length (const Roledef rd); +int roledef_length (Roledef rd); Roledef roledef_shift (Roledef rd, int i); int roledefSubTerm (Roledef rd, Term tsub); Roledef firstEventWithTerm (Roledef rd, Term t);