summaryrefslogtreecommitdiffstats
path: root/lib/stream.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/stream.c')
-rw-r--r--lib/stream.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/stream.c b/lib/stream.c
index ccd4623ff..9a6fcbcf2 100644
--- a/lib/stream.c
+++ b/lib/stream.c
@@ -154,6 +154,25 @@ stream_dup (struct stream *s)
return (stream_copy (new, s));
}
+struct stream *
+stream_dupcat (struct stream *s1, struct stream *s2, size_t offset)
+{
+ struct stream *new;
+
+ STREAM_VERIFY_SANE (s1);
+ STREAM_VERIFY_SANE (s2);
+
+ if ( (new = stream_new (s1->endp + s2->endp)) == NULL)
+ return NULL;
+
+ memcpy (new->data, s1->data, offset);
+ memcpy (new->data + offset, s2->data, s2->endp);
+ memcpy (new->data + offset + s2->endp, s1->data + offset,
+ (s1->endp - offset));
+ new->endp = s1->endp + s2->endp;
+ return new;
+}
+
size_t
stream_resize (struct stream *s, size_t newsize)
{