aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/node/ext
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/node/ext
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/node/ext')
-rw-r--r--src/node/ext/byte_buffer.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/node/ext/byte_buffer.cc b/src/node/ext/byte_buffer.cc
index 01bd92ea52..2c84099069 100644
--- a/src/node/ext/byte_buffer.cc
+++ b/src/node/ext/byte_buffer.cc
@@ -36,6 +36,7 @@
#include <node.h>
#include <nan.h>
#include "grpc/grpc.h"
+#include "grpc/byte_buffer_reader.h"
#include "grpc/support/slice.h"
#include "byte_buffer.h"
@@ -69,9 +70,10 @@ Handle<Value> ByteBufferToBuffer(grpc_byte_buffer *buffer) {
size_t length = grpc_byte_buffer_length(buffer);
char *result = reinterpret_cast<char *>(calloc(length, sizeof(char)));
size_t offset = 0;
- 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 next;
- while (grpc_byte_buffer_reader_next(reader, &next) != 0) {
+ while (grpc_byte_buffer_reader_next(&reader, &next) != 0) {
memcpy(result + offset, GPR_SLICE_START_PTR(next), GPR_SLICE_LENGTH(next));
offset += GPR_SLICE_LENGTH(next);
}