diff options
Diffstat (limited to 'lib/stream.c')
-rw-r--r-- | lib/stream.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/lib/stream.c b/lib/stream.c index 983330ff..b226a25e 100644 --- a/lib/stream.c +++ b/lib/stream.c @@ -52,7 +52,7 @@ * using stream_put..._at() functions. */ #define STREAM_WARN_OFFSETS(S) \ - zlog_warn ("&(struct stream): %p, size: %lu, endp: %lu, getp: %lu\n", \ + zlog_warn ("&(struct stream): %p, size: %lu, getp: %lu, endp: %lu\n", \ (S), \ (unsigned long) (S)->size, \ (unsigned long) (S)->getp, \ @@ -214,6 +214,20 @@ stream_set_getp (struct stream *s, size_t pos) s->getp = pos; } +void +stream_set_endp (struct stream *s, size_t pos) +{ + STREAM_VERIFY_SANE(s); + + if (!GETP_VALID (s, pos)) + { + STREAM_BOUND_WARN (s, "set endp"); + pos = s->endp; + } + + s->endp = pos; +} + /* Forward pointer. */ void stream_forward_getp (struct stream *s, size_t size) @@ -934,9 +948,9 @@ stream_fifo_pop (struct stream_fifo *fifo) if (fifo->head == NULL) fifo->tail = NULL; - } - fifo->count--; + fifo->count--; + } return s; } |