[Refdb-cvs] CVS: refdb/src refdbxp.c,1.7.2.2,1.7.2.3
Status: Beta
Brought to you by:
mhoenicka
From: Markus H. <mho...@us...> - 2004-06-29 18:59:04
|
Update of /cvsroot/refdb/refdb/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22993 Modified Files: Tag: Release_0_9_5_stable refdbxp.c Log Message: count_lilicit():fix while loop to catch first entry and not to segfault if there are no members Index: refdbxp.c =================================================================== RCS file: /cvsroot/refdb/refdb/src/refdbxp.c,v retrieving revision 1.7.2.2 retrieving revision 1.7.2.3 diff -u -U2 -r1.7.2.2 -r1.7.2.3 --- refdbxp.c 24 Jun 2004 20:33:56 -0000 1.7.2.2 +++ refdbxp.c 29 Jun 2004 18:58:53 -0000 1.7.2.3 @@ -1149,4 +1149,8 @@ /*++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ count_lilicit(): counts the members of the Lilicit linked list + + int count_lilicit returns the number of members minus one. This is + the easiest way to distinguish between single (0) + and multiple (!=0) references Lilicit* ptr_first ptr to the sentinel of the linked list @@ -1157,5 +1161,5 @@ Lilicit *ptr_curr; - ptr_curr = ptr_first->ptr_next; + ptr_curr = ptr_first; while (ptr_curr = get_next_lilicit(ptr_curr)) { @@ -1163,4 +1167,8 @@ } + if (i) { + i--; + } + return i; } |