]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: ring: remove the now unused ring's offset
authorWilly Tarreau <w@1wt.eu>
Wed, 22 Feb 2023 14:15:41 +0000 (15:15 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 24 Feb 2023 08:26:30 +0000 (09:26 +0100)
Since the previous patch, the ring's offset is not used anymore. The
haring utility remains backward-compatible since it can trust the
buffer element that's at the beginning of the map and which still
contains all the valid data.

include/haproxy/ring-t.h
src/ring.c

index 7e4d5188aa1dbc2ebec26a0a770969faa30ba611..b89c886958fa95d8723076a080bb63ccef9645bf 100644 (file)
@@ -98,7 +98,6 @@
 
 struct ring {
        struct buffer buf;   // storage area
-       size_t ofs;          // absolute offset in history of the buffer's head
        struct list waiters; // list of waiters, for now, CLI "show event"
        __decl_thread(HA_RWLOCK_T lock);
        int readers_count;
index b24669458f87a4586e579f277b5c8d7ea0511339..c3baf88af8899a2d520c884597828edce3708758 100644 (file)
@@ -42,7 +42,6 @@ void ring_init(struct ring *ring, void *area, size_t size)
        HA_RWLOCK_INIT(&ring->lock);
        LIST_INIT(&ring->waiters);
        ring->readers_count = 0;
-       ring->ofs = 0;
        ring->buf = b_make(area, size, 0, 0);
        /* write the initial RC byte */
        b_putchr(&ring->buf, 0);
@@ -221,7 +220,6 @@ ssize_t ring_write(struct ring *ring, size_t maxlen, const struct ist pfx[], siz
                BUG_ON(b_data(buf) < 1 + dellenlen + dellen);
 
                b_del(buf, 1 + dellenlen + dellen);
-               ring->ofs += 1 + dellenlen + dellen;
        }
 
        /* OK now we do have room */