Skip to content
Browse files

lib: Add stream_resize_orig and stream_resize_inplace

Start setup for handling of stream_resize into old
and new functions.

Create a stream_resize_inplace function that takes
a double pointer to allow for a realloc operation
to return the possibly moved pointer.

Add a CONFDATE for removal as well.

Signed-off-by: Donald Sharp <>
  • Loading branch information...
donaldsharp committed Aug 22, 2018
1 parent dca5ef3 commit 4388866917c8766832346c6fddceb86ec7e34a19
Showing with 14 additions and 2 deletions.
  1. +6 −1 lib/stream.c
  2. +8 −1 lib/stream.h
@@ -166,7 +166,12 @@ struct stream *stream_dupcat(struct stream *s1, struct stream *s2,
return new;

size_t stream_resize(struct stream *s, size_t newsize)
size_t stream_resize_inplace(struct stream **sptr, size_t newsize)
return stream_resize_orig(*sptr, newsize);

size_t stream_resize_orig(struct stream *s, size_t newsize)
uint8_t *newdata;
@@ -154,7 +154,14 @@ extern struct stream *stream_new(size_t);
extern void stream_free(struct stream *);
extern struct stream *stream_copy(struct stream *, struct stream *src);
extern struct stream *stream_dup(struct stream *);
extern size_t stream_resize(struct stream *, size_t);

#if CONFDATE > 20190821
CPP_NOTICE("lib: time to remove stream_resize_orig")
extern size_t stream_resize_orig(struct stream *s, size_t newsize);
#define stream_resize stream_resize_orig
extern size_t stream_resize_inplace(struct stream **sptr, size_t newsize);

extern size_t stream_get_getp(struct stream *);
extern size_t stream_get_endp(struct stream *);
extern size_t stream_get_size(struct stream *);

0 comments on commit 4388866

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.