aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/surface/byte_buffer_reader.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/surface/byte_buffer_reader.c')
-rw-r--r--src/core/surface/byte_buffer_reader.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/core/surface/byte_buffer_reader.c b/src/core/surface/byte_buffer_reader.c
index fd5289bac3..41ad700274 100644
--- a/src/core/surface/byte_buffer_reader.c
+++ b/src/core/surface/byte_buffer_reader.c
@@ -39,15 +39,18 @@
#include <grpc/support/slice_buffer.h>
#include <grpc/byte_buffer.h>
-grpc_byte_buffer_reader *grpc_byte_buffer_reader_create(
- grpc_byte_buffer *buffer) {
- grpc_byte_buffer_reader *reader = malloc(sizeof(grpc_byte_buffer_reader));
+void grpc_byte_buffer_reader_init(grpc_byte_buffer_reader *reader,
+ grpc_byte_buffer *buffer) {
reader->buffer = buffer;
switch (buffer->type) {
case GRPC_BB_SLICE_BUFFER:
reader->current.index = 0;
}
- return reader;
+}
+
+void grpc_byte_buffer_reader_destroy(grpc_byte_buffer_reader *reader) {
+ /* no-op: the user is responsible for memory deallocation.
+ * Other cleanup operations would go here if needed. */
}
int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader *reader,
@@ -68,7 +71,3 @@ int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader *reader,
}
return 0;
}
-
-void grpc_byte_buffer_reader_destroy(grpc_byte_buffer_reader *reader) {
- free(reader);
-}