diff options
author | Not Zed <NotZed@Ximian.com> | 2001-08-15 22:41:57 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2001-08-15 22:41:57 +0800 |
commit | 95cad50c053fda877e2a640d7301c31704b4c889 (patch) | |
tree | fdce28d788469b575a3398f091dcc1235fdd3911 /libibex | |
parent | 580a9b1815c0def8b58d2fc7b155cc4dfdb41c86 (diff) | |
download | gsoc2013-evolution-95cad50c053fda877e2a640d7301c31704b4c889.tar.gz gsoc2013-evolution-95cad50c053fda877e2a640d7301c31704b4c889.tar.zst gsoc2013-evolution-95cad50c053fda877e2a640d7301c31704b4c889.zip |
Use a next pointer so we keep the list intact as we scan it.
2001-08-16 Not Zed <NotZed@Ximian.com>
* ibex_block.c (ibex_use): Use a next pointer so we keep the list
intact as we scan it.
svn path=/trunk/; revision=12049
Diffstat (limited to 'libibex')
-rw-r--r-- | libibex/ChangeLog | 5 | ||||
-rw-r--r-- | libibex/ibex_block.c | 8 | ||||
-rw-r--r-- | libibex/testindex.c | 3 |
3 files changed, 12 insertions, 4 deletions
diff --git a/libibex/ChangeLog b/libibex/ChangeLog index 7691a94e5c..a47320019f 100644 --- a/libibex/ChangeLog +++ b/libibex/ChangeLog @@ -1,3 +1,8 @@ +2001-08-16 Not Zed <NotZed@Ximian.com> + + * ibex_block.c (ibex_use): Use a next pointer so we keep the list + intact as we scan it. + 2001-08-15 Not Zed <NotZed@Ximian.com> * ibex_block.c (ibex_use): New function to limit use of fd's. diff --git a/libibex/ibex_block.c b/libibex/ibex_block.c index ea326949ae..23b225cbc6 100644 --- a/libibex/ibex_block.c +++ b/libibex/ibex_block.c @@ -33,7 +33,7 @@ int ibex_opened; /* count of actually opened ibexe's */ /* TODO: return errors? */ static void ibex_use(ibex *ib) { - ibex *wb; + ibex *wb, *wn; /* always lock list then ibex */ IBEX_LIST_LOCK(ib); @@ -66,8 +66,8 @@ static void ibex_use(ibex *ib) we can't do this first for locking issues */ if (ibex_opened > IBEX_OPEN_THRESHOLD) { wb = (ibex *)ibex_list.head; - while (wb->next) { - wb = wb->next; + wn = wb->next; + while (wn) { IBEX_LOCK(wb); if (wb->usecount == 0 && wb->blocks != NULL) { o(printf("Forcing close of obex '%s', total = %d\n", wb->name, ibex_opened-1)); @@ -80,6 +80,8 @@ static void ibex_use(ibex *ib) break; } IBEX_UNLOCK(wb); + wb = wn; + wn = wn->next; } } diff --git a/libibex/testindex.c b/libibex/testindex.c index acfa892360..064ff1b7ac 100644 --- a/libibex/testindex.c +++ b/libibex/testindex.c @@ -223,7 +223,7 @@ int main(int argc, char **argv) /* random name */ name = words->pdata[word % words->len]; - if (j%1000 == 0) { + if (j%1000 == 0 && j>0) { IBEX_LOCK(ib); word_index_mem_dump_info(ib->words); IBEX_UNLOCK(ib); @@ -284,6 +284,7 @@ int main(int argc, char **argv) ibex_close(ib); ib = ibex_open("test.ibex", O_RDWR|O_CREAT, 0600); + ibex_contains_name(ib, name); IBEX_LOCK(ib); word_index_mem_dump_info(ib->words); IBEX_UNLOCK(ib); |