diff options
author | 2015-12-09 14:20:38 -0800 | |
---|---|---|
committer | 2015-12-09 14:20:38 -0800 | |
commit | 3ff5d2dd6be6496db1ae45fd957747a5a5c2181b (patch) | |
tree | aaa379c043cbe6fdc36e6107bceddad0fc9e2f78 /src/core | |
parent | a5aa19b8b6c8ce2c2ce9baa8b0108e91b9c330b1 (diff) | |
parent | 3ca448925ba3df03ef872ac127b5e70ccd35c1af (diff) |
Merge branch 'master' of github.com:grpc/grpc into custom_allocs
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/compression/message_compress.c | 14 | ||||
-rw-r--r-- | src/core/surface/channel.c | 9 |
2 files changed, 18 insertions, 5 deletions
diff --git a/src/core/compression/message_compress.c b/src/core/compression/message_compress.c index 209c1f0ff1..a723c47819 100644 --- a/src/core/compression/message_compress.c +++ b/src/core/compression/message_compress.c @@ -91,6 +91,14 @@ error: return 0; } +static void *zalloc_gpr(void* opaque, unsigned int items, unsigned int size) { + return gpr_malloc(items * size); +} + +static void zfree_gpr(void* opaque, void *address) { + gpr_free(address); +} + static int zlib_compress(gpr_slice_buffer* input, gpr_slice_buffer* output, int gzip) { z_stream zs; @@ -99,6 +107,8 @@ static int zlib_compress(gpr_slice_buffer* input, gpr_slice_buffer* output, size_t count_before = output->count; size_t length_before = output->length; memset(&zs, 0, sizeof(zs)); + zs.zalloc = zalloc_gpr; + zs.zfree = zfree_gpr; r = deflateInit2(&zs, Z_DEFAULT_COMPRESSION, Z_DEFLATED, 15 | (gzip ? 16 : 0), 8, Z_DEFAULT_STRATEGY); if (r != Z_OK) { @@ -125,6 +135,8 @@ static int zlib_decompress(gpr_slice_buffer* input, gpr_slice_buffer* output, size_t count_before = output->count; size_t length_before = output->length; memset(&zs, 0, sizeof(zs)); + zs.zalloc = zalloc_gpr; + zs.zfree = zfree_gpr; r = inflateInit2(&zs, 15 | (gzip ? 16 : 0)); if (r != Z_OK) { gpr_log(GPR_ERROR, "inflateInit2 returns %d", r); @@ -150,7 +162,7 @@ static int copy(gpr_slice_buffer* input, gpr_slice_buffer* output) { return 1; } -int compress_inner(grpc_compression_algorithm algorithm, +static int compress_inner(grpc_compression_algorithm algorithm, gpr_slice_buffer* input, gpr_slice_buffer* output) { switch (algorithm) { case GRPC_COMPRESS_NONE: diff --git a/src/core/surface/channel.c b/src/core/surface/channel.c index 859197412b..14fe97c30d 100644 --- a/src/core/surface/channel.c +++ b/src/core/surface/channel.c @@ -113,7 +113,7 @@ grpc_channel *grpc_channel_create_from_filters( } } else if (0 == strcmp(args->args[i].key, GRPC_ARG_DEFAULT_AUTHORITY)) { if (args->args[i].type != GRPC_ARG_STRING) { - gpr_log(GPR_ERROR, "%s: must be an string", + gpr_log(GPR_ERROR, "%s ignored: it must be a string", GRPC_ARG_DEFAULT_AUTHORITY); } else { if (channel->default_authority) { @@ -126,13 +126,14 @@ grpc_channel *grpc_channel_create_from_filters( } else if (0 == strcmp(args->args[i].key, GRPC_SSL_TARGET_NAME_OVERRIDE_ARG)) { if (args->args[i].type != GRPC_ARG_STRING) { - gpr_log(GPR_ERROR, "%s: must be an string", + gpr_log(GPR_ERROR, "%s ignored: it must be a string", GRPC_SSL_TARGET_NAME_OVERRIDE_ARG); } else { if (channel->default_authority) { /* other ways of setting this (notably ssl) take precedence */ - gpr_log(GPR_ERROR, "%s: default host already set some other way", - GRPC_ARG_DEFAULT_AUTHORITY); + gpr_log(GPR_ERROR, + "%s ignored: default host already set some other way", + GRPC_SSL_TARGET_NAME_OVERRIDE_ARG); } else { channel->default_authority = grpc_mdelem_from_strings( ":authority", args->args[i].value.string); |