summaryrefslogtreecommitdiff
path: root/lib/stream.c
diff options
context:
space:
mode:
authorDavid Lamparter <equinox@diac24.net>2012-04-16 18:24:40 +0200
committerDavid Lamparter <equinox@diac24.net>2012-04-16 18:24:43 +0200
commitd75318cc8de91d94649106f4ea3122d0d21ac9eb (patch)
tree6d7c674c4026bccd1384e60ee228d8d67750fbf7 /lib/stream.c
parent6e493a44836d3b034ed3421e866878de3fbfcc5b (diff)
parent48d8bea8b7c83cf186460f711ab166455b5ed676 (diff)
isisd: merge osr/google-is-is
this is essentially half of a rewrite of isisd. please note that a lot of things are still broken and isisd is not ready for production use.
Diffstat (limited to 'lib/stream.c')
-rw-r--r--lib/stream.c20
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;
}