summaryrefslogtreecommitdiff
path: root/lib/stream.h
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@cumulusnetworks.com>2018-08-21 20:34:42 -0400
committerDonald Sharp <sharpd@cumulusnetworks.com>2018-08-22 07:58:54 -0400
commitde75223eafe083d4d6c82155a6bf8b328f806634 (patch)
treeba9b4be375b69547582f5508f669d0a022db6b4b /lib/stream.h
parentdb3c830afe3017eb2bc6f972e10404547c1a5d69 (diff)
lib: Convert stream_new to use one malloc
Modify stream.c to have stream_new call one malloc call instead of two. Also change stream_resize_orig to use stream_resize_inplace and to send an error to the developer to switch over. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'lib/stream.h')
-rw-r--r--lib/stream.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/stream.h b/lib/stream.h
index e8cd76362e..ef9366e1ae 100644
--- a/lib/stream.h
+++ b/lib/stream.h
@@ -98,14 +98,15 @@
struct stream {
struct stream *next;
- /* Remainder is ***private*** to stream
+ /*
+ * Remainder is ***private*** to stream
* direct access is frowned upon!
* Use the appropriate functions/macros
*/
- size_t getp; /* next get position */
- size_t endp; /* last valid data position */
- size_t size; /* size of data segment */
- unsigned char *data; /* data pointer */
+ size_t getp; /* next get position */
+ size_t endp; /* last valid data position */
+ size_t size; /* size of data segment */
+ unsigned char data[0]; /* data pointer */
};
/* First in first out queue structure. */