diff options
author | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2015-03-19 19:21:15 +0100 |
---|---|---|
committer | Nicolas "Pixel" Noble <pixel@nobis-crew.org> | 2015-03-19 19:21:15 +0100 |
commit | f0863b02270f1b95d5c8b9f3f962959e4cbbdd42 (patch) | |
tree | e8a441a621d0addfa82a8fc3052080e78a012a2a /src/core/channel/metadata_buffer.c | |
parent | f358573091ef9c14c39ea56d9d9883410a533992 (diff) | |
parent | 43c5fe6825098b127e33159d3cf14ac937ce7db5 (diff) |
Merge branch 'master' of github.com:google/grpc into freebsd
Conflicts:
Makefile
templates/Makefile.template
Diffstat (limited to 'src/core/channel/metadata_buffer.c')
-rw-r--r-- | src/core/channel/metadata_buffer.c | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/src/core/channel/metadata_buffer.c b/src/core/channel/metadata_buffer.c index da66a028c4..eac852e4a4 100644 --- a/src/core/channel/metadata_buffer.c +++ b/src/core/channel/metadata_buffer.c @@ -147,54 +147,3 @@ void grpc_metadata_buffer_flush(grpc_metadata_buffer *buffer, gpr_free(impl); *buffer = NULL; } - -size_t grpc_metadata_buffer_count(const grpc_metadata_buffer *buffer) { - return *buffer ? (*buffer)->elems : 0; -} - -typedef struct { - grpc_metadata_buffer_impl *impl; -} elems_hdr; - -grpc_metadata *grpc_metadata_buffer_extract_elements( - grpc_metadata_buffer *buffer) { - grpc_metadata_buffer_impl *impl; - elems_hdr *hdr; - qelem *src; - grpc_metadata *out; - size_t i; - - impl = *buffer; - - if (!impl) { - return NULL; - } - - hdr = gpr_malloc(sizeof(elems_hdr) + impl->elems * sizeof(grpc_metadata)); - src = ELEMS(impl); - out = (grpc_metadata *)(hdr + 1); - - hdr->impl = impl; - for (i = 0; i < impl->elems; i++) { - out[i].key = (char *)grpc_mdstr_as_c_string(src[i].md->key); - out[i].value = (char *)grpc_mdstr_as_c_string(src[i].md->value); - out[i].value_length = GPR_SLICE_LENGTH(src[i].md->value->slice); - } - - /* clear out buffer (it's not possible to extract elements twice */ - *buffer = NULL; - - return out; -} - -void grpc_metadata_buffer_cleanup_elements(void *elements, - grpc_op_error error) { - elems_hdr *hdr = ((elems_hdr *)elements) - 1; - - if (!elements) { - return; - } - - grpc_metadata_buffer_destroy(&hdr->impl, error); - gpr_free(hdr); -} |