summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>1998-10-24 06:26:37 +0000
committerRoland McGrath <roland@gnu.org>1998-10-24 06:26:37 +0000
commita3f365d26d8e524da3a6e3eea23d004d593630d5 (patch)
treec924548467f1f8be4afdb07f0c6104a43767bb18
parentff007752a9b1a91e34f90267578adb31fedef414 (diff)
1998-09-26 Mark Kettenis <kettenis@phys.uva.nl>
* cacheq.c (cacheq_set_length): Fix the limit of the destination entries. Decide that there is no following entry if the current entry is equal or greater than this limit.
-rw-r--r--libshouldbeinlibc/cacheq.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/libshouldbeinlibc/cacheq.c b/libshouldbeinlibc/cacheq.c
index c8b0c989..eb41c6e9 100644
--- a/libshouldbeinlibc/cacheq.c
+++ b/libshouldbeinlibc/cacheq.c
@@ -1,6 +1,6 @@
/* Helper functions for maintaining a fixed-size lru-ordered queue
- Copyright (C) 1996 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1998 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
@@ -82,7 +82,8 @@ cacheq_set_length (struct cacheq *cq, int length)
/* Source entries. */
struct cacheq_hdr *fh = cq->mru;
/* Destination entries (and limit). */
- struct cacheq_hdr *th = new_entries, *end = new_entries + esz * length;
+ struct cacheq_hdr *th = new_entries;
+ struct cacheq_hdr *end = new_entries + esz * (length - 1);
struct cacheq_hdr *prev_th = 0;
if (! new_entries)
@@ -91,7 +92,7 @@ cacheq_set_length (struct cacheq *cq, int length)
while (fh || th)
{
struct cacheq_hdr *next_th =
- (!th || th > end) ? 0 : (void *)th + esz;
+ (!th || th >= end) ? 0 : (void *)th + esz;
if (fh && th)
bcopy (fh, th, esz); /* Copy the bits in a moved entry. */