aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/python
diff options
context:
space:
mode:
authorGravatar David Garcia Quintas <dgq@google.com>2015-06-01 21:08:59 -0700
committerGravatar David Garcia Quintas <dgq@google.com>2015-06-01 21:20:47 -0700
commit30bd4eb5cc268c0faa7a7b89f7be0af61598785f (patch)
tree245115eb3876511220c4cb8ebdce465ea90a085e /src/python
parent1b932e77f0b6f99556df03e5147f243d3bce0277 (diff)
Removed grpc_byte_buffer_reader_{create,destroy}.
Introduced grpc_byte_buffer_init instead. It's now the user's responsibility to manage memory.
Diffstat (limited to 'src/python')
-rw-r--r--src/python/src/grpc/_adapter/_c/utility.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/python/src/grpc/_adapter/_c/utility.c b/src/python/src/grpc/_adapter/_c/utility.c
index 6d228c73fe..42d3370cf2 100644
--- a/src/python/src/grpc/_adapter/_c/utility.c
+++ b/src/python/src/grpc/_adapter/_c/utility.c
@@ -36,6 +36,7 @@
#define PY_SSIZE_T_CLEAN
#include <Python.h>
#include <grpc/grpc.h>
+#include <grpc/byte_buffer_reader.h>
#include <grpc/support/alloc.h>
#include <grpc/support/slice.h>
#include <grpc/support/time.h>
@@ -443,18 +444,18 @@ PyObject *pygrpc_cast_metadata_array_to_pylist(grpc_metadata_array metadata) {
void pygrpc_byte_buffer_to_bytes(
grpc_byte_buffer *buffer, char **result, size_t *result_size) {
- grpc_byte_buffer_reader *reader = grpc_byte_buffer_reader_create(buffer);
+ grpc_byte_buffer_reader reader;
+ grpc_byte_buffer_reader_init(&reader, buffer);
gpr_slice slice;
char *read_result = NULL;
size_t size = 0;
- while (grpc_byte_buffer_reader_next(reader, &slice)) {
+ while (grpc_byte_buffer_reader_next(&reader, &slice)) {
read_result = gpr_realloc(read_result, size + GPR_SLICE_LENGTH(slice));
memcpy(read_result + size, GPR_SLICE_START_PTR(slice),
GPR_SLICE_LENGTH(slice));
size = size + GPR_SLICE_LENGTH(slice);
gpr_slice_unref(slice);
}
- grpc_byte_buffer_reader_destroy(reader);
*result_size = size;
*result = read_result;
}