From a3f365d26d8e524da3a6e3eea23d004d593630d5 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Sat, 24 Oct 1998 06:26:37 +0000 Subject: 1998-09-26 Mark Kettenis * 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. --- libshouldbeinlibc/cacheq.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'libshouldbeinlibc') 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 @@ -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. */ -- cgit v1.2.3