aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-11-08 08:53:07 -0800
committerGravatar GitHub <noreply@github.com>2016-11-08 08:53:07 -0800
commitf9b87301aada7bd80f8487bb0527bfb4c0eaa034 (patch)
treeecaa2cb812eed477d3197452d318f1621bcc4c3a
parent43ec556ea7f0e4321bbeb6602374d8a0bf1b0327 (diff)
parent328cbccfee580beac05bedaf6690351a659a2155 (diff)
Merge pull request #8532 from ctiller/grpc_slice
Rename gpr_slice --> grpc_slice
-rw-r--r--BUILD44
-rw-r--r--CMakeLists.txt23
-rw-r--r--Makefile297
-rw-r--r--binding.gyp7
-rw-r--r--build.yaml86
-rw-r--r--config.m48
-rw-r--r--gRPC-Core.podspec17
-rw-r--r--grpc.def58
-rwxr-xr-xgrpc.gemspec14
-rw-r--r--include/grpc++/impl/codegen/core_codegen.h14
-rw-r--r--include/grpc++/impl/codegen/core_codegen_interface.h15
-rw-r--r--include/grpc++/impl/codegen/proto_utils.h46
-rw-r--r--include/grpc++/impl/codegen/thrift_serializer.h12
-rw-r--r--include/grpc++/support/slice.h20
-rw-r--r--include/grpc/byte_buffer.h12
-rw-r--r--include/grpc/grpc.h2
-rw-r--r--include/grpc/impl/codegen/gpr_types.h65
-rw-r--r--include/grpc/impl/codegen/grpc_types.h3
-rw-r--r--include/grpc/impl/codegen/slice.h78
-rw-r--r--include/grpc/slice.h (renamed from include/grpc/support/slice.h)60
-rw-r--r--include/grpc/slice_buffer.h (renamed from include/grpc/support/slice_buffer.h)44
-rw-r--r--package.xml14
-rw-r--r--src/core/ext/census/grpc_filter.c4
-rw-r--r--src/core/ext/census/trace_context.h2
-rw-r--r--src/core/ext/client_channel/connector.h2
-rw-r--r--src/core/ext/client_channel/default_initial_connect_string.c4
-rw-r--r--src/core/ext/client_channel/http_connect_handshaker.c42
-rw-r--r--src/core/ext/client_channel/initial_connect_string.c4
-rw-r--r--src/core/ext/client_channel/initial_connect_string.h8
-rw-r--r--src/core/ext/client_channel/subchannel.c4
-rw-r--r--src/core/ext/client_channel/uri_parser.c35
-rw-r--r--src/core/ext/lb_policy/grpclb/grpclb.c13
-rw-r--r--src/core/ext/lb_policy/grpclb/load_balancer_api.c20
-rw-r--r--src/core/ext/lb_policy/grpclb/load_balancer_api.h8
-rw-r--r--src/core/ext/resolver/sockaddr/sockaddr_resolver.c17
-rw-r--r--src/core/ext/transport/chttp2/client/insecure/channel_create.c16
-rw-r--r--src/core/ext/transport/chttp2/client/secure/secure_channel_create.c16
-rw-r--r--src/core/ext/transport/chttp2/server/insecure/server_chttp2.c2
-rw-r--r--src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c2
-rw-r--r--src/core/ext/transport/chttp2/transport/bin_decoder.c55
-rw-r--r--src/core/ext/transport/chttp2/transport/bin_decoder.h8
-rw-r--r--src/core/ext/transport/chttp2/transport/bin_encoder.c47
-rw-r--r--src/core/ext/transport/chttp2/transport/bin_encoder.h15
-rw-r--r--src/core/ext/transport/chttp2/transport/chttp2_transport.c117
-rw-r--r--src/core/ext/transport/chttp2/transport/chttp2_transport.h2
-rw-r--r--src/core/ext/transport/chttp2/transport/frame.h2
-rw-r--r--src/core/ext/transport/chttp2/transport/frame_data.c33
-rw-r--r--src/core/ext/transport/chttp2/transport/frame_data.h10
-rw-r--r--src/core/ext/transport/chttp2/transport/frame_goaway.c26
-rw-r--r--src/core/ext/transport/chttp2/transport/frame_goaway.h10
-rw-r--r--src/core/ext/transport/chttp2/transport/frame_ping.c16
-rw-r--r--src/core/ext/transport/chttp2/transport/frame_ping.h6
-rw-r--r--src/core/ext/transport/chttp2/transport/frame_rst_stream.c16
-rw-r--r--src/core/ext/transport/chttp2/transport/frame_rst_stream.h8
-rw-r--r--src/core/ext/transport/chttp2/transport/frame_settings.c28
-rw-r--r--src/core/ext/transport/chttp2/transport/frame_settings.h10
-rw-r--r--src/core/ext/transport/chttp2/transport/frame_window_update.c12
-rw-r--r--src/core/ext/transport/chttp2/transport/frame_window_update.h8
-rw-r--r--src/core/ext/transport/chttp2/transport/hpack_encoder.c65
-rw-r--r--src/core/ext/transport/chttp2/transport/hpack_encoder.h6
-rw-r--r--src/core/ext/transport/chttp2/transport/hpack_parser.c14
-rw-r--r--src/core/ext/transport/chttp2/transport/hpack_parser.h2
-rw-r--r--src/core/ext/transport/chttp2/transport/hpack_table.c8
-rw-r--r--src/core/ext/transport/chttp2/transport/hpack_table.h2
-rw-r--r--src/core/ext/transport/chttp2/transport/internal.h29
-rw-r--r--src/core/ext/transport/chttp2/transport/parsing.c36
-rw-r--r--src/core/ext/transport/chttp2/transport/writing.c24
-rw-r--r--src/core/ext/transport/cronet/transport/cronet_transport.c34
-rw-r--r--src/core/lib/channel/channel_stack.c4
-rw-r--r--src/core/lib/channel/channel_stack.h4
-rw-r--r--src/core/lib/channel/compress_filter.c24
-rw-r--r--src/core/lib/channel/connected_channel.c2
-rw-r--r--src/core/lib/channel/deadline_filter.c4
-rw-r--r--src/core/lib/channel/handshaker.c10
-rw-r--r--src/core/lib/channel/handshaker.h6
-rw-r--r--src/core/lib/channel/http_client_filter.c22
-rw-r--r--src/core/lib/channel/http_server_filter.c10
-rw-r--r--src/core/lib/channel/message_size_filter.c2
-rw-r--r--src/core/lib/compression/message_compress.c50
-rw-r--r--src/core/lib/compression/message_compress.h6
-rw-r--r--src/core/lib/http/format_request.c19
-rw-r--r--src/core/lib/http/format_request.h12
-rw-r--r--src/core/lib/http/httpcli.c24
-rw-r--r--src/core/lib/http/httpcli_security_connector.c2
-rw-r--r--src/core/lib/http/parser.c6
-rw-r--r--src/core/lib/http/parser.h4
-rw-r--r--src/core/lib/iomgr/endpoint.c4
-rw-r--r--src/core/lib/iomgr/endpoint.h12
-rw-r--r--src/core/lib/iomgr/load_file.c6
-rw-r--r--src/core/lib/iomgr/load_file.h4
-rw-r--r--src/core/lib/iomgr/resource_quota.c20
-rw-r--r--src/core/lib/iomgr/resource_quota.h10
-rw-r--r--src/core/lib/iomgr/tcp_client_windows.c2
-rw-r--r--src/core/lib/iomgr/tcp_posix.c55
-rw-r--r--src/core/lib/iomgr/tcp_uv.c28
-rw-r--r--src/core/lib/iomgr/tcp_windows.c34
-rw-r--r--src/core/lib/security/credentials/credentials.h6
-rw-r--r--src/core/lib/security/credentials/credentials_metadata.c14
-rw-r--r--src/core/lib/security/credentials/google_default/google_default_credentials.c9
-rw-r--r--src/core/lib/security/credentials/jwt/json_token.h2
-rw-r--r--src/core/lib/security/credentials/jwt/jwt_verifier.c62
-rw-r--r--src/core/lib/security/credentials/jwt/jwt_verifier.h4
-rw-r--r--src/core/lib/security/credentials/plugin/plugin_credentials.c8
-rw-r--r--src/core/lib/security/transport/client_auth_filter.c6
-rw-r--r--src/core/lib/security/transport/handshake.c46
-rw-r--r--src/core/lib/security/transport/handshake.h2
-rw-r--r--src/core/lib/security/transport/secure_endpoint.c119
-rw-r--r--src/core/lib/security/transport/secure_endpoint.h4
-rw-r--r--src/core/lib/security/transport/security_connector.c32
-rw-r--r--src/core/lib/security/transport/security_connector.h10
-rw-r--r--src/core/lib/security/transport/server_auth_filter.c18
-rw-r--r--src/core/lib/security/util/b64.c14
-rw-r--r--src/core/lib/security/util/b64.h8
-rw-r--r--src/core/lib/slice/percent_encoding.c (renamed from src/core/lib/support/percent_encoding.c)58
-rw-r--r--src/core/lib/slice/percent_encoding.h (renamed from src/core/lib/support/percent_encoding.h)28
-rw-r--r--src/core/lib/slice/slice.c (renamed from src/core/lib/support/slice.c)96
-rw-r--r--src/core/lib/slice/slice_buffer.c (renamed from src/core/lib/support/slice_buffer.c)122
-rw-r--r--src/core/lib/slice/slice_string_helpers.c89
-rw-r--r--src/core/lib/slice/slice_string_helpers.h58
-rw-r--r--src/core/lib/support/env.h2
-rw-r--r--src/core/lib/support/string.c49
-rw-r--r--src/core/lib/support/string.h11
-rw-r--r--src/core/lib/support/tmpfile.h2
-rw-r--r--src/core/lib/surface/byte_buffer.c19
-rw-r--r--src/core/lib/surface/byte_buffer_reader.c28
-rw-r--r--src/core/lib/surface/call.c41
-rw-r--r--src/core/lib/surface/server.c10
-rw-r--r--src/core/lib/transport/byte_stream.c8
-rw-r--r--src/core/lib/transport/byte_stream.h10
-rw-r--r--src/core/lib/transport/metadata.c50
-rw-r--r--src/core/lib/transport/metadata.h16
-rw-r--r--src/core/lib/transport/metadata_batch.h2
-rw-r--r--src/core/lib/transport/transport.c17
-rw-r--r--src/core/lib/transport/transport.h8
-rw-r--r--src/core/lib/transport/transport_op_string.c11
-rw-r--r--src/cpp/client/channel_cc.cc2
-rw-r--r--src/cpp/common/core_codegen.cc29
-rw-r--r--src/cpp/util/byte_buffer_cc.cc14
-rw-r--r--src/cpp/util/slice_cc.cc8
-rw-r--r--src/csharp/ext/grpc_csharp_ext.c16
-rw-r--r--src/node/ext/byte_buffer.cc14
-rw-r--r--src/objective-c/GRPCClient/private/NSData+GRPC.m16
-rw-r--r--src/php/ext/grpc/byte_buffer.c14
-rw-r--r--src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi26
-rw-r--r--src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi14
-rw-r--r--src/python/grpcio/grpc_core_dependencies.py7
-rw-r--r--src/ruby/ext/grpc/rb_byte_buffer.c14
-rw-r--r--src/ruby/ext/grpc/rb_grpc_imports.generated.c116
-rw-r--r--src/ruby/ext/grpc/rb_grpc_imports.generated.h186
-rw-r--r--test/core/bad_client/bad_client.c18
-rw-r--r--test/core/bad_client/bad_client.h2
-rw-r--r--test/core/bad_client/tests/large_metadata.c18
-rw-r--r--test/core/bad_ssl/servers/cert.c10
-rw-r--r--test/core/client_channel/set_initial_connect_string_test.c31
-rw-r--r--test/core/compression/message_compress_test.c158
-rw-r--r--test/core/end2end/bad_server_response_test.c29
-rw-r--r--test/core/end2end/cq_verifier.c33
-rw-r--r--test/core/end2end/cq_verifier.h2
-rw-r--r--test/core/end2end/dualstack_socket_test.c18
-rw-r--r--test/core/end2end/fake_resolver.c17
-rw-r--r--test/core/end2end/fixtures/http_proxy.c78
-rw-r--r--test/core/end2end/fuzzers/api_fuzzer.c6
-rw-r--r--test/core/end2end/fuzzers/client_fuzzer.c4
-rw-r--r--test/core/end2end/fuzzers/server_fuzzer.c4
-rw-r--r--test/core/end2end/invalid_call_argument_test.c3
-rw-r--r--test/core/end2end/tests/binary_metadata.c6
-rw-r--r--test/core/end2end/tests/call_creds.c9
-rw-r--r--test/core/end2end/tests/cancel_after_accept.c6
-rw-r--r--test/core/end2end/tests/cancel_after_client_done.c6
-rw-r--r--test/core/end2end/tests/cancel_after_invoke.c3
-rw-r--r--test/core/end2end/tests/cancel_before_invoke.c3
-rw-r--r--test/core/end2end/tests/compressed_payload.c17
-rw-r--r--test/core/end2end/tests/filter_call_init_fails.c3
-rw-r--r--test/core/end2end/tests/filter_causes_close.c7
-rw-r--r--test/core/end2end/tests/invoke_large_request.c14
-rw-r--r--test/core/end2end/tests/large_metadata.c3
-rw-r--r--test/core/end2end/tests/load_reporting_hook.c5
-rw-r--r--test/core/end2end/tests/max_message_length.c7
-rw-r--r--test/core/end2end/tests/network_status_change.c3
-rw-r--r--test/core/end2end/tests/payload.c11
-rw-r--r--test/core/end2end/tests/ping_pong_streaming.c10
-rw-r--r--test/core/end2end/tests/request_with_flags.c3
-rw-r--r--test/core/end2end/tests/request_with_payload.c3
-rw-r--r--test/core/end2end/tests/resource_quota_server.c11
-rw-r--r--test/core/end2end/tests/simple_cacheable_request.c6
-rw-r--r--test/core/end2end/tests/simple_metadata.c6
-rw-r--r--test/core/end2end/tests/streaming_error_response.c4
-rw-r--r--test/core/end2end/tests/trailing_metadata.c6
-rw-r--r--test/core/fling/client.c4
-rw-r--r--test/core/handshake/client_ssl.c14
-rw-r--r--test/core/handshake/server_ssl.c14
-rw-r--r--test/core/http/format_request_test.c74
-rw-r--r--test/core/http/parser_test.c32
-rw-r--r--test/core/http/request_fuzzer.c4
-rw-r--r--test/core/http/response_fuzzer.c4
-rw-r--r--test/core/internal_api_canaries/transport.c2
-rw-r--r--test/core/iomgr/endpoint_tests.c52
-rw-r--r--test/core/iomgr/load_file_test.c46
-rw-r--r--test/core/iomgr/resource_quota_test.c12
-rw-r--r--test/core/iomgr/tcp_posix_test.c48
-rw-r--r--test/core/nanopb/fuzzer_response.c4
-rw-r--r--test/core/nanopb/fuzzer_serverlist.c4
-rw-r--r--test/core/security/b64_test.c70
-rw-r--r--test/core/security/create_jwt.c8
-rw-r--r--test/core/security/credentials_test.c45
-rw-r--r--test/core/security/fetch_oauth2.c6
-rw-r--r--test/core/security/json_token_test.c28
-rw-r--r--test/core/security/jwt_verifier_test.c30
-rw-r--r--test/core/security/oauth2_utils.c12
-rw-r--r--test/core/security/print_google_default_creds_token.c5
-rw-r--r--test/core/security/secure_endpoint_test.c34
-rw-r--r--test/core/security/security_connector_test.c17
-rw-r--r--test/core/security/verify_jwt.c2
-rw-r--r--test/core/slice/percent_decode_corpus/04cb8ccc553f9b2f5e52c421aff6d1c954d3dae6 (renamed from test/core/support/percent_decode_corpus/04cb8ccc553f9b2f5e52c421aff6d1c954d3dae6)0
-rw-r--r--test/core/slice/percent_decode_corpus/0dd8f3a63745b3a2d39791559b5c1b311447b537 (renamed from test/core/support/percent_decode_corpus/0dd8f3a63745b3a2d39791559b5c1b311447b537)0
-rw-r--r--test/core/slice/percent_decode_corpus/17eeaca784409adbe43365c32ac87915d736bba3 (renamed from test/core/support/percent_decode_corpus/17eeaca784409adbe43365c32ac87915d736bba3)0
-rw-r--r--test/core/slice/percent_decode_corpus/2040c1ff65f52a7ae668c2c8f324de5dacc9d695 (renamed from test/core/support/percent_decode_corpus/2040c1ff65f52a7ae668c2c8f324de5dacc9d695)0
-rw-r--r--test/core/slice/percent_decode_corpus/26b0d1da23027ae54db96e125e4a9e98842d77fb (renamed from test/core/support/percent_decode_corpus/26b0d1da23027ae54db96e125e4a9e98842d77fb)0
-rw-r--r--test/core/slice/percent_decode_corpus/2a089c0db45acdb4c6ed8e7ff81ca7235792c0b9 (renamed from test/core/support/percent_decode_corpus/2a089c0db45acdb4c6ed8e7ff81ca7235792c0b9)0
-rw-r--r--test/core/slice/percent_decode_corpus/35b7b3bc3a740d5c3abca0d75b53f0e1e1ee998a (renamed from test/core/support/percent_decode_corpus/35b7b3bc3a740d5c3abca0d75b53f0e1e1ee998a)0
-rw-r--r--test/core/slice/percent_decode_corpus/36367ba1adba47a1cbc3a88707fde8cc7abdc248 (renamed from test/core/support/percent_decode_corpus/36367ba1adba47a1cbc3a88707fde8cc7abdc248)0
-rw-r--r--test/core/slice/percent_decode_corpus/39c2ba51548a0beaf0d6d1164531f1447dc311b5 (renamed from test/core/support/percent_decode_corpus/39c2ba51548a0beaf0d6d1164531f1447dc311b5)0
-rw-r--r--test/core/slice/percent_decode_corpus/56d08fea787c041395c6697ce26cfbc0decbe688 (renamed from test/core/support/percent_decode_corpus/56d08fea787c041395c6697ce26cfbc0decbe688)0
-rw-r--r--test/core/slice/percent_decode_corpus/678d981fdabb9f0d6640235cf1719dd1e1e66ae9 (renamed from test/core/support/percent_decode_corpus/678d981fdabb9f0d6640235cf1719dd1e1e66ae9)0
-rw-r--r--test/core/slice/percent_decode_corpus/68751961609ec010565de0aa87521dcbf0722c5d (renamed from test/core/support/percent_decode_corpus/68751961609ec010565de0aa87521dcbf0722c5d)0
-rw-r--r--test/core/slice/percent_decode_corpus/7875c06c6f03c9aa2f8e9c59f8d8957c8a32e759 (renamed from test/core/support/percent_decode_corpus/7875c06c6f03c9aa2f8e9c59f8d8957c8a32e759)0
-rw-r--r--test/core/slice/percent_decode_corpus/7b302090e090a5829b6d1dd7be30bd4e36a7e60f (renamed from test/core/support/percent_decode_corpus/7b302090e090a5829b6d1dd7be30bd4e36a7e60f)0
-rw-r--r--test/core/slice/percent_decode_corpus/875e1022169c9e4c541a9ad894e69e989df22ba1 (renamed from test/core/support/percent_decode_corpus/875e1022169c9e4c541a9ad894e69e989df22ba1)0
-rw-r--r--test/core/slice/percent_decode_corpus/8c1051ce066f5a26de9a9d133180621d0da957b4 (renamed from test/core/support/percent_decode_corpus/8c1051ce066f5a26de9a9d133180621d0da957b4)0
-rw-r--r--test/core/slice/percent_decode_corpus/8e084e628ab83a18ac7ca7cb3506525263655c63 (renamed from test/core/support/percent_decode_corpus/8e084e628ab83a18ac7ca7cb3506525263655c63)0
-rw-r--r--test/core/slice/percent_decode_corpus/9d316c4675f40ddccaf8f1cc7aea94170b1e4223 (renamed from test/core/support/percent_decode_corpus/9d316c4675f40ddccaf8f1cc7aea94170b1e4223)0
-rw-r--r--test/core/slice/percent_decode_corpus/ad1c7c11d18a7d116e2c2ef4d4c5afb1270836ae (renamed from test/core/support/percent_decode_corpus/ad1c7c11d18a7d116e2c2ef4d4c5afb1270836ae)0
-rw-r--r--test/core/slice/percent_decode_corpus/b471f94aa4facf502e622e4a248f1ba4063ae681 (renamed from test/core/support/percent_decode_corpus/b471f94aa4facf502e622e4a248f1ba4063ae681)0
-rw-r--r--test/core/slice/percent_decode_corpus/bf52ece030f16136d46e0dc97f58d60a0d8a1f0b (renamed from test/core/support/percent_decode_corpus/bf52ece030f16136d46e0dc97f58d60a0d8a1f0b)0
-rw-r--r--test/core/slice/percent_decode_corpus/d5b2a7177339ba2b7ce2f60e5f4459bef1e72758 (renamed from test/core/support/percent_decode_corpus/d5b2a7177339ba2b7ce2f60e5f4459bef1e72758)0
-rw-r--r--test/core/slice/percent_decode_corpus/de867b64c54a7ed773dc611fc5cd2f17c5433113 (renamed from test/core/support/percent_decode_corpus/de867b64c54a7ed773dc611fc5cd2f17c5433113)0
-rw-r--r--test/core/slice/percent_decode_corpus/e3948dbe004950591630dd5c52f4e0fcbd5e388a (renamed from test/core/support/percent_decode_corpus/e3948dbe004950591630dd5c52f4e0fcbd5e388a)0
-rw-r--r--test/core/slice/percent_decode_corpus/e7064f0b80f61dbc65915311032d27baa569ae2a (renamed from test/core/support/percent_decode_corpus/e7064f0b80f61dbc65915311032d27baa569ae2a)0
-rw-r--r--test/core/slice/percent_decode_corpus/xyz (renamed from test/core/support/percent_decode_corpus/xyz)0
-rw-r--r--test/core/slice/percent_decode_fuzzer.c (renamed from test/core/support/percent_decode_fuzzer.c)22
-rw-r--r--test/core/slice/percent_encode_corpus/0d3ee7fa54e6c66103965fd4409b044ba7db6c3f (renamed from test/core/support/percent_encode_corpus/0d3ee7fa54e6c66103965fd4409b044ba7db6c3f)0
-rw-r--r--test/core/slice/percent_encode_corpus/2e7ccf75e27b9501e3b28cf1c50ed0c45ab7c226 (renamed from test/core/support/percent_encode_corpus/2e7ccf75e27b9501e3b28cf1c50ed0c45ab7c226)0
-rw-r--r--test/core/slice/percent_encode_corpus/55bb859f3942c462b03b7cbcf22ab4a0ac9705cf (renamed from test/core/support/percent_encode_corpus/55bb859f3942c462b03b7cbcf22ab4a0ac9705cf)0
-rw-r--r--test/core/slice/percent_encode_corpus/56070cecd54c845b6d4334953b17b712eb000d93 (renamed from test/core/support/percent_encode_corpus/56070cecd54c845b6d4334953b17b712eb000d93)0
-rw-r--r--test/core/slice/percent_encode_corpus/61f50e891bf7ff5eb7a7af206f1e25d77f8756e7 (renamed from test/core/support/percent_encode_corpus/61f50e891bf7ff5eb7a7af206f1e25d77f8756e7)0
-rw-r--r--test/core/slice/percent_encode_corpus/6e0c60cefc704c7940e475a87dd9ae423061cb5a (renamed from test/core/support/percent_encode_corpus/6e0c60cefc704c7940e475a87dd9ae423061cb5a)0
-rw-r--r--test/core/slice/percent_encode_corpus/7271ebcc6d22a0f186f7bc3c1973a7ed1bec8d8e (renamed from test/core/support/percent_encode_corpus/7271ebcc6d22a0f186f7bc3c1973a7ed1bec8d8e)0
-rw-r--r--test/core/slice/percent_encode_corpus/74c83ece3e2920a67593a9be9c82468f16cbb969 (renamed from test/core/support/percent_encode_corpus/74c83ece3e2920a67593a9be9c82468f16cbb969)0
-rw-r--r--test/core/slice/percent_encode_corpus/98e004fd2a9f141a7a019720820080e12d637c06 (renamed from test/core/support/percent_encode_corpus/98e004fd2a9f141a7a019720820080e12d637c06)0
-rw-r--r--test/core/slice/percent_encode_corpus/ba2c1e98227aa21ea3bb2ca4d0e504119717da8b (renamed from test/core/support/percent_encode_corpus/ba2c1e98227aa21ea3bb2ca4d0e504119717da8b)0
-rw-r--r--test/core/slice/percent_encode_corpus/c16b9fd45370d4afb5d3ebd307a6e263c25ffd45 (renamed from test/core/support/percent_encode_corpus/c16b9fd45370d4afb5d3ebd307a6e263c25ffd45)0
-rw-r--r--test/core/slice/percent_encode_corpus/d58c3cd4eab9b6d2343abfa1c25c90a383fe0ec3 (renamed from test/core/support/percent_encode_corpus/d58c3cd4eab9b6d2343abfa1c25c90a383fe0ec3)0
-rw-r--r--test/core/slice/percent_encode_corpus/e2619218ede30d2b7b8ecd601a9f0ae754b728b4 (renamed from test/core/support/percent_encode_corpus/e2619218ede30d2b7b8ecd601a9f0ae754b728b4)0
-rw-r--r--test/core/slice/percent_encode_corpus/f93b3653e453f0e3eea3198001be6ce46e64bd21 (renamed from test/core/support/percent_encode_corpus/f93b3653e453f0e3eea3198001be6ce46e64bd21)0
-rw-r--r--test/core/slice/percent_encode_corpus/fd41d029c7682ad3d1c40a9fd017a4c85b673a54 (renamed from test/core/support/percent_encode_corpus/fd41d029c7682ad3d1c40a9fd017a4c85b673a54)0
-rw-r--r--test/core/slice/percent_encode_corpus/xyz (renamed from test/core/support/percent_encode_corpus/xyz)0
-rw-r--r--test/core/slice/percent_encode_fuzzer.c (renamed from test/core/support/percent_encode_fuzzer.c)30
-rw-r--r--test/core/slice/percent_encoding_test.c (renamed from test/core/support/percent_encoding_test.c)101
-rw-r--r--test/core/slice/slice_buffer_test.c (renamed from test/core/support/slice_buffer_test.c)64
-rw-r--r--test/core/slice/slice_string_helpers_test.c150
-rw-r--r--test/core/slice/slice_test.c (renamed from test/core/support/slice_test.c)121
-rw-r--r--test/core/support/string_test.c96
-rw-r--r--test/core/surface/byte_buffer_reader_test.c136
-rw-r--r--test/core/surface/public_headers_must_be_c89.c4
-rw-r--r--test/core/transport/chttp2/bin_decoder_test.c45
-rw-r--r--test/core/transport/chttp2/bin_encoder_test.c59
-rw-r--r--test/core/transport/chttp2/hpack_encoder_test.c27
-rw-r--r--test/core/transport/chttp2/hpack_parser_test.c18
-rw-r--r--test/core/transport/chttp2/hpack_table_test.c2
-rw-r--r--test/core/transport/chttp2/varint_test.c17
-rw-r--r--test/core/transport/metadata_test.c40
-rw-r--r--test/core/util/mock_endpoint.c24
-rw-r--r--test/core/util/mock_endpoint.h5
-rw-r--r--test/core/util/one_corpus_entry_fuzzer.c7
-rw-r--r--test/core/util/parse_hexstring.c8
-rw-r--r--test/core/util/parse_hexstring.h4
-rw-r--r--test/core/util/passthru_endpoint.c20
-rw-r--r--test/core/util/slice_splitter.c56
-rw-r--r--test/core/util/slice_splitter.h18
-rw-r--r--test/cpp/grpclb/grpclb_api_test.cc18
-rw-r--r--test/cpp/grpclb/grpclb_test.cc25
-rw-r--r--test/cpp/qps/client.h2
-rw-r--r--test/cpp/qps/server_async.cc2
-rw-r--r--test/cpp/util/byte_buffer_proto_helper.cc2
-rw-r--r--test/cpp/util/byte_buffer_test.cc28
-rw-r--r--test/cpp/util/cli_call.cc4
-rw-r--r--test/cpp/util/slice_test.cc18
-rw-r--r--tools/codegen/core/gen_percent_encoding_tables.c4
-rw-r--r--tools/doxygen/Doxyfile.core4
-rw-r--r--tools/doxygen/Doxyfile.core.internal14
-rw-r--r--tools/fuzzer/runners/percent_decode_fuzzer.sh2
-rw-r--r--tools/fuzzer/runners/percent_encode_fuzzer.sh2
-rw-r--r--tools/run_tests/sources_and_headers.json142
-rw-r--r--tools/run_tests/tests.json238
-rw-r--r--vsprojects/buildtests_c.sln183
-rw-r--r--vsprojects/vcxproj/gpr/gpr.vcxproj9
-rw-r--r--vsprojects/vcxproj/gpr/gpr.vcxproj.filters18
-rw-r--r--vsprojects/vcxproj/grpc/grpc.vcxproj12
-rw-r--r--vsprojects/vcxproj/grpc/grpc.vcxproj.filters27
-rw-r--r--vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj12
-rw-r--r--vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters27
-rw-r--r--vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj12
-rw-r--r--vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters27
-rw-r--r--vsprojects/vcxproj/test/percent_encoding_test/percent_encoding_test.vcxproj (renamed from vsprojects/vcxproj/test/gpr_percent_encoding_test/gpr_percent_encoding_test.vcxproj)14
-rw-r--r--vsprojects/vcxproj/test/percent_encoding_test/percent_encoding_test.vcxproj.filters (renamed from vsprojects/vcxproj/test/gpr_slice_buffer_test/gpr_slice_buffer_test.vcxproj.filters)12
-rw-r--r--vsprojects/vcxproj/test/slice_buffer_test/slice_buffer_test.vcxproj (renamed from vsprojects/vcxproj/test/gpr_slice_test/gpr_slice_test.vcxproj)14
-rw-r--r--vsprojects/vcxproj/test/slice_buffer_test/slice_buffer_test.vcxproj.filters (renamed from vsprojects/vcxproj/test/gpr_percent_encoding_test/gpr_percent_encoding_test.vcxproj.filters)12
-rw-r--r--vsprojects/vcxproj/test/slice_string_helpers_test/slice_string_helpers_test.vcxproj199
-rw-r--r--vsprojects/vcxproj/test/slice_string_helpers_test/slice_string_helpers_test.vcxproj.filters21
-rw-r--r--vsprojects/vcxproj/test/slice_test/slice_test.vcxproj (renamed from vsprojects/vcxproj/test/gpr_slice_buffer_test/gpr_slice_buffer_test.vcxproj)14
-rw-r--r--vsprojects/vcxproj/test/slice_test/slice_test.vcxproj.filters (renamed from vsprojects/vcxproj/test/gpr_slice_test/gpr_slice_test.vcxproj.filters)12
311 files changed, 3926 insertions, 3180 deletions
diff --git a/BUILD b/BUILD
index 8690052bc4..894c7b2c6d 100644
--- a/BUILD
+++ b/BUILD
@@ -53,7 +53,6 @@ cc_library(
"src/core/lib/support/env.h",
"src/core/lib/support/mpscq.h",
"src/core/lib/support/murmur_hash.h",
- "src/core/lib/support/percent_encoding.h",
"src/core/lib/support/stack_lockfree.h",
"src/core/lib/support/string.h",
"src/core/lib/support/string_windows.h",
@@ -82,9 +81,6 @@ cc_library(
"src/core/lib/support/log_windows.c",
"src/core/lib/support/mpscq.c",
"src/core/lib/support/murmur_hash.c",
- "src/core/lib/support/percent_encoding.c",
- "src/core/lib/support/slice.c",
- "src/core/lib/support/slice_buffer.c",
"src/core/lib/support/stack_lockfree.c",
"src/core/lib/support/string.c",
"src/core/lib/support/string_posix.c",
@@ -122,8 +118,6 @@ cc_library(
"include/grpc/support/log.h",
"include/grpc/support/log_windows.h",
"include/grpc/support/port_platform.h",
- "include/grpc/support/slice.h",
- "include/grpc/support/slice_buffer.h",
"include/grpc/support/string_util.h",
"include/grpc/support/subprocess.h",
"include/grpc/support/sync.h",
@@ -235,6 +229,8 @@ cc_library(
"src/core/lib/json/json_common.h",
"src/core/lib/json/json_reader.h",
"src/core/lib/json/json_writer.h",
+ "src/core/lib/slice/percent_encoding.h",
+ "src/core/lib/slice/slice_string_helpers.h",
"src/core/lib/surface/api_trace.h",
"src/core/lib/surface/call.h",
"src/core/lib/surface/call_test_only.h",
@@ -413,6 +409,10 @@ cc_library(
"src/core/lib/json/json_reader.c",
"src/core/lib/json/json_string.c",
"src/core/lib/json/json_writer.c",
+ "src/core/lib/slice/percent_encoding.c",
+ "src/core/lib/slice/slice.c",
+ "src/core/lib/slice/slice_buffer.c",
+ "src/core/lib/slice/slice_string_helpers.c",
"src/core/lib/surface/alarm.c",
"src/core/lib/surface/api_trace.c",
"src/core/lib/surface/byte_buffer.c",
@@ -547,6 +547,8 @@ cc_library(
"include/grpc/grpc.h",
"include/grpc/grpc_posix.h",
"include/grpc/grpc_security_constants.h",
+ "include/grpc/slice.h",
+ "include/grpc/slice_buffer.h",
"include/grpc/status.h",
"include/grpc/impl/codegen/byte_buffer_reader.h",
"include/grpc/impl/codegen/compression_types.h",
@@ -661,6 +663,8 @@ cc_library(
"src/core/lib/json/json_common.h",
"src/core/lib/json/json_reader.h",
"src/core/lib/json/json_writer.h",
+ "src/core/lib/slice/percent_encoding.h",
+ "src/core/lib/slice/slice_string_helpers.h",
"src/core/lib/surface/api_trace.h",
"src/core/lib/surface/call.h",
"src/core/lib/surface/call_test_only.h",
@@ -824,6 +828,10 @@ cc_library(
"src/core/lib/json/json_reader.c",
"src/core/lib/json/json_string.c",
"src/core/lib/json/json_writer.c",
+ "src/core/lib/slice/percent_encoding.c",
+ "src/core/lib/slice/slice.c",
+ "src/core/lib/slice/slice_buffer.c",
+ "src/core/lib/slice/slice_string_helpers.c",
"src/core/lib/surface/alarm.c",
"src/core/lib/surface/api_trace.c",
"src/core/lib/surface/byte_buffer.c",
@@ -933,6 +941,8 @@ cc_library(
"include/grpc/grpc.h",
"include/grpc/grpc_posix.h",
"include/grpc/grpc_security_constants.h",
+ "include/grpc/slice.h",
+ "include/grpc/slice_buffer.h",
"include/grpc/status.h",
"include/grpc/impl/codegen/byte_buffer_reader.h",
"include/grpc/impl/codegen/compression_types.h",
@@ -1042,6 +1052,8 @@ cc_library(
"src/core/lib/json/json_common.h",
"src/core/lib/json/json_reader.h",
"src/core/lib/json/json_writer.h",
+ "src/core/lib/slice/percent_encoding.h",
+ "src/core/lib/slice/slice_string_helpers.h",
"src/core/lib/surface/api_trace.h",
"src/core/lib/surface/call.h",
"src/core/lib/surface/call_test_only.h",
@@ -1197,6 +1209,10 @@ cc_library(
"src/core/lib/json/json_reader.c",
"src/core/lib/json/json_string.c",
"src/core/lib/json/json_writer.c",
+ "src/core/lib/slice/percent_encoding.c",
+ "src/core/lib/slice/slice.c",
+ "src/core/lib/slice/slice_buffer.c",
+ "src/core/lib/slice/slice_string_helpers.c",
"src/core/lib/surface/alarm.c",
"src/core/lib/surface/api_trace.c",
"src/core/lib/surface/byte_buffer.c",
@@ -1302,6 +1318,8 @@ cc_library(
"include/grpc/grpc.h",
"include/grpc/grpc_posix.h",
"include/grpc/grpc_security_constants.h",
+ "include/grpc/slice.h",
+ "include/grpc/slice_buffer.h",
"include/grpc/status.h",
"include/grpc/impl/codegen/byte_buffer_reader.h",
"include/grpc/impl/codegen/compression_types.h",
@@ -1885,9 +1903,6 @@ objc_library(
"src/core/lib/support/log_windows.c",
"src/core/lib/support/mpscq.c",
"src/core/lib/support/murmur_hash.c",
- "src/core/lib/support/percent_encoding.c",
- "src/core/lib/support/slice.c",
- "src/core/lib/support/slice_buffer.c",
"src/core/lib/support/stack_lockfree.c",
"src/core/lib/support/string.c",
"src/core/lib/support/string_posix.c",
@@ -1925,8 +1940,6 @@ objc_library(
"include/grpc/support/log.h",
"include/grpc/support/log_windows.h",
"include/grpc/support/port_platform.h",
- "include/grpc/support/slice.h",
- "include/grpc/support/slice_buffer.h",
"include/grpc/support/string_util.h",
"include/grpc/support/subprocess.h",
"include/grpc/support/sync.h",
@@ -1957,7 +1970,6 @@ objc_library(
"src/core/lib/support/env.h",
"src/core/lib/support/mpscq.h",
"src/core/lib/support/murmur_hash.h",
- "src/core/lib/support/percent_encoding.h",
"src/core/lib/support/stack_lockfree.h",
"src/core/lib/support/string.h",
"src/core/lib/support/string_windows.h",
@@ -2058,6 +2070,10 @@ objc_library(
"src/core/lib/json/json_reader.c",
"src/core/lib/json/json_string.c",
"src/core/lib/json/json_writer.c",
+ "src/core/lib/slice/percent_encoding.c",
+ "src/core/lib/slice/slice.c",
+ "src/core/lib/slice/slice_buffer.c",
+ "src/core/lib/slice/slice_string_helpers.c",
"src/core/lib/surface/alarm.c",
"src/core/lib/surface/api_trace.c",
"src/core/lib/surface/byte_buffer.c",
@@ -2192,6 +2208,8 @@ objc_library(
"include/grpc/grpc.h",
"include/grpc/grpc_posix.h",
"include/grpc/grpc_security_constants.h",
+ "include/grpc/slice.h",
+ "include/grpc/slice_buffer.h",
"include/grpc/status.h",
"include/grpc/impl/codegen/byte_buffer_reader.h",
"include/grpc/impl/codegen/compression_types.h",
@@ -2285,6 +2303,8 @@ objc_library(
"src/core/lib/json/json_common.h",
"src/core/lib/json/json_reader.h",
"src/core/lib/json/json_writer.h",
+ "src/core/lib/slice/percent_encoding.h",
+ "src/core/lib/slice/slice_string_helpers.h",
"src/core/lib/surface/api_trace.h",
"src/core/lib/surface/call.h",
"src/core/lib/surface/call_test_only.h",
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b551ce3411..98d54f2198 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -193,9 +193,6 @@ add_library(gpr
src/core/lib/support/log_windows.c
src/core/lib/support/mpscq.c
src/core/lib/support/murmur_hash.c
- src/core/lib/support/percent_encoding.c
- src/core/lib/support/slice.c
- src/core/lib/support/slice_buffer.c
src/core/lib/support/stack_lockfree.c
src/core/lib/support/string.c
src/core/lib/support/string_posix.c
@@ -244,8 +241,6 @@ foreach(_hdr
include/grpc/support/log.h
include/grpc/support/log_windows.h
include/grpc/support/port_platform.h
- include/grpc/support/slice.h
- include/grpc/support/slice_buffer.h
include/grpc/support/string_util.h
include/grpc/support/subprocess.h
include/grpc/support/sync.h
@@ -369,6 +364,10 @@ add_library(grpc
src/core/lib/json/json_reader.c
src/core/lib/json/json_string.c
src/core/lib/json/json_writer.c
+ src/core/lib/slice/percent_encoding.c
+ src/core/lib/slice/slice.c
+ src/core/lib/slice/slice_buffer.c
+ src/core/lib/slice/slice_string_helpers.c
src/core/lib/surface/alarm.c
src/core/lib/surface/api_trace.c
src/core/lib/surface/byte_buffer.c
@@ -523,6 +522,8 @@ foreach(_hdr
include/grpc/grpc.h
include/grpc/grpc_posix.h
include/grpc/grpc_security_constants.h
+ include/grpc/slice.h
+ include/grpc/slice_buffer.h
include/grpc/status.h
include/grpc/impl/codegen/byte_buffer_reader.h
include/grpc/impl/codegen/compression_types.h
@@ -642,6 +643,10 @@ add_library(grpc_cronet
src/core/lib/json/json_reader.c
src/core/lib/json/json_string.c
src/core/lib/json/json_writer.c
+ src/core/lib/slice/percent_encoding.c
+ src/core/lib/slice/slice.c
+ src/core/lib/slice/slice_buffer.c
+ src/core/lib/slice/slice_string_helpers.c
src/core/lib/surface/alarm.c
src/core/lib/surface/api_trace.c
src/core/lib/surface/byte_buffer.c
@@ -767,6 +772,8 @@ foreach(_hdr
include/grpc/grpc.h
include/grpc/grpc_posix.h
include/grpc/grpc_security_constants.h
+ include/grpc/slice.h
+ include/grpc/slice_buffer.h
include/grpc/status.h
include/grpc/impl/codegen/byte_buffer_reader.h
include/grpc/impl/codegen/compression_types.h
@@ -887,6 +894,10 @@ add_library(grpc_unsecure
src/core/lib/json/json_reader.c
src/core/lib/json/json_string.c
src/core/lib/json/json_writer.c
+ src/core/lib/slice/percent_encoding.c
+ src/core/lib/slice/slice.c
+ src/core/lib/slice/slice_buffer.c
+ src/core/lib/slice/slice_string_helpers.c
src/core/lib/surface/alarm.c
src/core/lib/surface/api_trace.c
src/core/lib/surface/byte_buffer.c
@@ -1010,6 +1021,8 @@ foreach(_hdr
include/grpc/grpc.h
include/grpc/grpc_posix.h
include/grpc/grpc_security_constants.h
+ include/grpc/slice.h
+ include/grpc/slice_buffer.h
include/grpc/status.h
include/grpc/impl/codegen/byte_buffer_reader.h
include/grpc/impl/codegen/compression_types.h
diff --git a/Makefile b/Makefile
index 09520d0b68..d80f607c57 100644
--- a/Makefile
+++ b/Makefile
@@ -966,9 +966,6 @@ gpr_histogram_test: $(BINDIR)/$(CONFIG)/gpr_histogram_test
gpr_host_port_test: $(BINDIR)/$(CONFIG)/gpr_host_port_test
gpr_log_test: $(BINDIR)/$(CONFIG)/gpr_log_test
gpr_mpscq_test: $(BINDIR)/$(CONFIG)/gpr_mpscq_test
-gpr_percent_encoding_test: $(BINDIR)/$(CONFIG)/gpr_percent_encoding_test
-gpr_slice_buffer_test: $(BINDIR)/$(CONFIG)/gpr_slice_buffer_test
-gpr_slice_test: $(BINDIR)/$(CONFIG)/gpr_slice_test
gpr_stack_lockfree_test: $(BINDIR)/$(CONFIG)/gpr_stack_lockfree_test
gpr_string_test: $(BINDIR)/$(CONFIG)/gpr_string_test
gpr_sync_test: $(BINDIR)/$(CONFIG)/gpr_sync_test
@@ -1025,6 +1022,7 @@ nanopb_fuzzer_serverlist_test: $(BINDIR)/$(CONFIG)/nanopb_fuzzer_serverlist_test
no_server_test: $(BINDIR)/$(CONFIG)/no_server_test
percent_decode_fuzzer: $(BINDIR)/$(CONFIG)/percent_decode_fuzzer
percent_encode_fuzzer: $(BINDIR)/$(CONFIG)/percent_encode_fuzzer
+percent_encoding_test: $(BINDIR)/$(CONFIG)/percent_encoding_test
resolve_address_test: $(BINDIR)/$(CONFIG)/resolve_address_test
resource_quota_test: $(BINDIR)/$(CONFIG)/resource_quota_test
secure_channel_create_test: $(BINDIR)/$(CONFIG)/secure_channel_create_test
@@ -1034,6 +1032,9 @@ server_chttp2_test: $(BINDIR)/$(CONFIG)/server_chttp2_test
server_fuzzer: $(BINDIR)/$(CONFIG)/server_fuzzer
server_test: $(BINDIR)/$(CONFIG)/server_test
set_initial_connect_string_test: $(BINDIR)/$(CONFIG)/set_initial_connect_string_test
+slice_buffer_test: $(BINDIR)/$(CONFIG)/slice_buffer_test
+slice_string_helpers_test: $(BINDIR)/$(CONFIG)/slice_string_helpers_test
+slice_test: $(BINDIR)/$(CONFIG)/slice_test
sockaddr_resolver_test: $(BINDIR)/$(CONFIG)/sockaddr_resolver_test
sockaddr_utils_test: $(BINDIR)/$(CONFIG)/sockaddr_utils_test
socket_utils_test: $(BINDIR)/$(CONFIG)/socket_utils_test
@@ -1304,9 +1305,6 @@ buildtests_c: privatelibs_c \
$(BINDIR)/$(CONFIG)/gpr_host_port_test \
$(BINDIR)/$(CONFIG)/gpr_log_test \
$(BINDIR)/$(CONFIG)/gpr_mpscq_test \
- $(BINDIR)/$(CONFIG)/gpr_percent_encoding_test \
- $(BINDIR)/$(CONFIG)/gpr_slice_buffer_test \
- $(BINDIR)/$(CONFIG)/gpr_slice_test \
$(BINDIR)/$(CONFIG)/gpr_stack_lockfree_test \
$(BINDIR)/$(CONFIG)/gpr_string_test \
$(BINDIR)/$(CONFIG)/gpr_sync_test \
@@ -1351,6 +1349,7 @@ buildtests_c: privatelibs_c \
$(BINDIR)/$(CONFIG)/multiple_server_queues_test \
$(BINDIR)/$(CONFIG)/murmur_hash_test \
$(BINDIR)/$(CONFIG)/no_server_test \
+ $(BINDIR)/$(CONFIG)/percent_encoding_test \
$(BINDIR)/$(CONFIG)/resolve_address_test \
$(BINDIR)/$(CONFIG)/resource_quota_test \
$(BINDIR)/$(CONFIG)/secure_channel_create_test \
@@ -1359,6 +1358,9 @@ buildtests_c: privatelibs_c \
$(BINDIR)/$(CONFIG)/server_chttp2_test \
$(BINDIR)/$(CONFIG)/server_test \
$(BINDIR)/$(CONFIG)/set_initial_connect_string_test \
+ $(BINDIR)/$(CONFIG)/slice_buffer_test \
+ $(BINDIR)/$(CONFIG)/slice_string_helpers_test \
+ $(BINDIR)/$(CONFIG)/slice_test \
$(BINDIR)/$(CONFIG)/sockaddr_resolver_test \
$(BINDIR)/$(CONFIG)/sockaddr_utils_test \
$(BINDIR)/$(CONFIG)/socket_utils_test \
@@ -1662,12 +1664,6 @@ test_c: buildtests_c
$(Q) $(BINDIR)/$(CONFIG)/gpr_log_test || ( echo test gpr_log_test failed ; exit 1 )
$(E) "[RUN] Testing gpr_mpscq_test"
$(Q) $(BINDIR)/$(CONFIG)/gpr_mpscq_test || ( echo test gpr_mpscq_test failed ; exit 1 )
- $(E) "[RUN] Testing gpr_percent_encoding_test"
- $(Q) $(BINDIR)/$(CONFIG)/gpr_percent_encoding_test || ( echo test gpr_percent_encoding_test failed ; exit 1 )
- $(E) "[RUN] Testing gpr_slice_buffer_test"
- $(Q) $(BINDIR)/$(CONFIG)/gpr_slice_buffer_test || ( echo test gpr_slice_buffer_test failed ; exit 1 )
- $(E) "[RUN] Testing gpr_slice_test"
- $(Q) $(BINDIR)/$(CONFIG)/gpr_slice_test || ( echo test gpr_slice_test failed ; exit 1 )
$(E) "[RUN] Testing gpr_stack_lockfree_test"
$(Q) $(BINDIR)/$(CONFIG)/gpr_stack_lockfree_test || ( echo test gpr_stack_lockfree_test failed ; exit 1 )
$(E) "[RUN] Testing gpr_string_test"
@@ -1742,6 +1738,8 @@ test_c: buildtests_c
$(Q) $(BINDIR)/$(CONFIG)/murmur_hash_test || ( echo test murmur_hash_test failed ; exit 1 )
$(E) "[RUN] Testing no_server_test"
$(Q) $(BINDIR)/$(CONFIG)/no_server_test || ( echo test no_server_test failed ; exit 1 )
+ $(E) "[RUN] Testing percent_encoding_test"
+ $(Q) $(BINDIR)/$(CONFIG)/percent_encoding_test || ( echo test percent_encoding_test failed ; exit 1 )
$(E) "[RUN] Testing resolve_address_test"
$(Q) $(BINDIR)/$(CONFIG)/resolve_address_test || ( echo test resolve_address_test failed ; exit 1 )
$(E) "[RUN] Testing resource_quota_test"
@@ -1758,6 +1756,12 @@ test_c: buildtests_c
$(Q) $(BINDIR)/$(CONFIG)/server_test || ( echo test server_test failed ; exit 1 )
$(E) "[RUN] Testing set_initial_connect_string_test"
$(Q) $(BINDIR)/$(CONFIG)/set_initial_connect_string_test || ( echo test set_initial_connect_string_test failed ; exit 1 )
+ $(E) "[RUN] Testing slice_buffer_test"
+ $(Q) $(BINDIR)/$(CONFIG)/slice_buffer_test || ( echo test slice_buffer_test failed ; exit 1 )
+ $(E) "[RUN] Testing slice_string_helpers_test"
+ $(Q) $(BINDIR)/$(CONFIG)/slice_string_helpers_test || ( echo test slice_string_helpers_test failed ; exit 1 )
+ $(E) "[RUN] Testing slice_test"
+ $(Q) $(BINDIR)/$(CONFIG)/slice_test || ( echo test slice_test failed ; exit 1 )
$(E) "[RUN] Testing sockaddr_resolver_test"
$(Q) $(BINDIR)/$(CONFIG)/sockaddr_resolver_test || ( echo test sockaddr_resolver_test failed ; exit 1 )
$(E) "[RUN] Testing sockaddr_utils_test"
@@ -2481,9 +2485,6 @@ LIBGPR_SRC = \
src/core/lib/support/log_windows.c \
src/core/lib/support/mpscq.c \
src/core/lib/support/murmur_hash.c \
- src/core/lib/support/percent_encoding.c \
- src/core/lib/support/slice.c \
- src/core/lib/support/slice_buffer.c \
src/core/lib/support/stack_lockfree.c \
src/core/lib/support/string.c \
src/core/lib/support/string_posix.c \
@@ -2521,8 +2522,6 @@ PUBLIC_HEADERS_C += \
include/grpc/support/log.h \
include/grpc/support/log_windows.h \
include/grpc/support/port_platform.h \
- include/grpc/support/slice.h \
- include/grpc/support/slice_buffer.h \
include/grpc/support/string_util.h \
include/grpc/support/subprocess.h \
include/grpc/support/sync.h \
@@ -2691,6 +2690,10 @@ LIBGRPC_SRC = \
src/core/lib/json/json_reader.c \
src/core/lib/json/json_string.c \
src/core/lib/json/json_writer.c \
+ src/core/lib/slice/percent_encoding.c \
+ src/core/lib/slice/slice.c \
+ src/core/lib/slice/slice_buffer.c \
+ src/core/lib/slice/slice_string_helpers.c \
src/core/lib/surface/alarm.c \
src/core/lib/surface/api_trace.c \
src/core/lib/surface/byte_buffer.c \
@@ -2828,6 +2831,8 @@ PUBLIC_HEADERS_C += \
include/grpc/grpc.h \
include/grpc/grpc_posix.h \
include/grpc/grpc_security_constants.h \
+ include/grpc/slice.h \
+ include/grpc/slice_buffer.h \
include/grpc/status.h \
include/grpc/impl/codegen/byte_buffer_reader.h \
include/grpc/impl/codegen/compression_types.h \
@@ -2982,6 +2987,10 @@ LIBGRPC_CRONET_SRC = \
src/core/lib/json/json_reader.c \
src/core/lib/json/json_string.c \
src/core/lib/json/json_writer.c \
+ src/core/lib/slice/percent_encoding.c \
+ src/core/lib/slice/slice.c \
+ src/core/lib/slice/slice_buffer.c \
+ src/core/lib/slice/slice_string_helpers.c \
src/core/lib/surface/alarm.c \
src/core/lib/surface/api_trace.c \
src/core/lib/surface/byte_buffer.c \
@@ -3091,6 +3100,8 @@ PUBLIC_HEADERS_C += \
include/grpc/grpc.h \
include/grpc/grpc_posix.h \
include/grpc/grpc_security_constants.h \
+ include/grpc/slice.h \
+ include/grpc/slice_buffer.h \
include/grpc/status.h \
include/grpc/impl/codegen/byte_buffer_reader.h \
include/grpc/impl/codegen/compression_types.h \
@@ -3264,6 +3275,10 @@ LIBGRPC_TEST_UTIL_SRC = \
src/core/lib/json/json_reader.c \
src/core/lib/json/json_string.c \
src/core/lib/json/json_writer.c \
+ src/core/lib/slice/percent_encoding.c \
+ src/core/lib/slice/slice.c \
+ src/core/lib/slice/slice_buffer.c \
+ src/core/lib/slice/slice_string_helpers.c \
src/core/lib/surface/alarm.c \
src/core/lib/surface/api_trace.c \
src/core/lib/surface/byte_buffer.c \
@@ -3301,6 +3316,8 @@ PUBLIC_HEADERS_C += \
include/grpc/grpc.h \
include/grpc/grpc_posix.h \
include/grpc/grpc_security_constants.h \
+ include/grpc/slice.h \
+ include/grpc/slice_buffer.h \
include/grpc/status.h \
include/grpc/impl/codegen/byte_buffer_reader.h \
include/grpc/impl/codegen/compression_types.h \
@@ -3475,6 +3492,10 @@ LIBGRPC_UNSECURE_SRC = \
src/core/lib/json/json_reader.c \
src/core/lib/json/json_string.c \
src/core/lib/json/json_writer.c \
+ src/core/lib/slice/percent_encoding.c \
+ src/core/lib/slice/slice.c \
+ src/core/lib/slice/slice_buffer.c \
+ src/core/lib/slice/slice_string_helpers.c \
src/core/lib/surface/alarm.c \
src/core/lib/surface/api_trace.c \
src/core/lib/surface/byte_buffer.c \
@@ -3583,6 +3604,8 @@ PUBLIC_HEADERS_C += \
include/grpc/grpc.h \
include/grpc/grpc_posix.h \
include/grpc/grpc_security_constants.h \
+ include/grpc/slice.h \
+ include/grpc/slice_buffer.h \
include/grpc/status.h \
include/grpc/impl/codegen/byte_buffer_reader.h \
include/grpc/impl/codegen/compression_types.h \
@@ -8538,102 +8561,6 @@ endif
endif
-GPR_PERCENT_ENCODING_TEST_SRC = \
- test/core/support/percent_encoding_test.c \
-
-GPR_PERCENT_ENCODING_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GPR_PERCENT_ENCODING_TEST_SRC))))
-ifeq ($(NO_SECURE),true)
-
-# You can't build secure targets if you don't have OpenSSL.
-
-$(BINDIR)/$(CONFIG)/gpr_percent_encoding_test: openssl_dep_error
-
-else
-
-
-
-$(BINDIR)/$(CONFIG)/gpr_percent_encoding_test: $(GPR_PERCENT_ENCODING_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
- $(E) "[LD] Linking $@"
- $(Q) mkdir -p `dirname $@`
- $(Q) $(LD) $(LDFLAGS) $(GPR_PERCENT_ENCODING_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gpr_percent_encoding_test
-
-endif
-
-$(OBJDIR)/$(CONFIG)/test/core/support/percent_encoding_test.o: $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
-
-deps_gpr_percent_encoding_test: $(GPR_PERCENT_ENCODING_TEST_OBJS:.o=.dep)
-
-ifneq ($(NO_SECURE),true)
-ifneq ($(NO_DEPS),true)
--include $(GPR_PERCENT_ENCODING_TEST_OBJS:.o=.dep)
-endif
-endif
-
-
-GPR_SLICE_BUFFER_TEST_SRC = \
- test/core/support/slice_buffer_test.c \
-
-GPR_SLICE_BUFFER_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GPR_SLICE_BUFFER_TEST_SRC))))
-ifeq ($(NO_SECURE),true)
-
-# You can't build secure targets if you don't have OpenSSL.
-
-$(BINDIR)/$(CONFIG)/gpr_slice_buffer_test: openssl_dep_error
-
-else
-
-
-
-$(BINDIR)/$(CONFIG)/gpr_slice_buffer_test: $(GPR_SLICE_BUFFER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
- $(E) "[LD] Linking $@"
- $(Q) mkdir -p `dirname $@`
- $(Q) $(LD) $(LDFLAGS) $(GPR_SLICE_BUFFER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gpr_slice_buffer_test
-
-endif
-
-$(OBJDIR)/$(CONFIG)/test/core/support/slice_buffer_test.o: $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
-
-deps_gpr_slice_buffer_test: $(GPR_SLICE_BUFFER_TEST_OBJS:.o=.dep)
-
-ifneq ($(NO_SECURE),true)
-ifneq ($(NO_DEPS),true)
--include $(GPR_SLICE_BUFFER_TEST_OBJS:.o=.dep)
-endif
-endif
-
-
-GPR_SLICE_TEST_SRC = \
- test/core/support/slice_test.c \
-
-GPR_SLICE_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(GPR_SLICE_TEST_SRC))))
-ifeq ($(NO_SECURE),true)
-
-# You can't build secure targets if you don't have OpenSSL.
-
-$(BINDIR)/$(CONFIG)/gpr_slice_test: openssl_dep_error
-
-else
-
-
-
-$(BINDIR)/$(CONFIG)/gpr_slice_test: $(GPR_SLICE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
- $(E) "[LD] Linking $@"
- $(Q) mkdir -p `dirname $@`
- $(Q) $(LD) $(LDFLAGS) $(GPR_SLICE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/gpr_slice_test
-
-endif
-
-$(OBJDIR)/$(CONFIG)/test/core/support/slice_test.o: $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
-
-deps_gpr_slice_test: $(GPR_SLICE_TEST_OBJS:.o=.dep)
-
-ifneq ($(NO_SECURE),true)
-ifneq ($(NO_DEPS),true)
--include $(GPR_SLICE_TEST_OBJS:.o=.dep)
-endif
-endif
-
-
GPR_STACK_LOCKFREE_TEST_SRC = \
test/core/support/stack_lockfree_test.c \
@@ -10363,7 +10290,7 @@ endif
PERCENT_DECODE_FUZZER_SRC = \
- test/core/support/percent_decode_fuzzer.c \
+ test/core/slice/percent_decode_fuzzer.c \
PERCENT_DECODE_FUZZER_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(PERCENT_DECODE_FUZZER_SRC))))
ifeq ($(NO_SECURE),true)
@@ -10383,7 +10310,7 @@ $(BINDIR)/$(CONFIG)/percent_decode_fuzzer: $(PERCENT_DECODE_FUZZER_OBJS) $(LIBDI
endif
-$(OBJDIR)/$(CONFIG)/test/core/support/percent_decode_fuzzer.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
+$(OBJDIR)/$(CONFIG)/test/core/slice/percent_decode_fuzzer.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_percent_decode_fuzzer: $(PERCENT_DECODE_FUZZER_OBJS:.o=.dep)
@@ -10395,7 +10322,7 @@ endif
PERCENT_ENCODE_FUZZER_SRC = \
- test/core/support/percent_encode_fuzzer.c \
+ test/core/slice/percent_encode_fuzzer.c \
PERCENT_ENCODE_FUZZER_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(PERCENT_ENCODE_FUZZER_SRC))))
ifeq ($(NO_SECURE),true)
@@ -10415,7 +10342,7 @@ $(BINDIR)/$(CONFIG)/percent_encode_fuzzer: $(PERCENT_ENCODE_FUZZER_OBJS) $(LIBDI
endif
-$(OBJDIR)/$(CONFIG)/test/core/support/percent_encode_fuzzer.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
+$(OBJDIR)/$(CONFIG)/test/core/slice/percent_encode_fuzzer.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
deps_percent_encode_fuzzer: $(PERCENT_ENCODE_FUZZER_OBJS:.o=.dep)
@@ -10426,6 +10353,38 @@ endif
endif
+PERCENT_ENCODING_TEST_SRC = \
+ test/core/slice/percent_encoding_test.c \
+
+PERCENT_ENCODING_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(PERCENT_ENCODING_TEST_SRC))))
+ifeq ($(NO_SECURE),true)
+
+# You can't build secure targets if you don't have OpenSSL.
+
+$(BINDIR)/$(CONFIG)/percent_encoding_test: openssl_dep_error
+
+else
+
+
+
+$(BINDIR)/$(CONFIG)/percent_encoding_test: $(PERCENT_ENCODING_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
+ $(E) "[LD] Linking $@"
+ $(Q) mkdir -p `dirname $@`
+ $(Q) $(LD) $(LDFLAGS) $(PERCENT_ENCODING_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/percent_encoding_test
+
+endif
+
+$(OBJDIR)/$(CONFIG)/test/core/slice/percent_encoding_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
+
+deps_percent_encoding_test: $(PERCENT_ENCODING_TEST_OBJS:.o=.dep)
+
+ifneq ($(NO_SECURE),true)
+ifneq ($(NO_DEPS),true)
+-include $(PERCENT_ENCODING_TEST_OBJS:.o=.dep)
+endif
+endif
+
+
RESOLVE_ADDRESS_TEST_SRC = \
test/core/iomgr/resolve_address_test.c \
@@ -10714,6 +10673,102 @@ endif
endif
+SLICE_BUFFER_TEST_SRC = \
+ test/core/slice/slice_buffer_test.c \
+
+SLICE_BUFFER_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(SLICE_BUFFER_TEST_SRC))))
+ifeq ($(NO_SECURE),true)
+
+# You can't build secure targets if you don't have OpenSSL.
+
+$(BINDIR)/$(CONFIG)/slice_buffer_test: openssl_dep_error
+
+else
+
+
+
+$(BINDIR)/$(CONFIG)/slice_buffer_test: $(SLICE_BUFFER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
+ $(E) "[LD] Linking $@"
+ $(Q) mkdir -p `dirname $@`
+ $(Q) $(LD) $(LDFLAGS) $(SLICE_BUFFER_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/slice_buffer_test
+
+endif
+
+$(OBJDIR)/$(CONFIG)/test/core/slice/slice_buffer_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
+
+deps_slice_buffer_test: $(SLICE_BUFFER_TEST_OBJS:.o=.dep)
+
+ifneq ($(NO_SECURE),true)
+ifneq ($(NO_DEPS),true)
+-include $(SLICE_BUFFER_TEST_OBJS:.o=.dep)
+endif
+endif
+
+
+SLICE_STRING_HELPERS_TEST_SRC = \
+ test/core/slice/slice_string_helpers_test.c \
+
+SLICE_STRING_HELPERS_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(SLICE_STRING_HELPERS_TEST_SRC))))
+ifeq ($(NO_SECURE),true)
+
+# You can't build secure targets if you don't have OpenSSL.
+
+$(BINDIR)/$(CONFIG)/slice_string_helpers_test: openssl_dep_error
+
+else
+
+
+
+$(BINDIR)/$(CONFIG)/slice_string_helpers_test: $(SLICE_STRING_HELPERS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
+ $(E) "[LD] Linking $@"
+ $(Q) mkdir -p `dirname $@`
+ $(Q) $(LD) $(LDFLAGS) $(SLICE_STRING_HELPERS_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/slice_string_helpers_test
+
+endif
+
+$(OBJDIR)/$(CONFIG)/test/core/slice/slice_string_helpers_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
+
+deps_slice_string_helpers_test: $(SLICE_STRING_HELPERS_TEST_OBJS:.o=.dep)
+
+ifneq ($(NO_SECURE),true)
+ifneq ($(NO_DEPS),true)
+-include $(SLICE_STRING_HELPERS_TEST_OBJS:.o=.dep)
+endif
+endif
+
+
+SLICE_TEST_SRC = \
+ test/core/slice/slice_test.c \
+
+SLICE_TEST_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(SLICE_TEST_SRC))))
+ifeq ($(NO_SECURE),true)
+
+# You can't build secure targets if you don't have OpenSSL.
+
+$(BINDIR)/$(CONFIG)/slice_test: openssl_dep_error
+
+else
+
+
+
+$(BINDIR)/$(CONFIG)/slice_test: $(SLICE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
+ $(E) "[LD] Linking $@"
+ $(Q) mkdir -p `dirname $@`
+ $(Q) $(LD) $(LDFLAGS) $(SLICE_TEST_OBJS) $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a $(LDLIBS) $(LDLIBS_SECURE) -o $(BINDIR)/$(CONFIG)/slice_test
+
+endif
+
+$(OBJDIR)/$(CONFIG)/test/core/slice/slice_test.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
+
+deps_slice_test: $(SLICE_TEST_OBJS:.o=.dep)
+
+ifneq ($(NO_SECURE),true)
+ifneq ($(NO_DEPS),true)
+-include $(SLICE_TEST_OBJS:.o=.dep)
+endif
+endif
+
+
SOCKADDR_RESOLVER_TEST_SRC = \
test/core/client_channel/resolvers/sockaddr_resolver_test.c \
@@ -16184,7 +16239,7 @@ endif
PERCENT_DECODE_FUZZER_ONE_ENTRY_SRC = \
- test/core/support/percent_decode_fuzzer.c \
+ test/core/slice/percent_decode_fuzzer.c \
test/core/util/one_corpus_entry_fuzzer.c \
PERCENT_DECODE_FUZZER_ONE_ENTRY_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(PERCENT_DECODE_FUZZER_ONE_ENTRY_SRC))))
@@ -16205,7 +16260,7 @@ $(BINDIR)/$(CONFIG)/percent_decode_fuzzer_one_entry: $(PERCENT_DECODE_FUZZER_ONE
endif
-$(OBJDIR)/$(CONFIG)/test/core/support/percent_decode_fuzzer.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
+$(OBJDIR)/$(CONFIG)/test/core/slice/percent_decode_fuzzer.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(OBJDIR)/$(CONFIG)/test/core/util/one_corpus_entry_fuzzer.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
@@ -16219,7 +16274,7 @@ endif
PERCENT_ENCODE_FUZZER_ONE_ENTRY_SRC = \
- test/core/support/percent_encode_fuzzer.c \
+ test/core/slice/percent_encode_fuzzer.c \
test/core/util/one_corpus_entry_fuzzer.c \
PERCENT_ENCODE_FUZZER_ONE_ENTRY_OBJS = $(addprefix $(OBJDIR)/$(CONFIG)/, $(addsuffix .o, $(basename $(PERCENT_ENCODE_FUZZER_ONE_ENTRY_SRC))))
@@ -16240,7 +16295,7 @@ $(BINDIR)/$(CONFIG)/percent_encode_fuzzer_one_entry: $(PERCENT_ENCODE_FUZZER_ONE
endif
-$(OBJDIR)/$(CONFIG)/test/core/support/percent_encode_fuzzer.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
+$(OBJDIR)/$(CONFIG)/test/core/slice/percent_encode_fuzzer.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
$(OBJDIR)/$(CONFIG)/test/core/util/one_corpus_entry_fuzzer.o: $(LIBDIR)/$(CONFIG)/libgrpc_test_util.a $(LIBDIR)/$(CONFIG)/libgrpc.a $(LIBDIR)/$(CONFIG)/libgpr_test_util.a $(LIBDIR)/$(CONFIG)/libgpr.a
diff --git a/binding.gyp b/binding.gyp
index bb215c4889..ba90fcaa10 100644
--- a/binding.gyp
+++ b/binding.gyp
@@ -520,9 +520,6 @@
'src/core/lib/support/log_windows.c',
'src/core/lib/support/mpscq.c',
'src/core/lib/support/murmur_hash.c',
- 'src/core/lib/support/percent_encoding.c',
- 'src/core/lib/support/slice.c',
- 'src/core/lib/support/slice_buffer.c',
'src/core/lib/support/stack_lockfree.c',
'src/core/lib/support/string.c',
'src/core/lib/support/string_posix.c',
@@ -647,6 +644,10 @@
'src/core/lib/json/json_reader.c',
'src/core/lib/json/json_string.c',
'src/core/lib/json/json_writer.c',
+ 'src/core/lib/slice/percent_encoding.c',
+ 'src/core/lib/slice/slice.c',
+ 'src/core/lib/slice/slice_buffer.c',
+ 'src/core/lib/slice/slice_string_helpers.c',
'src/core/lib/surface/alarm.c',
'src/core/lib/surface/api_trace.c',
'src/core/lib/surface/byte_buffer.c',
diff --git a/build.yaml b/build.yaml
index c62e9e6bb8..dc6315a8da 100644
--- a/build.yaml
+++ b/build.yaml
@@ -65,8 +65,6 @@ filegroups:
- include/grpc/support/log.h
- include/grpc/support/log_windows.h
- include/grpc/support/port_platform.h
- - include/grpc/support/slice.h
- - include/grpc/support/slice_buffer.h
- include/grpc/support/string_util.h
- include/grpc/support/subprocess.h
- include/grpc/support/sync.h
@@ -87,7 +85,6 @@ filegroups:
- src/core/lib/support/env.h
- src/core/lib/support/mpscq.h
- src/core/lib/support/murmur_hash.h
- - src/core/lib/support/percent_encoding.h
- src/core/lib/support/stack_lockfree.h
- src/core/lib/support/string.h
- src/core/lib/support/string_windows.h
@@ -117,9 +114,6 @@ filegroups:
- src/core/lib/support/log_windows.c
- src/core/lib/support/mpscq.c
- src/core/lib/support/murmur_hash.c
- - src/core/lib/support/percent_encoding.c
- - src/core/lib/support/slice.c
- - src/core/lib/support/slice_buffer.c
- src/core/lib/support/stack_lockfree.c
- src/core/lib/support/string.c
- src/core/lib/support/string_posix.c
@@ -165,6 +159,8 @@ filegroups:
- include/grpc/grpc.h
- include/grpc/grpc_posix.h
- include/grpc/grpc_security_constants.h
+ - include/grpc/slice.h
+ - include/grpc/slice_buffer.h
- include/grpc/status.h
headers:
- src/core/lib/channel/channel_args.h
@@ -240,6 +236,8 @@ filegroups:
- src/core/lib/json/json_common.h
- src/core/lib/json/json_reader.h
- src/core/lib/json/json_writer.h
+ - src/core/lib/slice/percent_encoding.h
+ - src/core/lib/slice/slice_string_helpers.h
- src/core/lib/surface/api_trace.h
- src/core/lib/surface/call.h
- src/core/lib/surface/call_test_only.h
@@ -342,6 +340,10 @@ filegroups:
- src/core/lib/json/json_reader.c
- src/core/lib/json/json_string.c
- src/core/lib/json/json_writer.c
+ - src/core/lib/slice/percent_encoding.c
+ - src/core/lib/slice/slice.c
+ - src/core/lib/slice/slice_buffer.c
+ - src/core/lib/slice/slice_string_helpers.c
- src/core/lib/surface/alarm.c
- src/core/lib/surface/api_trace.c
- src/core/lib/surface/byte_buffer.c
@@ -1794,30 +1796,6 @@ targets:
deps:
- gpr_test_util
- gpr
-- name: gpr_percent_encoding_test
- build: test
- language: c
- src:
- - test/core/support/percent_encoding_test.c
- deps:
- - gpr_test_util
- - gpr
-- name: gpr_slice_buffer_test
- build: test
- language: c
- src:
- - test/core/support/slice_buffer_test.c
- deps:
- - gpr_test_util
- - gpr
-- name: gpr_slice_test
- build: test
- language: c
- src:
- - test/core/support/slice_test.c
- deps:
- - gpr_test_util
- - gpr
- name: gpr_stack_lockfree_test
cpu_cost: 7
build: test
@@ -2395,28 +2373,38 @@ targets:
build: fuzzer
language: c
src:
- - test/core/support/percent_decode_fuzzer.c
+ - test/core/slice/percent_decode_fuzzer.c
deps:
- grpc_test_util
- grpc
- gpr_test_util
- gpr
corpus_dirs:
- - test/core/support/percent_decode_corpus
+ - test/core/slice/percent_decode_corpus
maxlen: 32
- name: percent_encode_fuzzer
build: fuzzer
language: c
src:
- - test/core/support/percent_encode_fuzzer.c
+ - test/core/slice/percent_encode_fuzzer.c
deps:
- grpc_test_util
- grpc
- gpr_test_util
- gpr
corpus_dirs:
- - test/core/support/percent_encode_corpus
+ - test/core/slice/percent_encode_corpus
maxlen: 32
+- name: percent_encoding_test
+ build: test
+ language: c
+ src:
+ - test/core/slice/percent_encoding_test.c
+ deps:
+ - grpc_test_util
+ - grpc
+ - gpr_test_util
+ - gpr
- name: resolve_address_test
build: test
language: c
@@ -2522,6 +2510,36 @@ targets:
- gpr
exclude_iomgrs:
- uv
+- name: slice_buffer_test
+ build: test
+ language: c
+ src:
+ - test/core/slice/slice_buffer_test.c
+ deps:
+ - grpc_test_util
+ - grpc
+ - gpr_test_util
+ - gpr
+- name: slice_string_helpers_test
+ build: test
+ language: c
+ src:
+ - test/core/slice/slice_string_helpers_test.c
+ deps:
+ - grpc_test_util
+ - grpc
+ - gpr_test_util
+ - gpr
+- name: slice_test
+ build: test
+ language: c
+ src:
+ - test/core/slice/slice_test.c
+ deps:
+ - grpc_test_util
+ - grpc
+ - gpr_test_util
+ - gpr
- name: sockaddr_resolver_test
build: test
language: c
diff --git a/config.m4 b/config.m4
index 09aaac635d..988cc5b003 100644
--- a/config.m4
+++ b/config.m4
@@ -58,9 +58,6 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/support/log_windows.c \
src/core/lib/support/mpscq.c \
src/core/lib/support/murmur_hash.c \
- src/core/lib/support/percent_encoding.c \
- src/core/lib/support/slice.c \
- src/core/lib/support/slice_buffer.c \
src/core/lib/support/stack_lockfree.c \
src/core/lib/support/string.c \
src/core/lib/support/string_posix.c \
@@ -163,6 +160,10 @@ if test "$PHP_GRPC" != "no"; then
src/core/lib/json/json_reader.c \
src/core/lib/json/json_string.c \
src/core/lib/json/json_writer.c \
+ src/core/lib/slice/percent_encoding.c \
+ src/core/lib/slice/slice.c \
+ src/core/lib/slice/slice_buffer.c \
+ src/core/lib/slice/slice_string_helpers.c \
src/core/lib/surface/alarm.c \
src/core/lib/surface/api_trace.c \
src/core/lib/surface/byte_buffer.c \
@@ -632,6 +633,7 @@ if test "$PHP_GRPC" != "no"; then
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/security/credentials/ssl)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/security/transport)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/security/util)
+ PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/slice)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/support)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/surface)
PHP_ADD_BUILD_DIR($ext_builddir/src/core/lib/transport)
diff --git a/gRPC-Core.podspec b/gRPC-Core.podspec
index 706d7afee0..8708cdb4cb 100644
--- a/gRPC-Core.podspec
+++ b/gRPC-Core.podspec
@@ -129,8 +129,6 @@ Pod::Spec.new do |s|
'include/grpc/support/log.h',
'include/grpc/support/log_windows.h',
'include/grpc/support/port_platform.h',
- 'include/grpc/support/slice.h',
- 'include/grpc/support/slice_buffer.h',
'include/grpc/support/string_util.h',
'include/grpc/support/subprocess.h',
'include/grpc/support/sync.h',
@@ -161,6 +159,8 @@ Pod::Spec.new do |s|
'include/grpc/grpc.h',
'include/grpc/grpc_posix.h',
'include/grpc/grpc_security_constants.h',
+ 'include/grpc/slice.h',
+ 'include/grpc/slice_buffer.h',
'include/grpc/status.h',
'include/grpc/impl/codegen/byte_buffer_reader.h',
'include/grpc/impl/codegen/compression_types.h',
@@ -195,7 +195,6 @@ Pod::Spec.new do |s|
'src/core/lib/support/env.h',
'src/core/lib/support/mpscq.h',
'src/core/lib/support/murmur_hash.h',
- 'src/core/lib/support/percent_encoding.h',
'src/core/lib/support/stack_lockfree.h',
'src/core/lib/support/string.h',
'src/core/lib/support/string_windows.h',
@@ -224,9 +223,6 @@ Pod::Spec.new do |s|
'src/core/lib/support/log_windows.c',
'src/core/lib/support/mpscq.c',
'src/core/lib/support/murmur_hash.c',
- 'src/core/lib/support/percent_encoding.c',
- 'src/core/lib/support/slice.c',
- 'src/core/lib/support/slice_buffer.c',
'src/core/lib/support/stack_lockfree.c',
'src/core/lib/support/string.c',
'src/core/lib/support/string_posix.c',
@@ -322,6 +318,8 @@ Pod::Spec.new do |s|
'src/core/lib/json/json_common.h',
'src/core/lib/json/json_reader.h',
'src/core/lib/json/json_writer.h',
+ 'src/core/lib/slice/percent_encoding.h',
+ 'src/core/lib/slice/slice_string_helpers.h',
'src/core/lib/surface/api_trace.h',
'src/core/lib/surface/call.h',
'src/core/lib/surface/call_test_only.h',
@@ -504,6 +502,10 @@ Pod::Spec.new do |s|
'src/core/lib/json/json_reader.c',
'src/core/lib/json/json_string.c',
'src/core/lib/json/json_writer.c',
+ 'src/core/lib/slice/percent_encoding.c',
+ 'src/core/lib/slice/slice.c',
+ 'src/core/lib/slice/slice_buffer.c',
+ 'src/core/lib/slice/slice_string_helpers.c',
'src/core/lib/surface/alarm.c',
'src/core/lib/surface/api_trace.c',
'src/core/lib/surface/byte_buffer.c',
@@ -640,7 +642,6 @@ Pod::Spec.new do |s|
'src/core/lib/support/env.h',
'src/core/lib/support/mpscq.h',
'src/core/lib/support/murmur_hash.h',
- 'src/core/lib/support/percent_encoding.h',
'src/core/lib/support/stack_lockfree.h',
'src/core/lib/support/string.h',
'src/core/lib/support/string_windows.h',
@@ -720,6 +721,8 @@ Pod::Spec.new do |s|
'src/core/lib/json/json_common.h',
'src/core/lib/json/json_reader.h',
'src/core/lib/json/json_writer.h',
+ 'src/core/lib/slice/percent_encoding.h',
+ 'src/core/lib/slice/slice_string_helpers.h',
'src/core/lib/surface/api_trace.h',
'src/core/lib/surface/call.h',
'src/core/lib/surface/call_test_only.h',
diff --git a/grpc.def b/grpc.def
index 0b6db801d8..1abb9a7e6a 100644
--- a/grpc.def
+++ b/grpc.def
@@ -134,6 +134,35 @@ EXPORTS
grpc_server_add_secure_http2_port
grpc_call_set_credentials
grpc_server_credentials_set_auth_metadata_processor
+ grpc_slice_ref
+ grpc_slice_unref
+ grpc_slice_new
+ grpc_slice_new_with_user_data
+ grpc_slice_new_with_len
+ grpc_slice_malloc
+ grpc_slice_from_copied_string
+ grpc_slice_from_copied_buffer
+ grpc_slice_from_static_string
+ grpc_slice_sub
+ grpc_slice_sub_no_ref
+ grpc_slice_split_tail
+ grpc_slice_split_head
+ gpr_empty_slice
+ grpc_slice_cmp
+ grpc_slice_str_cmp
+ grpc_slice_buffer_init
+ grpc_slice_buffer_destroy
+ grpc_slice_buffer_add
+ grpc_slice_buffer_add_indexed
+ grpc_slice_buffer_addn
+ grpc_slice_buffer_tiny_add
+ grpc_slice_buffer_pop
+ grpc_slice_buffer_reset_and_unref
+ grpc_slice_buffer_swap
+ grpc_slice_buffer_move_into
+ grpc_slice_buffer_trim_end
+ grpc_slice_buffer_move_first
+ grpc_slice_buffer_take_first
gpr_malloc
gpr_free
gpr_realloc
@@ -183,35 +212,6 @@ EXPORTS
gpr_log_verbosity_init
gpr_set_log_function
gpr_format_message
- gpr_slice_ref
- gpr_slice_unref
- gpr_slice_new
- gpr_slice_new_with_user_data
- gpr_slice_new_with_len
- gpr_slice_malloc
- gpr_slice_from_copied_string
- gpr_slice_from_copied_buffer
- gpr_slice_from_static_string
- gpr_slice_sub
- gpr_slice_sub_no_ref
- gpr_slice_split_tail
- gpr_slice_split_head
- gpr_empty_slice
- gpr_slice_cmp
- gpr_slice_str_cmp
- gpr_slice_buffer_init
- gpr_slice_buffer_destroy
- gpr_slice_buffer_add
- gpr_slice_buffer_add_indexed
- gpr_slice_buffer_addn
- gpr_slice_buffer_tiny_add
- gpr_slice_buffer_pop
- gpr_slice_buffer_reset_and_unref
- gpr_slice_buffer_swap
- gpr_slice_buffer_move_into
- gpr_slice_buffer_trim_end
- gpr_slice_buffer_move_first
- gpr_slice_buffer_take_first
gpr_strdup
gpr_asprintf
gpr_subprocess_binary_extension
diff --git a/grpc.gemspec b/grpc.gemspec
index f4919bfb25..b071fccb82 100755
--- a/grpc.gemspec
+++ b/grpc.gemspec
@@ -57,8 +57,6 @@ Gem::Specification.new do |s|
s.files += %w( include/grpc/support/log.h )
s.files += %w( include/grpc/support/log_windows.h )
s.files += %w( include/grpc/support/port_platform.h )
- s.files += %w( include/grpc/support/slice.h )
- s.files += %w( include/grpc/support/slice_buffer.h )
s.files += %w( include/grpc/support/string_util.h )
s.files += %w( include/grpc/support/subprocess.h )
s.files += %w( include/grpc/support/sync.h )
@@ -89,7 +87,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/support/env.h )
s.files += %w( src/core/lib/support/mpscq.h )
s.files += %w( src/core/lib/support/murmur_hash.h )
- s.files += %w( src/core/lib/support/percent_encoding.h )
s.files += %w( src/core/lib/support/stack_lockfree.h )
s.files += %w( src/core/lib/support/string.h )
s.files += %w( src/core/lib/support/string_windows.h )
@@ -118,9 +115,6 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/support/log_windows.c )
s.files += %w( src/core/lib/support/mpscq.c )
s.files += %w( src/core/lib/support/murmur_hash.c )
- s.files += %w( src/core/lib/support/percent_encoding.c )
- s.files += %w( src/core/lib/support/slice.c )
- s.files += %w( src/core/lib/support/slice_buffer.c )
s.files += %w( src/core/lib/support/stack_lockfree.c )
s.files += %w( src/core/lib/support/string.c )
s.files += %w( src/core/lib/support/string_posix.c )
@@ -149,6 +143,8 @@ Gem::Specification.new do |s|
s.files += %w( include/grpc/grpc.h )
s.files += %w( include/grpc/grpc_posix.h )
s.files += %w( include/grpc/grpc_security_constants.h )
+ s.files += %w( include/grpc/slice.h )
+ s.files += %w( include/grpc/slice_buffer.h )
s.files += %w( include/grpc/status.h )
s.files += %w( include/grpc/impl/codegen/byte_buffer_reader.h )
s.files += %w( include/grpc/impl/codegen/compression_types.h )
@@ -242,6 +238,8 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/json/json_common.h )
s.files += %w( src/core/lib/json/json_reader.h )
s.files += %w( src/core/lib/json/json_writer.h )
+ s.files += %w( src/core/lib/slice/percent_encoding.h )
+ s.files += %w( src/core/lib/slice/slice_string_helpers.h )
s.files += %w( src/core/lib/surface/api_trace.h )
s.files += %w( src/core/lib/surface/call.h )
s.files += %w( src/core/lib/surface/call_test_only.h )
@@ -424,6 +422,10 @@ Gem::Specification.new do |s|
s.files += %w( src/core/lib/json/json_reader.c )
s.files += %w( src/core/lib/json/json_string.c )
s.files += %w( src/core/lib/json/json_writer.c )
+ s.files += %w( src/core/lib/slice/percent_encoding.c )
+ s.files += %w( src/core/lib/slice/slice.c )
+ s.files += %w( src/core/lib/slice/slice_buffer.c )
+ s.files += %w( src/core/lib/slice/slice_string_helpers.c )
s.files += %w( src/core/lib/surface/alarm.c )
s.files += %w( src/core/lib/surface/api_trace.c )
s.files += %w( src/core/lib/surface/byte_buffer.c )
diff --git a/include/grpc++/impl/codegen/core_codegen.h b/include/grpc++/impl/codegen/core_codegen.h
index aff88ffa07..6b5e637e4e 100644
--- a/include/grpc++/impl/codegen/core_codegen.h
+++ b/include/grpc++/impl/codegen/core_codegen.h
@@ -71,16 +71,16 @@ class CoreCodegen : public CoreCodegenInterface {
void grpc_byte_buffer_reader_destroy(
grpc_byte_buffer_reader* reader) override;
int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader* reader,
- gpr_slice* slice) override;
+ grpc_slice* slice) override;
- grpc_byte_buffer* grpc_raw_byte_buffer_create(gpr_slice* slice,
+ grpc_byte_buffer* grpc_raw_byte_buffer_create(grpc_slice* slice,
size_t nslices) override;
- gpr_slice gpr_slice_malloc(size_t length) override;
- void gpr_slice_unref(gpr_slice slice) override;
- gpr_slice gpr_slice_split_tail(gpr_slice* s, size_t split) override;
- void gpr_slice_buffer_add(gpr_slice_buffer* sb, gpr_slice slice) override;
- void gpr_slice_buffer_pop(gpr_slice_buffer* sb) override;
+ grpc_slice grpc_slice_malloc(size_t length) override;
+ void grpc_slice_unref(grpc_slice slice) override;
+ grpc_slice grpc_slice_split_tail(grpc_slice* s, size_t split) override;
+ void grpc_slice_buffer_add(grpc_slice_buffer* sb, grpc_slice slice) override;
+ void grpc_slice_buffer_pop(grpc_slice_buffer* sb) override;
void grpc_metadata_array_init(grpc_metadata_array* array) override;
void grpc_metadata_array_destroy(grpc_metadata_array* array) override;
diff --git a/include/grpc++/impl/codegen/core_codegen_interface.h b/include/grpc++/impl/codegen/core_codegen_interface.h
index 68851f15c6..4783a43454 100644
--- a/include/grpc++/impl/codegen/core_codegen_interface.h
+++ b/include/grpc++/impl/codegen/core_codegen_interface.h
@@ -88,16 +88,17 @@ class CoreCodegenInterface {
virtual void grpc_byte_buffer_reader_destroy(
grpc_byte_buffer_reader* reader) = 0;
virtual int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader* reader,
- gpr_slice* slice) = 0;
+ grpc_slice* slice) = 0;
- virtual grpc_byte_buffer* grpc_raw_byte_buffer_create(gpr_slice* slice,
+ virtual grpc_byte_buffer* grpc_raw_byte_buffer_create(grpc_slice* slice,
size_t nslices) = 0;
- virtual gpr_slice gpr_slice_malloc(size_t length) = 0;
- virtual void gpr_slice_unref(gpr_slice slice) = 0;
- virtual gpr_slice gpr_slice_split_tail(gpr_slice* s, size_t split) = 0;
- virtual void gpr_slice_buffer_add(gpr_slice_buffer* sb, gpr_slice slice) = 0;
- virtual void gpr_slice_buffer_pop(gpr_slice_buffer* sb) = 0;
+ virtual grpc_slice grpc_slice_malloc(size_t length) = 0;
+ virtual void grpc_slice_unref(grpc_slice slice) = 0;
+ virtual grpc_slice grpc_slice_split_tail(grpc_slice* s, size_t split) = 0;
+ virtual void grpc_slice_buffer_add(grpc_slice_buffer* sb,
+ grpc_slice slice) = 0;
+ virtual void grpc_slice_buffer_pop(grpc_slice_buffer* sb) = 0;
virtual void grpc_metadata_array_init(grpc_metadata_array* array) = 0;
virtual void grpc_metadata_array_destroy(grpc_metadata_array* array) = 0;
diff --git a/include/grpc++/impl/codegen/proto_utils.h b/include/grpc++/impl/codegen/proto_utils.h
index cbaa3e7bf2..2f15487591 100644
--- a/include/grpc++/impl/codegen/proto_utils.h
+++ b/include/grpc++/impl/codegen/proto_utils.h
@@ -63,7 +63,7 @@ class GrpcBufferWriter final
~GrpcBufferWriter() override {
if (have_backup_) {
- g_core_codegen_interface->gpr_slice_unref(backup_slice_);
+ g_core_codegen_interface->grpc_slice_unref(backup_slice_);
}
}
@@ -72,24 +72,24 @@ class GrpcBufferWriter final
slice_ = backup_slice_;
have_backup_ = false;
} else {
- slice_ = g_core_codegen_interface->gpr_slice_malloc(block_size_);
+ slice_ = g_core_codegen_interface->grpc_slice_malloc(block_size_);
}
- *data = GPR_SLICE_START_PTR(slice_);
+ *data = GRPC_SLICE_START_PTR(slice_);
// On win x64, int is only 32bit
- GPR_CODEGEN_ASSERT(GPR_SLICE_LENGTH(slice_) <= INT_MAX);
- byte_count_ += * size = (int)GPR_SLICE_LENGTH(slice_);
- g_core_codegen_interface->gpr_slice_buffer_add(slice_buffer_, slice_);
+ GPR_CODEGEN_ASSERT(GRPC_SLICE_LENGTH(slice_) <= INT_MAX);
+ byte_count_ += * size = (int)GRPC_SLICE_LENGTH(slice_);
+ g_core_codegen_interface->grpc_slice_buffer_add(slice_buffer_, slice_);
return true;
}
void BackUp(int count) override {
- g_core_codegen_interface->gpr_slice_buffer_pop(slice_buffer_);
+ g_core_codegen_interface->grpc_slice_buffer_pop(slice_buffer_);
if (count == block_size_) {
backup_slice_ = slice_;
} else {
- backup_slice_ = g_core_codegen_interface->gpr_slice_split_tail(
- &slice_, GPR_SLICE_LENGTH(slice_) - count);
- g_core_codegen_interface->gpr_slice_buffer_add(slice_buffer_, slice_);
+ backup_slice_ = g_core_codegen_interface->grpc_slice_split_tail(
+ &slice_, GRPC_SLICE_LENGTH(slice_) - count);
+ g_core_codegen_interface->grpc_slice_buffer_add(slice_buffer_, slice_);
}
have_backup_ = true;
byte_count_ -= count;
@@ -100,10 +100,10 @@ class GrpcBufferWriter final
private:
const int block_size_;
int64_t byte_count_;
- gpr_slice_buffer* slice_buffer_;
+ grpc_slice_buffer* slice_buffer_;
bool have_backup_;
- gpr_slice backup_slice_;
- gpr_slice slice_;
+ grpc_slice backup_slice_;
+ grpc_slice slice_;
};
class GrpcBufferReader final
@@ -126,7 +126,7 @@ class GrpcBufferReader final
return false;
}
if (backup_count_ > 0) {
- *data = GPR_SLICE_START_PTR(slice_) + GPR_SLICE_LENGTH(slice_) -
+ *data = GRPC_SLICE_START_PTR(slice_) + GRPC_SLICE_LENGTH(slice_) -
backup_count_;
GPR_CODEGEN_ASSERT(backup_count_ <= INT_MAX);
*size = (int)backup_count_;
@@ -137,11 +137,11 @@ class GrpcBufferReader final
&slice_)) {
return false;
}
- g_core_codegen_interface->gpr_slice_unref(slice_);
- *data = GPR_SLICE_START_PTR(slice_);
+ g_core_codegen_interface->grpc_slice_unref(slice_);
+ *data = GRPC_SLICE_START_PTR(slice_);
// On win x64, int is only 32bit
- GPR_CODEGEN_ASSERT(GPR_SLICE_LENGTH(slice_) <= INT_MAX);
- byte_count_ += * size = (int)GPR_SLICE_LENGTH(slice_);
+ GPR_CODEGEN_ASSERT(GRPC_SLICE_LENGTH(slice_) <= INT_MAX);
+ byte_count_ += * size = (int)GRPC_SLICE_LENGTH(slice_);
return true;
}
@@ -172,7 +172,7 @@ class GrpcBufferReader final
int64_t byte_count_;
int64_t backup_count_;
grpc_byte_buffer_reader reader_;
- gpr_slice slice_;
+ grpc_slice slice_;
Status status_;
};
} // namespace internal
@@ -186,12 +186,12 @@ class SerializationTraits<T, typename std::enable_if<std::is_base_of<
*own_buffer = true;
int byte_size = msg.ByteSize();
if (byte_size <= internal::kGrpcBufferWriterMaxBufferLength) {
- gpr_slice slice = g_core_codegen_interface->gpr_slice_malloc(byte_size);
+ grpc_slice slice = g_core_codegen_interface->grpc_slice_malloc(byte_size);
GPR_CODEGEN_ASSERT(
- GPR_SLICE_END_PTR(slice) ==
- msg.SerializeWithCachedSizesToArray(GPR_SLICE_START_PTR(slice)));
+ GRPC_SLICE_END_PTR(slice) ==
+ msg.SerializeWithCachedSizesToArray(GRPC_SLICE_START_PTR(slice)));
*bp = g_core_codegen_interface->grpc_raw_byte_buffer_create(&slice, 1);
- g_core_codegen_interface->gpr_slice_unref(slice);
+ g_core_codegen_interface->grpc_slice_unref(slice);
return g_core_codegen_interface->ok();
} else {
internal::GrpcBufferWriter writer(
diff --git a/include/grpc++/impl/codegen/thrift_serializer.h b/include/grpc++/impl/codegen/thrift_serializer.h
index fd324a994f..86bc7105c0 100644
--- a/include/grpc++/impl/codegen/thrift_serializer.h
+++ b/include/grpc++/impl/codegen/thrift_serializer.h
@@ -109,12 +109,12 @@ class ThriftSerializer {
Serialize(fields, &byte_buffer, &byte_buffer_size);
- gpr_slice slice = gpr_slice_from_copied_buffer(
+ grpc_slice slice = grpc_slice_from_copied_buffer(
reinterpret_cast<const char*>(byte_buffer), byte_buffer_size);
*bp = grpc_raw_byte_buffer_create(&slice, 1);
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
}
// Deserialize the passed char array into the passed type, returns the number
@@ -156,12 +156,12 @@ class ThriftSerializer {
grpc_byte_buffer_reader reader;
grpc_byte_buffer_reader_init(&reader, buffer);
- gpr_slice slice = grpc_byte_buffer_reader_readall(&reader);
+ grpc_slice slice = grpc_byte_buffer_reader_readall(&reader);
uint32_t len =
- Deserialize(GPR_SLICE_START_PTR(slice), GPR_SLICE_LENGTH(slice), msg);
+ Deserialize(GRPC_SLICE_START_PTR(slice), GRPC_SLICE_LENGTH(slice), msg);
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
grpc_byte_buffer_reader_destroy(&reader);
@@ -214,4 +214,4 @@ typedef ThriftSerializer<void, TCompactProtocolT<TBufferBase>>
} // namespace thrift
} // namespace apache
-#endif
+#endif // GRPCXX_IMPL_CODEGEN_THRIFT_SERIALIZER_H
diff --git a/include/grpc++/support/slice.h b/include/grpc++/support/slice.h
index 85561f7f33..3ec0d1af80 100644
--- a/include/grpc++/support/slice.h
+++ b/include/grpc++/support/slice.h
@@ -35,11 +35,11 @@
#define GRPCXX_SUPPORT_SLICE_H
#include <grpc++/support/config.h>
-#include <grpc/support/slice.h>
+#include <grpc/slice.h>
namespace grpc {
-/// A wrapper around \a gpr_slice.
+/// A wrapper around \a grpc_slice.
///
/// A slice represents a contiguous reference counted array of bytes.
/// It is cheap to take references to a slice, and it is cheap to create a
@@ -53,11 +53,11 @@ class Slice final {
enum AddRef { ADD_REF };
/// Construct a slice from \a slice, adding a reference.
- Slice(gpr_slice slice, AddRef);
+ Slice(grpc_slice slice, AddRef);
enum StealRef { STEAL_REF };
/// Construct a slice from \a slice, stealing a reference.
- Slice(gpr_slice slice, StealRef);
+ Slice(grpc_slice slice, StealRef);
/// Copy constructor, adds a reference.
Slice(const Slice& other);
@@ -69,21 +69,21 @@ class Slice final {
}
/// Byte size.
- size_t size() const { return GPR_SLICE_LENGTH(slice_); }
+ size_t size() const { return GRPC_SLICE_LENGTH(slice_); }
/// Raw pointer to the beginning (first element) of the slice.
- const uint8_t* begin() const { return GPR_SLICE_START_PTR(slice_); }
+ const uint8_t* begin() const { return GRPC_SLICE_START_PTR(slice_); }
/// Raw pointer to the end (one byte \em past the last element) of the slice.
- const uint8_t* end() const { return GPR_SLICE_END_PTR(slice_); }
+ const uint8_t* end() const { return GRPC_SLICE_END_PTR(slice_); }
- /// Raw C slice. Caller needs to call gpr_slice_unref when done.
- gpr_slice c_slice() const { return gpr_slice_ref(slice_); }
+ /// Raw C slice. Caller needs to call grpc_slice_unref when done.
+ grpc_slice c_slice() const { return grpc_slice_ref(slice_); }
private:
friend class ByteBuffer;
- gpr_slice slice_;
+ grpc_slice slice_;
};
} // namespace grpc
diff --git a/include/grpc/byte_buffer.h b/include/grpc/byte_buffer.h
index f25c1d51d6..395ebef744 100644
--- a/include/grpc/byte_buffer.h
+++ b/include/grpc/byte_buffer.h
@@ -35,7 +35,7 @@
#define GRPC_BYTE_BUFFER_H
#include <grpc/impl/codegen/grpc_types.h>
-#include <grpc/support/slice_buffer.h>
+#include <grpc/slice_buffer.h>
#ifdef __cplusplus
extern "C" {
@@ -45,7 +45,7 @@ extern "C" {
*
* Increases the reference count for all \a slices processed. The user is
* responsible for invoking grpc_byte_buffer_destroy on the returned instance.*/
-GRPCAPI grpc_byte_buffer *grpc_raw_byte_buffer_create(gpr_slice *slices,
+GRPCAPI grpc_byte_buffer *grpc_raw_byte_buffer_create(grpc_slice *slices,
size_t nslices);
/** Returns a *compressed* RAW byte buffer instance over the given slices (up to
@@ -55,7 +55,7 @@ GRPCAPI grpc_byte_buffer *grpc_raw_byte_buffer_create(gpr_slice *slices,
* Increases the reference count for all \a slices processed. The user is
* responsible for invoking grpc_byte_buffer_destroy on the returned instance.*/
GRPCAPI grpc_byte_buffer *grpc_raw_compressed_byte_buffer_create(
- gpr_slice *slices, size_t nslices, grpc_compression_algorithm compression);
+ grpc_slice *slices, size_t nslices, grpc_compression_algorithm compression);
/** Copies input byte buffer \a bb.
*
@@ -83,12 +83,12 @@ GRPCAPI void grpc_byte_buffer_reader_destroy(grpc_byte_buffer_reader *reader);
/** Updates \a slice with the next piece of data from from \a reader and returns
* 1. Returns 0 at the end of the stream. Caller is responsible for calling
- * gpr_slice_unref on the result. */
+ * grpc_slice_unref on the result. */
GRPCAPI int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader *reader,
- gpr_slice *slice);
+ grpc_slice *slice);
/** Merge all data from \a reader into single slice */
-GRPCAPI gpr_slice
+GRPCAPI grpc_slice
grpc_byte_buffer_reader_readall(grpc_byte_buffer_reader *reader);
/** Returns a RAW byte buffer instance from the output of \a reader. */
diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h
index f8e442274e..23d15fdc0b 100644
--- a/include/grpc/grpc.h
+++ b/include/grpc/grpc.h
@@ -40,7 +40,7 @@
#include <grpc/impl/codegen/connectivity_state.h>
#include <grpc/impl/codegen/grpc_types.h>
#include <grpc/impl/codegen/propagation_bits.h>
-#include <grpc/support/slice.h>
+#include <grpc/slice.h>
#include <grpc/support/time.h>
#include <stddef.h>
diff --git a/include/grpc/impl/codegen/gpr_types.h b/include/grpc/impl/codegen/gpr_types.h
index c8f0815f0b..ed9976f429 100644
--- a/include/grpc/impl/codegen/gpr_types.h
+++ b/include/grpc/impl/codegen/gpr_types.h
@@ -68,71 +68,6 @@ typedef struct gpr_timespec {
gpr_clock_type clock_type;
} gpr_timespec;
-/* Slice API
-
- A slice represents a contiguous reference counted array of bytes.
- It is cheap to take references to a slice, and it is cheap to create a
- slice pointing to a subset of another slice.
-
- The data-structure for slices is exposed here to allow non-gpr code to
- build slices from whatever data they have available.
-
- When defining interfaces that handle slices, care should be taken to define
- reference ownership semantics (who should call unref?) and mutability
- constraints (is the callee allowed to modify the slice?) */
-
-/* Reference count container for gpr_slice. Contains function pointers to
- increment and decrement reference counts. Implementations should cleanup
- when the reference count drops to zero.
- Typically client code should not touch this, and use gpr_slice_malloc,
- gpr_slice_new, or gpr_slice_new_with_len instead. */
-typedef struct gpr_slice_refcount {
- void (*ref)(void *);
- void (*unref)(void *);
-} gpr_slice_refcount;
-
-#define GPR_SLICE_INLINED_SIZE (sizeof(size_t) + sizeof(uint8_t *) - 1)
-
-/* A gpr_slice s, if initialized, represents the byte range
- s.bytes[0..s.length-1].
-
- It can have an associated ref count which has a destruction routine to be run
- when the ref count reaches zero (see gpr_slice_new() and grp_slice_unref()).
- Multiple gpr_slice values may share a ref count.
-
- If the slice does not have a refcount, it represents an inlined small piece
- of data that is copied by value. */
-typedef struct gpr_slice {
- struct gpr_slice_refcount *refcount;
- union {
- struct {
- uint8_t *bytes;
- size_t length;
- } refcounted;
- struct {
- uint8_t length;
- uint8_t bytes[GPR_SLICE_INLINED_SIZE];
- } inlined;
- } data;
-} gpr_slice;
-
-#define GRPC_SLICE_BUFFER_INLINE_ELEMENTS 8
-
-/* Represents an expandable array of slices, to be interpreted as a
- single item. */
-typedef struct {
- /* slices in the array */
- gpr_slice *slices;
- /* the number of slices in the array */
- size_t count;
- /* the number of slices allocated in the array */
- size_t capacity;
- /* the combined length of all slices in the array */
- size_t length;
- /* inlined elements to avoid allocations */
- gpr_slice inlined[GRPC_SLICE_BUFFER_INLINE_ELEMENTS];
-} gpr_slice_buffer;
-
#ifdef __cplusplus
}
#endif
diff --git a/include/grpc/impl/codegen/grpc_types.h b/include/grpc/impl/codegen/grpc_types.h
index 66ece3c8a0..18678622c5 100644
--- a/include/grpc/impl/codegen/grpc_types.h
+++ b/include/grpc/impl/codegen/grpc_types.h
@@ -35,6 +35,7 @@
#define GRPC_IMPL_CODEGEN_GRPC_TYPES_H
#include <grpc/impl/codegen/gpr_types.h>
+#include <grpc/impl/codegen/slice.h>
#include <grpc/impl/codegen/compression_types.h>
#include <grpc/impl/codegen/status.h>
@@ -60,7 +61,7 @@ typedef struct grpc_byte_buffer {
} reserved;
struct {
grpc_compression_algorithm compression;
- gpr_slice_buffer slice_buffer;
+ grpc_slice_buffer slice_buffer;
} raw;
} data;
} grpc_byte_buffer;
diff --git a/include/grpc/impl/codegen/slice.h b/include/grpc/impl/codegen/slice.h
index a2637eea62..774ba0e95d 100644
--- a/include/grpc/impl/codegen/slice.h
+++ b/include/grpc/impl/codegen/slice.h
@@ -35,18 +35,84 @@
#define GRPC_IMPL_CODEGEN_SLICE_H
#include <stddef.h>
+#include <stdint.h>
-#define GPR_SLICE_START_PTR(slice) \
+/* Slice API
+
+ A slice represents a contiguous reference counted array of bytes.
+ It is cheap to take references to a slice, and it is cheap to create a
+ slice pointing to a subset of another slice.
+
+ The data-structure for slices is exposed here to allow non-gpr code to
+ build slices from whatever data they have available.
+
+ When defining interfaces that handle slices, care should be taken to define
+ reference ownership semantics (who should call unref?) and mutability
+ constraints (is the callee allowed to modify the slice?) */
+
+/* Reference count container for grpc_slice. Contains function pointers to
+ increment and decrement reference counts. Implementations should cleanup
+ when the reference count drops to zero.
+ Typically client code should not touch this, and use grpc_slice_malloc,
+ grpc_slice_new, or grpc_slice_new_with_len instead. */
+typedef struct grpc_slice_refcount {
+ void (*ref)(void *);
+ void (*unref)(void *);
+} grpc_slice_refcount;
+
+#define GRPC_SLICE_INLINED_SIZE (sizeof(size_t) + sizeof(uint8_t *) - 1)
+
+/* A grpc_slice s, if initialized, represents the byte range
+ s.bytes[0..s.length-1].
+
+ It can have an associated ref count which has a destruction routine to be run
+ when the ref count reaches zero (see grpc_slice_new() and grp_slice_unref()).
+ Multiple grpc_slice values may share a ref count.
+
+ If the slice does not have a refcount, it represents an inlined small piece
+ of data that is copied by value. */
+typedef struct grpc_slice {
+ struct grpc_slice_refcount *refcount;
+ union {
+ struct {
+ uint8_t *bytes;
+ size_t length;
+ } refcounted;
+ struct {
+ uint8_t length;
+ uint8_t bytes[GRPC_SLICE_INLINED_SIZE];
+ } inlined;
+ } data;
+} grpc_slice;
+
+#define GRPC_SLICE_BUFFER_INLINE_ELEMENTS 8
+
+/* Represents an expandable array of slices, to be interpreted as a
+ single item. */
+typedef struct {
+ /* slices in the array */
+ grpc_slice *slices;
+ /* the number of slices in the array */
+ size_t count;
+ /* the number of slices allocated in the array */
+ size_t capacity;
+ /* the combined length of all slices in the array */
+ size_t length;
+ /* inlined elements to avoid allocations */
+ grpc_slice inlined[GRPC_SLICE_BUFFER_INLINE_ELEMENTS];
+} grpc_slice_buffer;
+
+#define GRPC_SLICE_START_PTR(slice) \
((slice).refcount ? (slice).data.refcounted.bytes \
: (slice).data.inlined.bytes)
-#define GPR_SLICE_LENGTH(slice) \
+#define GRPC_SLICE_LENGTH(slice) \
((slice).refcount ? (slice).data.refcounted.length \
: (slice).data.inlined.length)
-#define GPR_SLICE_SET_LENGTH(slice, newlen) \
+#define GRPC_SLICE_SET_LENGTH(slice, newlen) \
((slice).refcount ? ((slice).data.refcounted.length = (size_t)(newlen)) \
: ((slice).data.inlined.length = (uint8_t)(newlen)))
-#define GPR_SLICE_END_PTR(slice) \
- GPR_SLICE_START_PTR(slice) + GPR_SLICE_LENGTH(slice)
-#define GPR_SLICE_IS_EMPTY(slice) (GPR_SLICE_LENGTH(slice) == 0)
+#define GRPC_SLICE_END_PTR(slice) \
+ GRPC_SLICE_START_PTR(slice) + GRPC_SLICE_LENGTH(slice)
+#define GRPC_SLICE_IS_EMPTY(slice) (GRPC_SLICE_LENGTH(slice) == 0)
#endif /* GRPC_IMPL_CODEGEN_SLICE_H */
diff --git a/include/grpc/support/slice.h b/include/grpc/slice.h
index b31fe6c0c5..ee0bb4928e 100644
--- a/include/grpc/support/slice.h
+++ b/include/grpc/slice.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_SUPPORT_SLICE_H
-#define GRPC_SUPPORT_SLICE_H
+#ifndef GRPC_SLICE_H
+#define GRPC_SLICE_H
#include <grpc/impl/codegen/slice.h>
#include <grpc/support/sync.h>
@@ -43,86 +43,86 @@ extern "C" {
/* Increment the refcount of s. Requires slice is initialized.
Returns s. */
-GPRAPI gpr_slice gpr_slice_ref(gpr_slice s);
+GPRAPI grpc_slice grpc_slice_ref(grpc_slice s);
/* Decrement the ref count of s. If the ref count of s reaches zero, all
slices sharing the ref count are destroyed, and considered no longer
- initialized. If s is ultimately derived from a call to gpr_slice_new(start,
+ initialized. If s is ultimately derived from a call to grpc_slice_new(start,
len, dest) where dest!=NULL , then (*dest)(start) is called, else if s is
- ultimately derived from a call to gpr_slice_new_with_len(start, len, dest)
+ ultimately derived from a call to grpc_slice_new_with_len(start, len, dest)
where dest!=NULL , then (*dest)(start, len). Requires s initialized. */
-GPRAPI void gpr_slice_unref(gpr_slice s);
+GPRAPI void grpc_slice_unref(grpc_slice s);
/* Create a slice pointing at some data. Calls malloc to allocate a refcount
for the object, and arranges that destroy will be called with the pointer
passed in at destruction. */
-GPRAPI gpr_slice gpr_slice_new(void *p, size_t len, void (*destroy)(void *));
+GPRAPI grpc_slice grpc_slice_new(void *p, size_t len, void (*destroy)(void *));
-/* Equivalent to gpr_slice_new, but with a separate pointer that is
+/* Equivalent to grpc_slice_new, but with a separate pointer that is
passed to the destroy function. This function can be useful when
the data is part of a larger structure that must be destroyed when
the data is no longer needed. */
-GPRAPI gpr_slice gpr_slice_new_with_user_data(void *p, size_t len,
- void (*destroy)(void *),
- void *user_data);
+GPRAPI grpc_slice grpc_slice_new_with_user_data(void *p, size_t len,
+ void (*destroy)(void *),
+ void *user_data);
-/* Equivalent to gpr_slice_new, but with a two argument destroy function that
+/* Equivalent to grpc_slice_new, but with a two argument destroy function that
also takes the slice length. */
-GPRAPI gpr_slice gpr_slice_new_with_len(void *p, size_t len,
- void (*destroy)(void *, size_t));
+GPRAPI grpc_slice grpc_slice_new_with_len(void *p, size_t len,
+ void (*destroy)(void *, size_t));
-/* Equivalent to gpr_slice_new(malloc(len), len, free), but saves one malloc()
+/* Equivalent to grpc_slice_new(malloc(len), len, free), but saves one malloc()
call.
Aborts if malloc() fails. */
-GPRAPI gpr_slice gpr_slice_malloc(size_t length);
+GPRAPI grpc_slice grpc_slice_malloc(size_t length);
/* Create a slice by copying a string.
Does not preserve null terminators.
Equivalent to:
size_t len = strlen(source);
- gpr_slice slice = gpr_slice_malloc(len);
+ grpc_slice slice = grpc_slice_malloc(len);
memcpy(slice->data, source, len); */
-GPRAPI gpr_slice gpr_slice_from_copied_string(const char *source);
+GPRAPI grpc_slice grpc_slice_from_copied_string(const char *source);
/* Create a slice by copying a buffer.
Equivalent to:
- gpr_slice slice = gpr_slice_malloc(len);
+ grpc_slice slice = grpc_slice_malloc(len);
memcpy(slice->data, source, len); */
-GPRAPI gpr_slice gpr_slice_from_copied_buffer(const char *source, size_t len);
+GPRAPI grpc_slice grpc_slice_from_copied_buffer(const char *source, size_t len);
/* Create a slice pointing to constant memory */
-GPRAPI gpr_slice gpr_slice_from_static_string(const char *source);
+GPRAPI grpc_slice grpc_slice_from_static_string(const char *source);
/* Return a result slice derived from s, which shares a ref count with s, where
result.data==s.data+begin, and result.length==end-begin.
The ref count of s is increased by one.
Requires s initialized, begin <= end, begin <= s.length, and
end <= source->length. */
-GPRAPI gpr_slice gpr_slice_sub(gpr_slice s, size_t begin, size_t end);
+GPRAPI grpc_slice grpc_slice_sub(grpc_slice s, size_t begin, size_t end);
-/* The same as gpr_slice_sub, but without altering the ref count */
-GPRAPI gpr_slice gpr_slice_sub_no_ref(gpr_slice s, size_t begin, size_t end);
+/* The same as grpc_slice_sub, but without altering the ref count */
+GPRAPI grpc_slice grpc_slice_sub_no_ref(grpc_slice s, size_t begin, size_t end);
/* Splits s into two: modifies s to be s[0:split], and returns a new slice,
sharing a refcount with s, that contains s[split:s.length].
Requires s intialized, split <= s.length */
-GPRAPI gpr_slice gpr_slice_split_tail(gpr_slice *s, size_t split);
+GPRAPI grpc_slice grpc_slice_split_tail(grpc_slice *s, size_t split);
/* Splits s into two: modifies s to be s[split:s.length], and returns a new
slice, sharing a refcount with s, that contains s[0:split].
Requires s intialized, split <= s.length */
-GPRAPI gpr_slice gpr_slice_split_head(gpr_slice *s, size_t split);
+GPRAPI grpc_slice grpc_slice_split_head(grpc_slice *s, size_t split);
-GPRAPI gpr_slice gpr_empty_slice(void);
+GPRAPI grpc_slice gpr_empty_slice(void);
/* Returns <0 if a < b, ==0 if a == b, >0 if a > b
The order is arbitrary, and is not guaranteed to be stable across different
versions of the API. */
-GPRAPI int gpr_slice_cmp(gpr_slice a, gpr_slice b);
-GPRAPI int gpr_slice_str_cmp(gpr_slice a, const char *b);
+GPRAPI int grpc_slice_cmp(grpc_slice a, grpc_slice b);
+GPRAPI int grpc_slice_str_cmp(grpc_slice a, const char *b);
#ifdef __cplusplus
}
#endif
-#endif /* GRPC_SUPPORT_SLICE_H */
+#endif /* GRPC_SLICE_H */
diff --git a/include/grpc/support/slice_buffer.h b/include/grpc/slice_buffer.h
index 3920432b02..f1de653af4 100644
--- a/include/grpc/support/slice_buffer.h
+++ b/include/grpc/slice_buffer.h
@@ -31,23 +31,23 @@
*
*/
-#ifndef GRPC_SUPPORT_SLICE_BUFFER_H
-#define GRPC_SUPPORT_SLICE_BUFFER_H
+#ifndef GRPC_SLICE_BUFFER_H
+#define GRPC_SLICE_BUFFER_H
-#include <grpc/support/slice.h>
+#include <grpc/slice.h>
#ifdef __cplusplus
extern "C" {
#endif
/* initialize a slice buffer */
-GPRAPI void gpr_slice_buffer_init(gpr_slice_buffer *sb);
+GPRAPI void grpc_slice_buffer_init(grpc_slice_buffer *sb);
/* destroy a slice buffer - unrefs any held elements */
-GPRAPI void gpr_slice_buffer_destroy(gpr_slice_buffer *sb);
+GPRAPI void grpc_slice_buffer_destroy(grpc_slice_buffer *sb);
/* Add an element to a slice buffer - takes ownership of the slice.
This function is allowed to concatenate the passed in slice to the end of
some other slice if desired by the slice buffer. */
-GPRAPI void gpr_slice_buffer_add(gpr_slice_buffer *sb, gpr_slice slice);
+GPRAPI void grpc_slice_buffer_add(grpc_slice_buffer *sb, grpc_slice slice);
/* add an element to a slice buffer - takes ownership of the slice and returns
the index of the slice.
Guarantees that the slice will not be concatenated at the end of another
@@ -55,33 +55,33 @@ GPRAPI void gpr_slice_buffer_add(gpr_slice_buffer *sb, gpr_slice slice);
slice at the returned index in sb->slices)
The implementation MAY decide to concatenate data at the end of a small
slice added in this fashion. */
-GPRAPI size_t gpr_slice_buffer_add_indexed(gpr_slice_buffer *sb,
- gpr_slice slice);
-GPRAPI void gpr_slice_buffer_addn(gpr_slice_buffer *sb, gpr_slice *slices,
- size_t n);
+GPRAPI size_t grpc_slice_buffer_add_indexed(grpc_slice_buffer *sb,
+ grpc_slice slice);
+GPRAPI void grpc_slice_buffer_addn(grpc_slice_buffer *sb, grpc_slice *slices,
+ size_t n);
/* add a very small (less than 8 bytes) amount of data to the end of a slice
buffer: returns a pointer into which to add the data */
-GPRAPI uint8_t *gpr_slice_buffer_tiny_add(gpr_slice_buffer *sb, size_t len);
+GPRAPI uint8_t *grpc_slice_buffer_tiny_add(grpc_slice_buffer *sb, size_t len);
/* pop the last buffer, but don't unref it */
-GPRAPI void gpr_slice_buffer_pop(gpr_slice_buffer *sb);
+GPRAPI void grpc_slice_buffer_pop(grpc_slice_buffer *sb);
/* clear a slice buffer, unref all elements */
-GPRAPI void gpr_slice_buffer_reset_and_unref(gpr_slice_buffer *sb);
+GPRAPI void grpc_slice_buffer_reset_and_unref(grpc_slice_buffer *sb);
/* swap the contents of two slice buffers */
-GPRAPI void gpr_slice_buffer_swap(gpr_slice_buffer *a, gpr_slice_buffer *b);
+GPRAPI void grpc_slice_buffer_swap(grpc_slice_buffer *a, grpc_slice_buffer *b);
/* move all of the elements of src into dst */
-GPRAPI void gpr_slice_buffer_move_into(gpr_slice_buffer *src,
- gpr_slice_buffer *dst);
+GPRAPI void grpc_slice_buffer_move_into(grpc_slice_buffer *src,
+ grpc_slice_buffer *dst);
/* remove n bytes from the end of a slice buffer */
-GPRAPI void gpr_slice_buffer_trim_end(gpr_slice_buffer *src, size_t n,
- gpr_slice_buffer *garbage);
+GPRAPI void grpc_slice_buffer_trim_end(grpc_slice_buffer *src, size_t n,
+ grpc_slice_buffer *garbage);
/* move the first n bytes of src into dst */
-GPRAPI void gpr_slice_buffer_move_first(gpr_slice_buffer *src, size_t n,
- gpr_slice_buffer *dst);
+GPRAPI void grpc_slice_buffer_move_first(grpc_slice_buffer *src, size_t n,
+ grpc_slice_buffer *dst);
/* take the first slice in the slice buffer */
-GPRAPI gpr_slice gpr_slice_buffer_take_first(gpr_slice_buffer *src);
+GPRAPI grpc_slice grpc_slice_buffer_take_first(grpc_slice_buffer *src);
#ifdef __cplusplus
}
#endif
-#endif /* GRPC_SUPPORT_SLICE_BUFFER_H */
+#endif /* GRPC_SLICE_BUFFER_H */
diff --git a/package.xml b/package.xml
index 169553efb3..348ad5f23c 100644
--- a/package.xml
+++ b/package.xml
@@ -64,8 +64,6 @@
<file baseinstalldir="/" name="include/grpc/support/log.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/log_windows.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/port_platform.h" role="src" />
- <file baseinstalldir="/" name="include/grpc/support/slice.h" role="src" />
- <file baseinstalldir="/" name="include/grpc/support/slice_buffer.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/string_util.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/subprocess.h" role="src" />
<file baseinstalldir="/" name="include/grpc/support/sync.h" role="src" />
@@ -96,7 +94,6 @@
<file baseinstalldir="/" name="src/core/lib/support/env.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/mpscq.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/murmur_hash.h" role="src" />
- <file baseinstalldir="/" name="src/core/lib/support/percent_encoding.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/stack_lockfree.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/string.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/string_windows.h" role="src" />
@@ -125,9 +122,6 @@
<file baseinstalldir="/" name="src/core/lib/support/log_windows.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/mpscq.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/murmur_hash.c" role="src" />
- <file baseinstalldir="/" name="src/core/lib/support/percent_encoding.c" role="src" />
- <file baseinstalldir="/" name="src/core/lib/support/slice.c" role="src" />
- <file baseinstalldir="/" name="src/core/lib/support/slice_buffer.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/stack_lockfree.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/string.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/support/string_posix.c" role="src" />
@@ -156,6 +150,8 @@
<file baseinstalldir="/" name="include/grpc/grpc.h" role="src" />
<file baseinstalldir="/" name="include/grpc/grpc_posix.h" role="src" />
<file baseinstalldir="/" name="include/grpc/grpc_security_constants.h" role="src" />
+ <file baseinstalldir="/" name="include/grpc/slice.h" role="src" />
+ <file baseinstalldir="/" name="include/grpc/slice_buffer.h" role="src" />
<file baseinstalldir="/" name="include/grpc/status.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/byte_buffer_reader.h" role="src" />
<file baseinstalldir="/" name="include/grpc/impl/codegen/compression_types.h" role="src" />
@@ -249,6 +245,8 @@
<file baseinstalldir="/" name="src/core/lib/json/json_common.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/json/json_reader.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/json/json_writer.h" role="src" />
+ <file baseinstalldir="/" name="src/core/lib/slice/percent_encoding.h" role="src" />
+ <file baseinstalldir="/" name="src/core/lib/slice/slice_string_helpers.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/api_trace.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/call.h" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/call_test_only.h" role="src" />
@@ -431,6 +429,10 @@
<file baseinstalldir="/" name="src/core/lib/json/json_reader.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/json/json_string.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/json/json_writer.c" role="src" />
+ <file baseinstalldir="/" name="src/core/lib/slice/percent_encoding.c" role="src" />
+ <file baseinstalldir="/" name="src/core/lib/slice/slice.c" role="src" />
+ <file baseinstalldir="/" name="src/core/lib/slice/slice_buffer.c" role="src" />
+ <file baseinstalldir="/" name="src/core/lib/slice/slice_string_helpers.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/alarm.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/api_trace.c" role="src" />
<file baseinstalldir="/" name="src/core/lib/surface/byte_buffer.c" role="src" />
diff --git a/src/core/ext/census/grpc_filter.c b/src/core/ext/census/grpc_filter.c
index a4cf6f37bd..5a283de468 100644
--- a/src/core/ext/census/grpc_filter.c
+++ b/src/core/ext/census/grpc_filter.c
@@ -37,9 +37,9 @@
#include <string.h>
#include <grpc/census.h>
+#include <grpc/slice.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/slice.h>
#include <grpc/support/time.h>
#include "src/core/ext/census/census_interface.h"
@@ -69,7 +69,7 @@ static void extract_and_annotate_method_tag(grpc_metadata_batch *md,
for (m = md->list.head; m != NULL; m = m->next) {
if (m->md->key == GRPC_MDSTR_PATH) {
gpr_log(GPR_DEBUG, "%s",
- (const char *)GPR_SLICE_START_PTR(m->md->value->slice));
+ (const char *)GRPC_SLICE_START_PTR(m->md->value->slice));
/* Add method tag here */
}
}
diff --git a/src/core/ext/census/trace_context.h b/src/core/ext/census/trace_context.h
index ee71fef460..1cb5e26ea7 100644
--- a/src/core/ext/census/trace_context.h
+++ b/src/core/ext/census/trace_context.h
@@ -65,4 +65,4 @@ of these do not exist. On success, returns true and false otherwise. */
bool decode_trace_context(google_trace_TraceContext *ctxt, uint8_t *buffer,
const size_t nbytes);
-#endif
+#endif /* GRPC_CORE_EXT_CENSUS_TRACE_CONTEXT_H */
diff --git a/src/core/ext/client_channel/connector.h b/src/core/ext/client_channel/connector.h
index ed7d5450de..3de061620e 100644
--- a/src/core/ext/client_channel/connector.h
+++ b/src/core/ext/client_channel/connector.h
@@ -52,7 +52,7 @@ typedef struct {
const grpc_resolved_address *addr;
size_t addr_len;
/** initial connect string to send */
- gpr_slice initial_connect_string;
+ grpc_slice initial_connect_string;
/** deadline for connection */
gpr_timespec deadline;
/** channel arguments (to be passed to transport) */
diff --git a/src/core/ext/client_channel/default_initial_connect_string.c b/src/core/ext/client_channel/default_initial_connect_string.c
index 0b251372fd..6db82d84ef 100644
--- a/src/core/ext/client_channel/default_initial_connect_string.c
+++ b/src/core/ext/client_channel/default_initial_connect_string.c
@@ -31,8 +31,8 @@
*
*/
-#include <grpc/support/slice.h>
+#include <grpc/slice.h>
#include "src/core/lib/iomgr/resolve_address.h"
void grpc_set_default_initial_connect_string(grpc_resolved_address **addr,
- gpr_slice *initial_str) {}
+ grpc_slice *initial_str) {}
diff --git a/src/core/ext/client_channel/http_connect_handshaker.c b/src/core/ext/client_channel/http_connect_handshaker.c
index ea2cbbdd97..82042897b2 100644
--- a/src/core/ext/client_channel/http_connect_handshaker.c
+++ b/src/core/ext/client_channel/http_connect_handshaker.c
@@ -35,9 +35,9 @@
#include <string.h>
+#include <grpc/slice_buffer.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/slice_buffer.h>
#include <grpc/support/string_util.h>
#include "src/core/ext/client_channel/uri_parser.h"
@@ -60,8 +60,8 @@ typedef struct http_connect_handshaker {
void* user_data;
// Objects for processing the HTTP CONNECT request and response.
- gpr_slice_buffer write_buffer;
- gpr_slice_buffer* read_buffer; // Ownership passes through this object.
+ grpc_slice_buffer write_buffer;
+ grpc_slice_buffer* read_buffer; // Ownership passes through this object.
grpc_closure request_done_closure;
grpc_closure response_read_closure;
grpc_http_parser http_parser;
@@ -76,7 +76,7 @@ static void http_connect_handshaker_unref(http_connect_handshaker* handshaker) {
if (gpr_unref(&handshaker->refcount)) {
gpr_free(handshaker->proxy_server);
gpr_free(handshaker->server_name);
- gpr_slice_buffer_destroy(&handshaker->write_buffer);
+ grpc_slice_buffer_destroy(&handshaker->write_buffer);
grpc_http_parser_destroy(&handshaker->http_parser);
grpc_http_response_destroy(&handshaker->http_response);
gpr_free(handshaker);
@@ -118,7 +118,7 @@ static void on_read_done(grpc_exec_ctx* exec_ctx, void* arg,
}
// Add buffer to parser.
for (size_t i = 0; i < handshaker->read_buffer->count; ++i) {
- if (GPR_SLICE_LENGTH(handshaker->read_buffer->slices[i]) > 0) {
+ if (GRPC_SLICE_LENGTH(handshaker->read_buffer->slices[i]) > 0) {
size_t body_start_offset = 0;
error = grpc_http_parser_parse(&handshaker->http_parser,
handshaker->read_buffer->slices[i],
@@ -129,20 +129,20 @@ static void on_read_done(grpc_exec_ctx* exec_ctx, void* arg,
grpc_timer_cancel(exec_ctx, &handshaker->timeout_timer);
// Remove the data we've already read from the read buffer,
// leaving only the leftover bytes (if any).
- gpr_slice_buffer tmp_buffer;
- gpr_slice_buffer_init(&tmp_buffer);
+ grpc_slice_buffer tmp_buffer;
+ grpc_slice_buffer_init(&tmp_buffer);
if (body_start_offset <
- GPR_SLICE_LENGTH(handshaker->read_buffer->slices[i])) {
- gpr_slice_buffer_add(
+ GRPC_SLICE_LENGTH(handshaker->read_buffer->slices[i])) {
+ grpc_slice_buffer_add(
&tmp_buffer,
- gpr_slice_split_tail(&handshaker->read_buffer->slices[i],
- body_start_offset));
+ grpc_slice_split_tail(&handshaker->read_buffer->slices[i],
+ body_start_offset));
}
- gpr_slice_buffer_addn(&tmp_buffer,
- &handshaker->read_buffer->slices[i + 1],
- handshaker->read_buffer->count - i - 1);
- gpr_slice_buffer_swap(handshaker->read_buffer, &tmp_buffer);
- gpr_slice_buffer_destroy(&tmp_buffer);
+ grpc_slice_buffer_addn(&tmp_buffer,
+ &handshaker->read_buffer->slices[i + 1],
+ handshaker->read_buffer->count - i - 1);
+ grpc_slice_buffer_swap(handshaker->read_buffer, &tmp_buffer);
+ grpc_slice_buffer_destroy(&tmp_buffer);
break;
}
}
@@ -159,7 +159,7 @@ static void on_read_done(grpc_exec_ctx* exec_ctx, void* arg,
// complete (e.g., handling chunked transfer encoding or looking
// at the Content-Length: header).
if (handshaker->http_parser.state != GRPC_HTTP_BODY) {
- gpr_slice_buffer_reset_and_unref(handshaker->read_buffer);
+ grpc_slice_buffer_reset_and_unref(handshaker->read_buffer);
grpc_endpoint_read(exec_ctx, handshaker->endpoint, handshaker->read_buffer,
&handshaker->response_read_closure);
return;
@@ -195,7 +195,7 @@ static void http_connect_handshaker_shutdown(grpc_exec_ctx* exec_ctx,
static void http_connect_handshaker_do_handshake(
grpc_exec_ctx* exec_ctx, grpc_handshaker* handshaker_in,
grpc_endpoint* endpoint, grpc_channel_args* args,
- gpr_slice_buffer* read_buffer, gpr_timespec deadline,
+ grpc_slice_buffer* read_buffer, gpr_timespec deadline,
grpc_tcp_server_acceptor* acceptor, grpc_handshaker_done_cb cb,
void* user_data) {
http_connect_handshaker* handshaker = (http_connect_handshaker*)handshaker_in;
@@ -214,8 +214,8 @@ static void http_connect_handshaker_do_handshake(
request.http.method = "CONNECT";
request.http.path = handshaker->server_name;
request.handshaker = &grpc_httpcli_plaintext;
- gpr_slice request_slice = grpc_httpcli_format_connect_request(&request);
- gpr_slice_buffer_add(&handshaker->write_buffer, request_slice);
+ grpc_slice request_slice = grpc_httpcli_format_connect_request(&request);
+ grpc_slice_buffer_add(&handshaker->write_buffer, request_slice);
grpc_endpoint_write(exec_ctx, endpoint, &handshaker->write_buffer,
&handshaker->request_done_closure);
// Set timeout timer. The timer gets a reference to the handshaker.
@@ -239,7 +239,7 @@ grpc_handshaker* grpc_http_connect_handshaker_create(const char* proxy_server,
grpc_handshaker_init(&http_connect_handshaker_vtable, &handshaker->base);
handshaker->proxy_server = gpr_strdup(proxy_server);
handshaker->server_name = gpr_strdup(server_name);
- gpr_slice_buffer_init(&handshaker->write_buffer);
+ grpc_slice_buffer_init(&handshaker->write_buffer);
grpc_closure_init(&handshaker->request_done_closure, on_write_done,
handshaker);
grpc_closure_init(&handshaker->response_read_closure, on_read_done,
diff --git a/src/core/ext/client_channel/initial_connect_string.c b/src/core/ext/client_channel/initial_connect_string.c
index fb1493d77d..8ebd06c458 100644
--- a/src/core/ext/client_channel/initial_connect_string.c
+++ b/src/core/ext/client_channel/initial_connect_string.c
@@ -36,7 +36,7 @@
#include <stddef.h>
extern void grpc_set_default_initial_connect_string(
- grpc_resolved_address **addr, gpr_slice *initial_str);
+ grpc_resolved_address **addr, grpc_slice *initial_str);
static grpc_set_initial_connect_string_func g_set_initial_connect_string_func =
grpc_set_default_initial_connect_string;
@@ -47,6 +47,6 @@ void grpc_test_set_initial_connect_string_function(
}
void grpc_set_initial_connect_string(grpc_resolved_address **addr,
- gpr_slice *initial_str) {
+ grpc_slice *initial_str) {
g_set_initial_connect_string_func(addr, initial_str);
}
diff --git a/src/core/ext/client_channel/initial_connect_string.h b/src/core/ext/client_channel/initial_connect_string.h
index 68adb0373c..876abea40e 100644
--- a/src/core/ext/client_channel/initial_connect_string.h
+++ b/src/core/ext/client_channel/initial_connect_string.h
@@ -34,17 +34,17 @@
#ifndef GRPC_CORE_EXT_CLIENT_CHANNEL_INITIAL_CONNECT_STRING_H
#define GRPC_CORE_EXT_CLIENT_CHANNEL_INITIAL_CONNECT_STRING_H
-#include <grpc/support/slice.h>
-
+#include <grpc/slice.h>
#include "src/core/lib/iomgr/resolve_address.h"
typedef void (*grpc_set_initial_connect_string_func)(
- grpc_resolved_address **addr, gpr_slice *initial_str);
+ grpc_resolved_address **addr, grpc_slice *initial_str);
+
void grpc_test_set_initial_connect_string_function(
grpc_set_initial_connect_string_func func);
/** Set a string to be sent once connected. Optionally reset addr. */
void grpc_set_initial_connect_string(grpc_resolved_address **addr,
- gpr_slice *connect_string);
+ grpc_slice *connect_string);
#endif /* GRPC_CORE_EXT_CLIENT_CHANNEL_INITIAL_CONNECT_STRING_H */
diff --git a/src/core/ext/client_channel/subchannel.c b/src/core/ext/client_channel/subchannel.c
index 789966cb69..a5d7c0df45 100644
--- a/src/core/ext/client_channel/subchannel.c
+++ b/src/core/ext/client_channel/subchannel.c
@@ -100,7 +100,7 @@ struct grpc_subchannel {
grpc_subchannel_key *key;
/** initial string to send to peer */
- gpr_slice initial_connect_string;
+ grpc_slice initial_connect_string;
/** set during connection */
grpc_connect_out_args connecting_result;
@@ -206,7 +206,7 @@ static void subchannel_destroy(grpc_exec_ctx *exec_ctx, void *arg,
gpr_free((void *)c->filters);
grpc_channel_args_destroy(c->args);
gpr_free(c->addr);
- gpr_slice_unref(c->initial_connect_string);
+ grpc_slice_unref(c->initial_connect_string);
grpc_connectivity_state_destroy(exec_ctx, &c->state_tracker);
grpc_connector_unref(exec_ctx, c->connector);
grpc_pollset_set_destroy(c->pollset_set);
diff --git a/src/core/ext/client_channel/uri_parser.c b/src/core/ext/client_channel/uri_parser.c
index bcb6a1dee4..0fbc542ef8 100644
--- a/src/core/ext/client_channel/uri_parser.c
+++ b/src/core/ext/client_channel/uri_parser.c
@@ -35,13 +35,14 @@
#include <string.h>
+#include <grpc/slice.h>
+#include <grpc/slice_buffer.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
-#include <grpc/support/slice.h>
-#include <grpc/support/slice_buffer.h>
#include <grpc/support/string_util.h>
+#include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/lib/support/string.h"
/** a size_t default value... maps to all 1's */
@@ -148,38 +149,38 @@ static void parse_query_parts(grpc_uri *uri) {
uri->num_query_parts = 0;
return;
}
- gpr_slice query_slice =
- gpr_slice_new(uri->query, strlen(uri->query), do_nothing);
- gpr_slice_buffer query_parts; /* the &-separated elements of the query */
- gpr_slice_buffer query_param_parts; /* the =-separated subelements */
+ grpc_slice query_slice =
+ grpc_slice_new(uri->query, strlen(uri->query), do_nothing);
+ grpc_slice_buffer query_parts; /* the &-separated elements of the query */
+ grpc_slice_buffer query_param_parts; /* the =-separated subelements */
- gpr_slice_buffer_init(&query_parts);
- gpr_slice_buffer_init(&query_param_parts);
+ grpc_slice_buffer_init(&query_parts);
+ grpc_slice_buffer_init(&query_param_parts);
- gpr_slice_split(query_slice, QUERY_PARTS_SEPARATOR, &query_parts);
+ grpc_slice_split(query_slice, QUERY_PARTS_SEPARATOR, &query_parts);
uri->query_parts = gpr_malloc(query_parts.count * sizeof(char *));
uri->query_parts_values = gpr_malloc(query_parts.count * sizeof(char *));
uri->num_query_parts = query_parts.count;
for (size_t i = 0; i < query_parts.count; i++) {
- gpr_slice_split(query_parts.slices[i], QUERY_PARTS_VALUE_SEPARATOR,
- &query_param_parts);
+ grpc_slice_split(query_parts.slices[i], QUERY_PARTS_VALUE_SEPARATOR,
+ &query_param_parts);
GPR_ASSERT(query_param_parts.count > 0);
uri->query_parts[i] =
- gpr_dump_slice(query_param_parts.slices[0], GPR_DUMP_ASCII);
+ grpc_dump_slice(query_param_parts.slices[0], GPR_DUMP_ASCII);
if (query_param_parts.count > 1) {
/* TODO(dgq): only the first value after the separator is considered.
* Perhaps all chars after the first separator for the query part should
* be included, even if they include the separator. */
uri->query_parts_values[i] =
- gpr_dump_slice(query_param_parts.slices[1], GPR_DUMP_ASCII);
+ grpc_dump_slice(query_param_parts.slices[1], GPR_DUMP_ASCII);
} else {
uri->query_parts_values[i] = NULL;
}
- gpr_slice_buffer_reset_and_unref(&query_param_parts);
+ grpc_slice_buffer_reset_and_unref(&query_param_parts);
}
- gpr_slice_buffer_destroy(&query_parts);
- gpr_slice_buffer_destroy(&query_param_parts);
- gpr_slice_unref(query_slice);
+ grpc_slice_buffer_destroy(&query_parts);
+ grpc_slice_buffer_destroy(&query_param_parts);
+ grpc_slice_unref(query_slice);
}
grpc_uri *grpc_uri_parse(const char *uri_text, int suppress_errors) {
diff --git a/src/core/ext/lb_policy/grpclb/grpclb.c b/src/core/ext/lb_policy/grpclb/grpclb.c
index 6249f8b80f..41e177c495 100644
--- a/src/core/ext/lb_policy/grpclb/grpclb.c
+++ b/src/core/ext/lb_policy/grpclb/grpclb.c
@@ -116,6 +116,7 @@
#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/iomgr/sockaddr_utils.h"
#include "src/core/lib/iomgr/timer.h"
+#include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/lib/support/backoff.h"
#include "src/core/lib/support/string.h"
#include "src/core/lib/surface/call.h"
@@ -971,10 +972,10 @@ static void lb_call_init(glb_lb_policy *glb_policy) {
grpc_grpclb_request *request =
grpc_grpclb_request_create(glb_policy->server_name);
- gpr_slice request_payload_slice = grpc_grpclb_request_encode(request);
+ grpc_slice request_payload_slice = grpc_grpclb_request_encode(request);
glb_policy->lb_request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
- gpr_slice_unref(request_payload_slice);
+ grpc_slice_unref(request_payload_slice);
grpc_grpclb_request_destroy(request);
glb_policy->lb_call_status_details = NULL;
@@ -1086,13 +1087,13 @@ static void lb_on_response_received(grpc_exec_ctx *exec_ctx, void *arg,
* glb_policy->lb_response_payload, for a serverlist. */
grpc_byte_buffer_reader bbr;
grpc_byte_buffer_reader_init(&bbr, glb_policy->lb_response_payload);
- gpr_slice response_slice = grpc_byte_buffer_reader_readall(&bbr);
+ grpc_slice response_slice = grpc_byte_buffer_reader_readall(&bbr);
grpc_byte_buffer_destroy(glb_policy->lb_response_payload);
grpc_grpclb_serverlist *serverlist =
grpc_grpclb_response_parse_serverlist(response_slice);
if (serverlist != NULL) {
GPR_ASSERT(glb_policy->lb_call != NULL);
- gpr_slice_unref(response_slice);
+ grpc_slice_unref(response_slice);
if (grpc_lb_glb_trace) {
gpr_log(GPR_INFO, "Serverlist with %lu servers received",
(unsigned long)serverlist->num_servers);
@@ -1134,8 +1135,8 @@ static void lb_on_response_received(grpc_exec_ctx *exec_ctx, void *arg,
}
} else { /* serverlist == NULL */
gpr_log(GPR_ERROR, "Invalid LB response received: '%s'. Ignoring.",
- gpr_dump_slice(response_slice, GPR_DUMP_ASCII | GPR_DUMP_HEX));
- gpr_slice_unref(response_slice);
+ grpc_dump_slice(response_slice, GPR_DUMP_ASCII | GPR_DUMP_HEX));
+ grpc_slice_unref(response_slice);
}
if (!glb_policy->shutting_down) {
diff --git a/src/core/ext/lb_policy/grpclb/load_balancer_api.c b/src/core/ext/lb_policy/grpclb/load_balancer_api.c
index a8881004a0..837e9c1113 100644
--- a/src/core/ext/lb_policy/grpclb/load_balancer_api.c
+++ b/src/core/ext/lb_policy/grpclb/load_balancer_api.c
@@ -90,18 +90,18 @@ grpc_grpclb_request *grpc_grpclb_request_create(const char *lb_service_name) {
return req;
}
-gpr_slice grpc_grpclb_request_encode(const grpc_grpclb_request *request) {
+grpc_slice grpc_grpclb_request_encode(const grpc_grpclb_request *request) {
size_t encoded_length;
pb_ostream_t sizestream;
pb_ostream_t outputstream;
- gpr_slice slice;
+ grpc_slice slice;
memset(&sizestream, 0, sizeof(pb_ostream_t));
pb_encode(&sizestream, grpc_lb_v1_LoadBalanceRequest_fields, request);
encoded_length = sizestream.bytes_written;
- slice = gpr_slice_malloc(encoded_length);
+ slice = grpc_slice_malloc(encoded_length);
outputstream =
- pb_ostream_from_buffer(GPR_SLICE_START_PTR(slice), encoded_length);
+ pb_ostream_from_buffer(GRPC_SLICE_START_PTR(slice), encoded_length);
GPR_ASSERT(pb_encode(&outputstream, grpc_lb_v1_LoadBalanceRequest_fields,
request) != 0);
return slice;
@@ -113,10 +113,10 @@ void grpc_grpclb_request_destroy(grpc_grpclb_request *request) {
typedef grpc_lb_v1_LoadBalanceResponse grpc_grpclb_response;
grpc_grpclb_initial_response *grpc_grpclb_initial_response_parse(
- gpr_slice encoded_grpc_grpclb_response) {
+ grpc_slice encoded_grpc_grpclb_response) {
pb_istream_t stream =
- pb_istream_from_buffer(GPR_SLICE_START_PTR(encoded_grpc_grpclb_response),
- GPR_SLICE_LENGTH(encoded_grpc_grpclb_response));
+ pb_istream_from_buffer(GRPC_SLICE_START_PTR(encoded_grpc_grpclb_response),
+ GRPC_SLICE_LENGTH(encoded_grpc_grpclb_response));
grpc_grpclb_response res;
memset(&res, 0, sizeof(grpc_grpclb_response));
if (!pb_decode(&stream, grpc_lb_v1_LoadBalanceResponse_fields, &res)) {
@@ -132,12 +132,12 @@ grpc_grpclb_initial_response *grpc_grpclb_initial_response_parse(
}
grpc_grpclb_serverlist *grpc_grpclb_response_parse_serverlist(
- gpr_slice encoded_grpc_grpclb_response) {
+ grpc_slice encoded_grpc_grpclb_response) {
bool status;
decode_serverlist_arg arg;
pb_istream_t stream =
- pb_istream_from_buffer(GPR_SLICE_START_PTR(encoded_grpc_grpclb_response),
- GPR_SLICE_LENGTH(encoded_grpc_grpclb_response));
+ pb_istream_from_buffer(GRPC_SLICE_START_PTR(encoded_grpc_grpclb_response),
+ GRPC_SLICE_LENGTH(encoded_grpc_grpclb_response));
pb_istream_t stream_at_start = stream;
grpc_grpclb_response res;
memset(&res, 0, sizeof(grpc_grpclb_response));
diff --git a/src/core/ext/lb_policy/grpclb/load_balancer_api.h b/src/core/ext/lb_policy/grpclb/load_balancer_api.h
index 079a64a3f3..b4c967e426 100644
--- a/src/core/ext/lb_policy/grpclb/load_balancer_api.h
+++ b/src/core/ext/lb_policy/grpclb/load_balancer_api.h
@@ -34,7 +34,7 @@
#ifndef GRPC_CORE_EXT_LB_POLICY_GRPCLB_LOAD_BALANCER_API_H
#define GRPC_CORE_EXT_LB_POLICY_GRPCLB_LOAD_BALANCER_API_H
-#include <grpc/support/slice_buffer.h>
+#include <grpc/slice_buffer.h>
#include "src/core/ext/client_channel/lb_policy_factory.h"
#include "src/core/ext/lb_policy/grpclb/proto/grpc/lb/v1/load_balancer.pb.h"
@@ -60,7 +60,7 @@ typedef struct grpc_grpclb_serverlist {
grpc_grpclb_request *grpc_grpclb_request_create(const char *lb_service_name);
/** Protocol Buffers v3-encode \a request */
-gpr_slice grpc_grpclb_request_encode(const grpc_grpclb_request *request);
+grpc_slice grpc_grpclb_request_encode(const grpc_grpclb_request *request);
/** Destroy \a request */
void grpc_grpclb_request_destroy(grpc_grpclb_request *request);
@@ -68,11 +68,11 @@ void grpc_grpclb_request_destroy(grpc_grpclb_request *request);
/** Parse (ie, decode) the bytes in \a encoded_grpc_grpclb_response as a \a
* grpc_grpclb_initial_response */
grpc_grpclb_initial_response *grpc_grpclb_initial_response_parse(
- gpr_slice encoded_grpc_grpclb_response);
+ grpc_slice encoded_grpc_grpclb_response);
/** Parse the list of servers from an encoded \a grpc_grpclb_response */
grpc_grpclb_serverlist *grpc_grpclb_response_parse_serverlist(
- gpr_slice encoded_grpc_grpclb_response);
+ grpc_slice encoded_grpc_grpclb_response);
/** Return a copy of \a sl. The caller is responsible for calling \a
* grpc_grpclb_destroy_serverlist on the returned copy. */
diff --git a/src/core/ext/resolver/sockaddr/sockaddr_resolver.c b/src/core/ext/resolver/sockaddr/sockaddr_resolver.c
index 5fec03a8e4..26a650aadd 100644
--- a/src/core/ext/resolver/sockaddr/sockaddr_resolver.c
+++ b/src/core/ext/resolver/sockaddr/sockaddr_resolver.c
@@ -47,6 +47,7 @@
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/iomgr/resolve_address.h"
#include "src/core/lib/iomgr/unix_sockets_posix.h"
+#include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/lib/support/string.h"
typedef struct {
@@ -169,17 +170,17 @@ static grpc_resolver *sockaddr_create(grpc_resolver_args *args,
return NULL;
}
/* Construct addresses. */
- gpr_slice path_slice =
- gpr_slice_new(args->uri->path, strlen(args->uri->path), do_nothing);
- gpr_slice_buffer path_parts;
- gpr_slice_buffer_init(&path_parts);
- gpr_slice_split(path_slice, ",", &path_parts);
+ grpc_slice path_slice =
+ grpc_slice_new(args->uri->path, strlen(args->uri->path), do_nothing);
+ grpc_slice_buffer path_parts;
+ grpc_slice_buffer_init(&path_parts);
+ grpc_slice_split(path_slice, ",", &path_parts);
grpc_lb_addresses *addresses =
grpc_lb_addresses_create(path_parts.count, NULL /* user_data_vtable */);
bool errors_found = false;
for (size_t i = 0; i < addresses->num_addresses; i++) {
grpc_uri ith_uri = *args->uri;
- char *part_str = gpr_dump_slice(path_parts.slices[i], GPR_DUMP_ASCII);
+ char *part_str = grpc_dump_slice(path_parts.slices[i], GPR_DUMP_ASCII);
ith_uri.path = part_str;
if (!parse(&ith_uri, &addresses->addresses[i].address)) {
errors_found = true; /* GPR_TRUE */
@@ -187,8 +188,8 @@ static grpc_resolver *sockaddr_create(grpc_resolver_args *args,
gpr_free(part_str);
if (errors_found) break;
}
- gpr_slice_buffer_destroy(&path_parts);
- gpr_slice_unref(path_slice);
+ grpc_slice_buffer_destroy(&path_parts);
+ grpc_slice_unref(path_slice);
if (errors_found) {
grpc_lb_addresses_destroy(addresses);
return NULL;
diff --git a/src/core/ext/transport/chttp2/client/insecure/channel_create.c b/src/core/ext/transport/chttp2/client/insecure/channel_create.c
index 71a06e118b..8e03fd82c1 100644
--- a/src/core/ext/transport/chttp2/client/insecure/channel_create.c
+++ b/src/core/ext/transport/chttp2/client/insecure/channel_create.c
@@ -36,9 +36,9 @@
#include <stdlib.h>
#include <string.h>
+#include <grpc/slice.h>
+#include <grpc/slice_buffer.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/slice.h>
-#include <grpc/support/slice_buffer.h>
#include "src/core/ext/client_channel/client_channel.h"
#include "src/core/ext/client_channel/http_connect_handshaker.h"
@@ -64,7 +64,7 @@ typedef struct {
grpc_connect_in_args args;
grpc_connect_out_args *result;
grpc_closure initial_string_sent;
- gpr_slice_buffer initial_string_buffer;
+ grpc_slice_buffer initial_string_buffer;
grpc_endpoint *tcp;
@@ -94,7 +94,7 @@ static void on_initial_connect_string_sent(grpc_exec_ctx *exec_ctx, void *arg,
static void on_handshake_done(grpc_exec_ctx *exec_ctx, grpc_endpoint *endpoint,
grpc_channel_args *args,
- gpr_slice_buffer *read_buffer, void *user_data,
+ grpc_slice_buffer *read_buffer, void *user_data,
grpc_error *error) {
connector *c = user_data;
if (error != GRPC_ERROR_NONE) {
@@ -117,12 +117,12 @@ static void connected(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
connector *c = arg;
grpc_endpoint *tcp = c->tcp;
if (tcp != NULL) {
- if (!GPR_SLICE_IS_EMPTY(c->args.initial_connect_string)) {
+ if (!GRPC_SLICE_IS_EMPTY(c->args.initial_connect_string)) {
grpc_closure_init(&c->initial_string_sent, on_initial_connect_string_sent,
c);
- gpr_slice_buffer_init(&c->initial_string_buffer);
- gpr_slice_buffer_add(&c->initial_string_buffer,
- c->args.initial_connect_string);
+ grpc_slice_buffer_init(&c->initial_string_buffer);
+ grpc_slice_buffer_add(&c->initial_string_buffer,
+ c->args.initial_connect_string);
connector_ref(arg);
grpc_endpoint_write(exec_ctx, tcp, &c->initial_string_buffer,
&c->initial_string_sent);
diff --git a/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c b/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c
index d0ac72a011..04c88a2d36 100644
--- a/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c
+++ b/src/core/ext/transport/chttp2/client/secure/secure_channel_create.c
@@ -36,9 +36,9 @@
#include <stdlib.h>
#include <string.h>
+#include <grpc/slice.h>
+#include <grpc/slice_buffer.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/slice.h>
-#include <grpc/support/slice_buffer.h>
#include "src/core/ext/client_channel/client_channel.h"
#include "src/core/ext/client_channel/http_connect_handshaker.h"
@@ -68,7 +68,7 @@ typedef struct {
grpc_connect_in_args args;
grpc_connect_out_args *result;
grpc_closure initial_string_sent;
- gpr_slice_buffer initial_string_buffer;
+ grpc_slice_buffer initial_string_buffer;
gpr_mu mu;
grpc_endpoint *connecting_endpoint;
@@ -131,7 +131,7 @@ static void on_secure_handshake_done(grpc_exec_ctx *exec_ctx, void *arg,
static void on_handshake_done(grpc_exec_ctx *exec_ctx, grpc_endpoint *endpoint,
grpc_channel_args *args,
- gpr_slice_buffer *read_buffer, void *user_data,
+ grpc_slice_buffer *read_buffer, void *user_data,
grpc_error *error) {
connector *c = user_data;
c->tmp_args = args;
@@ -166,12 +166,12 @@ static void connected(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
GPR_ASSERT(c->connecting_endpoint == NULL);
c->connecting_endpoint = tcp;
gpr_mu_unlock(&c->mu);
- if (!GPR_SLICE_IS_EMPTY(c->args.initial_connect_string)) {
+ if (!GRPC_SLICE_IS_EMPTY(c->args.initial_connect_string)) {
grpc_closure_init(&c->initial_string_sent, on_initial_connect_string_sent,
c);
- gpr_slice_buffer_init(&c->initial_string_buffer);
- gpr_slice_buffer_add(&c->initial_string_buffer,
- c->args.initial_connect_string);
+ grpc_slice_buffer_init(&c->initial_string_buffer);
+ grpc_slice_buffer_add(&c->initial_string_buffer,
+ c->args.initial_connect_string);
grpc_endpoint_write(exec_ctx, tcp, &c->initial_string_buffer,
&c->initial_string_sent);
} else {
diff --git a/src/core/ext/transport/chttp2/server/insecure/server_chttp2.c b/src/core/ext/transport/chttp2/server/insecure/server_chttp2.c
index d42611b863..c18d618f96 100644
--- a/src/core/ext/transport/chttp2/server/insecure/server_chttp2.c
+++ b/src/core/ext/transport/chttp2/server/insecure/server_chttp2.c
@@ -56,7 +56,7 @@ typedef struct server_connect_state {
static void on_handshake_done(grpc_exec_ctx *exec_ctx, grpc_endpoint *endpoint,
grpc_channel_args *args,
- gpr_slice_buffer *read_buffer, void *user_data,
+ grpc_slice_buffer *read_buffer, void *user_data,
grpc_error *error) {
server_connect_state *state = user_data;
if (error != GRPC_ERROR_NONE) {
diff --git a/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c b/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c
index 7ad687042d..942638ad7f 100644
--- a/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c
+++ b/src/core/ext/transport/chttp2/server/secure/server_secure_chttp2.c
@@ -117,7 +117,7 @@ static void on_secure_handshake_done(grpc_exec_ctx *exec_ctx, void *statep,
static void on_handshake_done(grpc_exec_ctx *exec_ctx, grpc_endpoint *endpoint,
grpc_channel_args *args,
- gpr_slice_buffer *read_buffer, void *user_data,
+ grpc_slice_buffer *read_buffer, void *user_data,
grpc_error *error) {
server_secure_connect *connection_state = user_data;
if (error != GRPC_ERROR_NONE) {
diff --git a/src/core/ext/transport/chttp2/transport/bin_decoder.c b/src/core/ext/transport/chttp2/transport/bin_decoder.c
index 2d90b01cd8..3eef80b557 100644
--- a/src/core/ext/transport/chttp2/transport/bin_decoder.c
+++ b/src/core/ext/transport/chttp2/transport/bin_decoder.c
@@ -34,6 +34,7 @@
#include "src/core/ext/transport/chttp2/transport/bin_decoder.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
+#include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/lib/support/string.h"
static uint8_t decode_table[] = {
@@ -142,11 +143,11 @@ bool grpc_base64_decode_partial(struct grpc_base64_decode_context *ctx) {
return true;
}
-gpr_slice grpc_chttp2_base64_decode(gpr_slice input) {
- size_t input_length = GPR_SLICE_LENGTH(input);
+grpc_slice grpc_chttp2_base64_decode(grpc_slice input) {
+ size_t input_length = GRPC_SLICE_LENGTH(input);
size_t output_length = input_length / 4 * 3;
struct grpc_base64_decode_context ctx;
- gpr_slice output;
+ grpc_slice output;
if (input_length % 4 != 0) {
gpr_log(GPR_ERROR,
@@ -158,7 +159,7 @@ gpr_slice grpc_chttp2_base64_decode(gpr_slice input) {
}
if (input_length > 0) {
- uint8_t *input_end = GPR_SLICE_END_PTR(input);
+ uint8_t *input_end = GRPC_SLICE_END_PTR(input);
if (*(--input_end) == '=') {
output_length--;
if (*(--input_end) == '=') {
@@ -166,30 +167,30 @@ gpr_slice grpc_chttp2_base64_decode(gpr_slice input) {
}
}
}
- output = gpr_slice_malloc(output_length);
+ output = grpc_slice_malloc(output_length);
- ctx.input_cur = GPR_SLICE_START_PTR(input);
- ctx.input_end = GPR_SLICE_END_PTR(input);
- ctx.output_cur = GPR_SLICE_START_PTR(output);
- ctx.output_end = GPR_SLICE_END_PTR(output);
+ ctx.input_cur = GRPC_SLICE_START_PTR(input);
+ ctx.input_end = GRPC_SLICE_END_PTR(input);
+ ctx.output_cur = GRPC_SLICE_START_PTR(output);
+ ctx.output_end = GRPC_SLICE_END_PTR(output);
ctx.contains_tail = false;
if (!grpc_base64_decode_partial(&ctx)) {
- char *s = gpr_dump_slice(input, GPR_DUMP_ASCII);
+ char *s = grpc_dump_slice(input, GPR_DUMP_ASCII);
gpr_log(GPR_ERROR, "Base64 decoding failed, input string:\n%s\n", s);
gpr_free(s);
- gpr_slice_unref(output);
+ grpc_slice_unref(output);
return gpr_empty_slice();
}
- GPR_ASSERT(ctx.output_cur == GPR_SLICE_END_PTR(output));
- GPR_ASSERT(ctx.input_cur == GPR_SLICE_END_PTR(input));
+ GPR_ASSERT(ctx.output_cur == GRPC_SLICE_END_PTR(output));
+ GPR_ASSERT(ctx.input_cur == GRPC_SLICE_END_PTR(input));
return output;
}
-gpr_slice grpc_chttp2_base64_decode_with_length(gpr_slice input,
- size_t output_length) {
- size_t input_length = GPR_SLICE_LENGTH(input);
- gpr_slice output = gpr_slice_malloc(output_length);
+grpc_slice grpc_chttp2_base64_decode_with_length(grpc_slice input,
+ size_t output_length) {
+ size_t input_length = GRPC_SLICE_LENGTH(input);
+ grpc_slice output = grpc_slice_malloc(output_length);
struct grpc_base64_decode_context ctx;
// The length of a base64 string cannot be 4 * n + 1
@@ -199,7 +200,7 @@ gpr_slice grpc_chttp2_base64_decode_with_length(gpr_slice input,
"grpc_chttp2_base64_decode_with_length has a length of %d, which "
"has a tail of 1 byte.\n",
(int)input_length);
- gpr_slice_unref(output);
+ grpc_slice_unref(output);
return gpr_empty_slice();
}
@@ -209,24 +210,24 @@ gpr_slice grpc_chttp2_base64_decode_with_length(gpr_slice input,
"than the max possible output length %d.\n",
(int)output_length,
(int)(input_length / 4 * 3 + tail_xtra[input_length % 4]));
- gpr_slice_unref(output);
+ grpc_slice_unref(output);
return gpr_empty_slice();
}
- ctx.input_cur = GPR_SLICE_START_PTR(input);
- ctx.input_end = GPR_SLICE_END_PTR(input);
- ctx.output_cur = GPR_SLICE_START_PTR(output);
- ctx.output_end = GPR_SLICE_END_PTR(output);
+ ctx.input_cur = GRPC_SLICE_START_PTR(input);
+ ctx.input_end = GRPC_SLICE_END_PTR(input);
+ ctx.output_cur = GRPC_SLICE_START_PTR(output);
+ ctx.output_end = GRPC_SLICE_END_PTR(output);
ctx.contains_tail = true;
if (!grpc_base64_decode_partial(&ctx)) {
- char *s = gpr_dump_slice(input, GPR_DUMP_ASCII);
+ char *s = grpc_dump_slice(input, GPR_DUMP_ASCII);
gpr_log(GPR_ERROR, "Base64 decoding failed, input string:\n%s\n", s);
gpr_free(s);
- gpr_slice_unref(output);
+ grpc_slice_unref(output);
return gpr_empty_slice();
}
- GPR_ASSERT(ctx.output_cur == GPR_SLICE_END_PTR(output));
- GPR_ASSERT(ctx.input_cur <= GPR_SLICE_END_PTR(input));
+ GPR_ASSERT(ctx.output_cur == GRPC_SLICE_END_PTR(output));
+ GPR_ASSERT(ctx.input_cur <= GRPC_SLICE_END_PTR(input));
return output;
}
diff --git a/src/core/ext/transport/chttp2/transport/bin_decoder.h b/src/core/ext/transport/chttp2/transport/bin_decoder.h
index b9d40c9b74..83a90be519 100644
--- a/src/core/ext/transport/chttp2/transport/bin_decoder.h
+++ b/src/core/ext/transport/chttp2/transport/bin_decoder.h
@@ -34,7 +34,7 @@
#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_DECODER_H
#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_DECODER_H
-#include <grpc/support/slice.h>
+#include <grpc/slice.h>
#include <stdbool.h>
struct grpc_base64_decode_context {
@@ -55,12 +55,12 @@ bool grpc_base64_decode_partial(struct grpc_base64_decode_context *ctx);
/* base64 decode a slice with pad chars. Returns a new slice, does not take
ownership of the input. Returns an empty slice if decoding is failed. */
-gpr_slice grpc_chttp2_base64_decode(gpr_slice input);
+grpc_slice grpc_chttp2_base64_decode(grpc_slice input);
/* base64 decode a slice without pad chars, data length is needed. Returns a new
slice, does not take ownership of the input. Returns an empty slice if
decoding is failed. */
-gpr_slice grpc_chttp2_base64_decode_with_length(gpr_slice input,
- size_t output_length);
+grpc_slice grpc_chttp2_base64_decode_with_length(grpc_slice input,
+ size_t output_length);
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_DECODER_H */
diff --git a/src/core/ext/transport/chttp2/transport/bin_encoder.c b/src/core/ext/transport/chttp2/transport/bin_encoder.c
index 1b43c28be1..af25a4352a 100644
--- a/src/core/ext/transport/chttp2/transport/bin_encoder.c
+++ b/src/core/ext/transport/chttp2/transport/bin_encoder.c
@@ -61,14 +61,14 @@ static const b64_huff_sym huff_alphabet[64] = {
static const uint8_t tail_xtra[3] = {0, 2, 3};
-gpr_slice grpc_chttp2_base64_encode(gpr_slice input) {
- size_t input_length = GPR_SLICE_LENGTH(input);
+grpc_slice grpc_chttp2_base64_encode(grpc_slice input) {
+ size_t input_length = GRPC_SLICE_LENGTH(input);
size_t input_triplets = input_length / 3;
size_t tail_case = input_length % 3;
size_t output_length = input_triplets * 4 + tail_xtra[tail_case];
- gpr_slice output = gpr_slice_malloc(output_length);
- uint8_t *in = GPR_SLICE_START_PTR(input);
- char *out = (char *)GPR_SLICE_START_PTR(output);
+ grpc_slice output = grpc_slice_malloc(output_length);
+ uint8_t *in = GRPC_SLICE_START_PTR(input);
+ char *out = (char *)GRPC_SLICE_START_PTR(output);
size_t i;
/* encode full triplets */
@@ -100,27 +100,29 @@ gpr_slice grpc_chttp2_base64_encode(gpr_slice input) {
break;
}
- GPR_ASSERT(out == (char *)GPR_SLICE_END_PTR(output));
- GPR_ASSERT(in == GPR_SLICE_END_PTR(input));
+ GPR_ASSERT(out == (char *)GRPC_SLICE_END_PTR(output));
+ GPR_ASSERT(in == GRPC_SLICE_END_PTR(input));
return output;
}
-gpr_slice grpc_chttp2_huffman_compress(gpr_slice input) {
+grpc_slice grpc_chttp2_huffman_compress(grpc_slice input) {
size_t nbits;
uint8_t *in;
uint8_t *out;
- gpr_slice output;
+ grpc_slice output;
uint32_t temp = 0;
uint32_t temp_length = 0;
nbits = 0;
- for (in = GPR_SLICE_START_PTR(input); in != GPR_SLICE_END_PTR(input); ++in) {
+ for (in = GRPC_SLICE_START_PTR(input); in != GRPC_SLICE_END_PTR(input);
+ ++in) {
nbits += grpc_chttp2_huffsyms[*in].length;
}
- output = gpr_slice_malloc(nbits / 8 + (nbits % 8 != 0));
- out = GPR_SLICE_START_PTR(output);
- for (in = GPR_SLICE_START_PTR(input); in != GPR_SLICE_END_PTR(input); ++in) {
+ output = grpc_slice_malloc(nbits / 8 + (nbits % 8 != 0));
+ out = GRPC_SLICE_START_PTR(output);
+ for (in = GRPC_SLICE_START_PTR(input); in != GRPC_SLICE_END_PTR(input);
+ ++in) {
int sym = *in;
temp <<= grpc_chttp2_huffsyms[sym].length;
temp |= grpc_chttp2_huffsyms[sym].bits;
@@ -141,7 +143,7 @@ gpr_slice grpc_chttp2_huffman_compress(gpr_slice input) {
(uint8_t)(0xffu >> temp_length));
}
- GPR_ASSERT(out == GPR_SLICE_END_PTR(output));
+ GPR_ASSERT(out == GRPC_SLICE_END_PTR(output));
return output;
}
@@ -175,16 +177,17 @@ static void enc_add1(huff_out *out, uint8_t a) {
enc_flush_some(out);
}
-gpr_slice grpc_chttp2_base64_encode_and_huffman_compress_impl(gpr_slice input) {
- size_t input_length = GPR_SLICE_LENGTH(input);
+grpc_slice grpc_chttp2_base64_encode_and_huffman_compress_impl(
+ grpc_slice input) {
+ size_t input_length = GRPC_SLICE_LENGTH(input);
size_t input_triplets = input_length / 3;
size_t tail_case = input_length % 3;
size_t output_syms = input_triplets * 4 + tail_xtra[tail_case];
size_t max_output_bits = 11 * output_syms;
size_t max_output_length = max_output_bits / 8 + (max_output_bits % 8 != 0);
- gpr_slice output = gpr_slice_malloc(max_output_length);
- uint8_t *in = GPR_SLICE_START_PTR(input);
- uint8_t *start_out = GPR_SLICE_START_PTR(output);
+ grpc_slice output = grpc_slice_malloc(max_output_length);
+ uint8_t *in = GRPC_SLICE_START_PTR(input);
+ uint8_t *start_out = GRPC_SLICE_START_PTR(output);
huff_out out;
size_t i;
@@ -231,9 +234,9 @@ gpr_slice grpc_chttp2_base64_encode_and_huffman_compress_impl(gpr_slice input) {
(uint8_t)(0xffu >> out.temp_length));
}
- GPR_ASSERT(out.out <= GPR_SLICE_END_PTR(output));
- GPR_SLICE_SET_LENGTH(output, out.out - start_out);
+ GPR_ASSERT(out.out <= GRPC_SLICE_END_PTR(output));
+ GRPC_SLICE_SET_LENGTH(output, out.out - start_out);
- GPR_ASSERT(in == GPR_SLICE_END_PTR(input));
+ GPR_ASSERT(in == GRPC_SLICE_END_PTR(input));
return output;
}
diff --git a/src/core/ext/transport/chttp2/transport/bin_encoder.h b/src/core/ext/transport/chttp2/transport/bin_encoder.h
index 61ebbafa9a..9e143b46e2 100644
--- a/src/core/ext/transport/chttp2/transport/bin_encoder.h
+++ b/src/core/ext/transport/chttp2/transport/bin_encoder.h
@@ -34,21 +34,22 @@
#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_ENCODER_H
#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_ENCODER_H
-#include <grpc/support/slice.h>
+#include <grpc/slice.h>
/* base64 encode a slice. Returns a new slice, does not take ownership of the
input */
-gpr_slice grpc_chttp2_base64_encode(gpr_slice input);
+grpc_slice grpc_chttp2_base64_encode(grpc_slice input);
/* Compress a slice with the static huffman encoder detailed in the hpack
standard. Returns a new slice, does not take ownership of the input */
-gpr_slice grpc_chttp2_huffman_compress(gpr_slice input);
+grpc_slice grpc_chttp2_huffman_compress(grpc_slice input);
/* equivalent to:
- gpr_slice x = grpc_chttp2_base64_encode(input);
- gpr_slice y = grpc_chttp2_huffman_compress(x);
- gpr_slice_unref(x);
+ grpc_slice x = grpc_chttp2_base64_encode(input);
+ grpc_slice y = grpc_chttp2_huffman_compress(x);
+ grpc_slice_unref(x);
return y; */
-gpr_slice grpc_chttp2_base64_encode_and_huffman_compress_impl(gpr_slice input);
+grpc_slice grpc_chttp2_base64_encode_and_huffman_compress_impl(
+ grpc_slice input);
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_BIN_ENCODER_H */
diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.c b/src/core/ext/transport/chttp2/transport/chttp2_transport.c
index 4a9f806354..1ffa9165b2 100644
--- a/src/core/ext/transport/chttp2/transport/chttp2_transport.c
+++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.c
@@ -38,9 +38,9 @@
#include <stdio.h>
#include <string.h>
+#include <grpc/slice_buffer.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/slice_buffer.h>
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
@@ -51,6 +51,7 @@
#include "src/core/lib/http/parser.h"
#include "src/core/lib/iomgr/workqueue.h"
#include "src/core/lib/profiling/timers.h"
+#include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/lib/support/string.h"
#include "src/core/lib/transport/static_metadata.h"
#include "src/core/lib/transport/timeout_encoding.h"
@@ -143,12 +144,12 @@ static void destruct_transport(grpc_exec_ctx *exec_ctx,
grpc_endpoint_destroy(exec_ctx, t->ep);
- gpr_slice_buffer_destroy(&t->qbuf);
+ grpc_slice_buffer_destroy(&t->qbuf);
- gpr_slice_buffer_destroy(&t->outbuf);
+ grpc_slice_buffer_destroy(&t->outbuf);
grpc_chttp2_hpack_compressor_destroy(&t->hpack_compressor);
- gpr_slice_buffer_destroy(&t->read_buffer);
+ grpc_slice_buffer_destroy(&t->read_buffer);
grpc_chttp2_hpack_parser_destroy(&t->hpack_parser);
grpc_chttp2_goaway_parser_destroy(&t->goaway_parser);
@@ -243,9 +244,9 @@ static void init_transport(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
&t->channel_callback.state_tracker, GRPC_CHANNEL_READY,
is_client ? "client_transport" : "server_transport");
- gpr_slice_buffer_init(&t->qbuf);
+ grpc_slice_buffer_init(&t->qbuf);
- gpr_slice_buffer_init(&t->outbuf);
+ grpc_slice_buffer_init(&t->outbuf);
grpc_chttp2_hpack_compressor_init(&t->hpack_compressor);
grpc_closure_init(&t->write_action_begin_locked, write_action_begin_locked,
@@ -264,7 +265,7 @@ static void init_transport(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
grpc_chttp2_goaway_parser_init(&t->goaway_parser);
grpc_chttp2_hpack_parser_init(&t->hpack_parser);
- gpr_slice_buffer_init(&t->read_buffer);
+ grpc_slice_buffer_init(&t->read_buffer);
/* 8 is a random stab in the dark as to a good initial size: it's small enough
that it shouldn't waste memory for infrequently used connections, yet
@@ -286,8 +287,8 @@ static void init_transport(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
t->sent_local_settings = 0;
if (is_client) {
- gpr_slice_buffer_add(&t->outbuf, gpr_slice_from_copied_string(
- GRPC_CHTTP2_CLIENT_CONNECT_STRING));
+ grpc_slice_buffer_add(&t->outbuf, grpc_slice_from_copied_string(
+ GRPC_CHTTP2_CLIENT_CONNECT_STRING));
grpc_chttp2_initiate_write(exec_ctx, t, false, "initial_write");
}
@@ -471,7 +472,7 @@ static int init_stream(grpc_exec_ctx *exec_ctx, grpc_transport *gt,
grpc_chttp2_incoming_metadata_buffer_init(&s->metadata_buffer[0]);
grpc_chttp2_incoming_metadata_buffer_init(&s->metadata_buffer[1]);
grpc_chttp2_data_parser_init(&s->data_parser);
- gpr_slice_buffer_init(&s->flow_controlled_buffer);
+ grpc_slice_buffer_init(&s->flow_controlled_buffer);
s->deadline = gpr_inf_future(GPR_CLOCK_MONOTONIC);
grpc_closure_init(&s->complete_fetch, complete_fetch, s);
grpc_closure_init(&s->complete_fetch_locked, complete_fetch_locked, s);
@@ -531,7 +532,7 @@ static void destroy_stream_locked(grpc_exec_ctx *exec_ctx, void *sp,
grpc_chttp2_data_parser_destroy(exec_ctx, &s->data_parser);
grpc_chttp2_incoming_metadata_buffer_destroy(&s->metadata_buffer[0]);
grpc_chttp2_incoming_metadata_buffer_destroy(&s->metadata_buffer[1]);
- gpr_slice_buffer_destroy(&s->flow_controlled_buffer);
+ grpc_slice_buffer_destroy(&s->flow_controlled_buffer);
GRPC_ERROR_UNREF(s->read_closed_error);
GRPC_ERROR_UNREF(s->write_closed_error);
@@ -756,11 +757,11 @@ static void push_setting(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
void grpc_chttp2_add_incoming_goaway(grpc_exec_ctx *exec_ctx,
grpc_chttp2_transport *t,
uint32_t goaway_error,
- gpr_slice goaway_text) {
- char *msg = gpr_dump_slice(goaway_text, GPR_DUMP_HEX | GPR_DUMP_ASCII);
+ grpc_slice goaway_text) {
+ char *msg = grpc_dump_slice(goaway_text, GPR_DUMP_HEX | GPR_DUMP_ASCII);
GRPC_CHTTP2_IF_TRACING(
gpr_log(GPR_DEBUG, "got goaway [%d]: %s", goaway_error, msg));
- gpr_slice_unref(goaway_text);
+ grpc_slice_unref(goaway_text);
t->seen_goaway = 1;
/* lie: use transient failure from the transport to indicate goaway has been
* received */
@@ -884,8 +885,8 @@ static void add_fetched_slice_locked(grpc_exec_ctx *exec_ctx,
grpc_chttp2_transport *t,
grpc_chttp2_stream *s) {
s->fetched_send_message_length +=
- (uint32_t)GPR_SLICE_LENGTH(s->fetching_slice);
- gpr_slice_buffer_add(&s->flow_controlled_buffer, s->fetching_slice);
+ (uint32_t)GRPC_SLICE_LENGTH(s->fetching_slice);
+ grpc_slice_buffer_add(&s->flow_controlled_buffer, s->fetching_slice);
if (s->id != 0) {
grpc_chttp2_become_writable(exec_ctx, t, s, true, "op.send_message");
}
@@ -1056,7 +1057,7 @@ static void perform_stream_op_locked(grpc_exec_ctx *exec_ctx, void *stream_op,
} else {
GPR_ASSERT(s->fetching_send_message == NULL);
uint8_t *frame_hdr =
- gpr_slice_buffer_tiny_add(&s->flow_controlled_buffer, 5);
+ grpc_slice_buffer_tiny_add(&s->flow_controlled_buffer, 5);
uint32_t flags = op->send_message->flags;
frame_hdr[0] = (flags & GRPC_WRITE_INTERNAL_COMPRESS) != 0;
size_t len = op->send_message->length;
@@ -1196,7 +1197,7 @@ static void send_ping_locked(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
p->id[7] = (uint8_t)(t->ping_counter & 0xff);
t->ping_counter++;
p->on_recv = on_recv;
- gpr_slice_buffer_add(&t->qbuf, grpc_chttp2_ping_create(0, p->id));
+ grpc_slice_buffer_add(&t->qbuf, grpc_chttp2_ping_create(0, p->id));
grpc_chttp2_initiate_write(exec_ctx, t, true, "send_ping");
}
@@ -1220,7 +1221,7 @@ void grpc_chttp2_ack_ping(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
}
static void send_goaway(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
- grpc_chttp2_error_code error, gpr_slice data) {
+ grpc_chttp2_error_code error, grpc_slice data) {
t->sent_goaway_state = GRPC_CHTTP2_GOAWAY_SEND_SCHEDULED;
grpc_chttp2_goaway_append(t->last_new_stream_id, (uint32_t)error, data,
&t->qbuf);
@@ -1243,7 +1244,7 @@ static void perform_transport_op_locked(grpc_exec_ctx *exec_ctx,
if (op->send_goaway) {
send_goaway(exec_ctx, t,
grpc_chttp2_grpc_status_to_http2_error(op->goaway_status),
- gpr_slice_ref(*op->goaway_message));
+ grpc_slice_ref(*op->goaway_message));
}
if (op->set_accept_stream) {
@@ -1432,7 +1433,7 @@ void grpc_chttp2_cancel_stream(grpc_exec_ctx *exec_ctx,
&grpc_status);
if (s->id != 0) {
- gpr_slice_buffer_add(
+ grpc_slice_buffer_add(
&t->qbuf, grpc_chttp2_rst_stream_create(s->id, (uint32_t)http_error,
&s->stats.outgoing));
grpc_chttp2_initiate_write(exec_ctx, t, false, "rst_stream");
@@ -1445,7 +1446,7 @@ void grpc_chttp2_cancel_stream(grpc_exec_ctx *exec_ctx,
free_msg = true;
msg = grpc_error_string(due_to_error);
}
- gpr_slice msg_slice = gpr_slice_from_copied_string(msg);
+ grpc_slice msg_slice = grpc_slice_from_copied_string(msg);
grpc_chttp2_fake_status(exec_ctx, t, s, grpc_status, &msg_slice);
if (free_msg) grpc_error_free_string(msg);
}
@@ -1458,7 +1459,7 @@ void grpc_chttp2_cancel_stream(grpc_exec_ctx *exec_ctx,
void grpc_chttp2_fake_status(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
grpc_chttp2_stream *s, grpc_status_code status,
- gpr_slice *slice) {
+ grpc_slice *slice) {
if (status != GRPC_STATUS_OK) {
s->seen_error = true;
}
@@ -1481,13 +1482,13 @@ void grpc_chttp2_fake_status(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
&s->metadata_buffer[1],
grpc_mdelem_from_metadata_strings(
GRPC_MDSTR_GRPC_MESSAGE,
- grpc_mdstr_from_slice(gpr_slice_ref(*slice))));
+ grpc_mdstr_from_slice(grpc_slice_ref(*slice))));
}
s->published_metadata[1] = GRPC_METADATA_SYNTHESIZED_FROM_FAKE;
grpc_chttp2_maybe_complete_recv_trailing_metadata(exec_ctx, t, s);
}
if (slice) {
- gpr_slice_unref(*slice);
+ grpc_slice_unref(*slice);
}
}
@@ -1584,9 +1585,9 @@ void grpc_chttp2_mark_stream_closed(grpc_exec_ctx *exec_ctx,
static void close_from_api(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
grpc_chttp2_stream *s, grpc_error *error) {
- gpr_slice hdr;
- gpr_slice status_hdr;
- gpr_slice message_pfx;
+ grpc_slice hdr;
+ grpc_slice status_hdr;
+ grpc_slice message_pfx;
uint8_t *p;
uint32_t len = 0;
grpc_status_code grpc_status;
@@ -1605,8 +1606,8 @@ static void close_from_api(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
time we got around to sending this, so instead we ignore HPACK
compression
and just write the uncompressed bytes onto the wire. */
- status_hdr = gpr_slice_malloc(15 + (grpc_status >= 10));
- p = GPR_SLICE_START_PTR(status_hdr);
+ status_hdr = grpc_slice_malloc(15 + (grpc_status >= 10));
+ p = GRPC_SLICE_START_PTR(status_hdr);
*p++ = 0x40; /* literal header */
*p++ = 11; /* len(grpc-status) */
*p++ = 'g';
@@ -1628,8 +1629,8 @@ static void close_from_api(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
*p++ = (uint8_t)('0' + (grpc_status / 10));
*p++ = (uint8_t)('0' + (grpc_status % 10));
}
- GPR_ASSERT(p == GPR_SLICE_END_PTR(status_hdr));
- len += (uint32_t)GPR_SLICE_LENGTH(status_hdr);
+ GPR_ASSERT(p == GRPC_SLICE_END_PTR(status_hdr));
+ len += (uint32_t)GRPC_SLICE_LENGTH(status_hdr);
const char *optional_message =
grpc_error_get_str(error, GRPC_ERROR_STR_GRPC_MESSAGE);
@@ -1637,8 +1638,8 @@ static void close_from_api(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
if (optional_message != NULL) {
size_t msg_len = strlen(optional_message);
GPR_ASSERT(msg_len < 127);
- message_pfx = gpr_slice_malloc(15);
- p = GPR_SLICE_START_PTR(message_pfx);
+ message_pfx = grpc_slice_malloc(15);
+ p = GRPC_SLICE_START_PTR(message_pfx);
*p++ = 0x40;
*p++ = 12; /* len(grpc-message) */
*p++ = 'g';
@@ -1654,13 +1655,13 @@ static void close_from_api(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
*p++ = 'g';
*p++ = 'e';
*p++ = (uint8_t)msg_len;
- GPR_ASSERT(p == GPR_SLICE_END_PTR(message_pfx));
- len += (uint32_t)GPR_SLICE_LENGTH(message_pfx);
+ GPR_ASSERT(p == GRPC_SLICE_END_PTR(message_pfx));
+ len += (uint32_t)GRPC_SLICE_LENGTH(message_pfx);
len += (uint32_t)msg_len;
}
- hdr = gpr_slice_malloc(9);
- p = GPR_SLICE_START_PTR(hdr);
+ hdr = grpc_slice_malloc(9);
+ p = GRPC_SLICE_START_PTR(hdr);
*p++ = (uint8_t)(len >> 16);
*p++ = (uint8_t)(len >> 8);
*p++ = (uint8_t)(len);
@@ -1670,16 +1671,16 @@ static void close_from_api(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
*p++ = (uint8_t)(s->id >> 16);
*p++ = (uint8_t)(s->id >> 8);
*p++ = (uint8_t)(s->id);
- GPR_ASSERT(p == GPR_SLICE_END_PTR(hdr));
+ GPR_ASSERT(p == GRPC_SLICE_END_PTR(hdr));
- gpr_slice_buffer_add(&t->qbuf, hdr);
- gpr_slice_buffer_add(&t->qbuf, status_hdr);
+ grpc_slice_buffer_add(&t->qbuf, hdr);
+ grpc_slice_buffer_add(&t->qbuf, status_hdr);
if (optional_message) {
- gpr_slice_buffer_add(&t->qbuf, message_pfx);
- gpr_slice_buffer_add(&t->qbuf,
- gpr_slice_from_copied_string(optional_message));
+ grpc_slice_buffer_add(&t->qbuf, message_pfx);
+ grpc_slice_buffer_add(&t->qbuf,
+ grpc_slice_from_copied_string(optional_message));
}
- gpr_slice_buffer_add(
+ grpc_slice_buffer_add(
&t->qbuf, grpc_chttp2_rst_stream_create(s->id, GRPC_CHTTP2_NO_ERROR,
&s->stats.outgoing));
}
@@ -1690,7 +1691,7 @@ static void close_from_api(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
free_msg = true;
msg = grpc_error_string(error);
}
- gpr_slice msg_slice = gpr_slice_from_copied_string(msg);
+ grpc_slice msg_slice = grpc_slice_from_copied_string(msg);
grpc_chttp2_fake_status(exec_ctx, t, s, grpc_status, &msg_slice);
if (free_msg) grpc_error_free_string(msg);
@@ -1861,7 +1862,7 @@ static void read_action_locked(grpc_exec_ctx *exec_ctx, void *tp,
keep_reading = true;
GRPC_CHTTP2_REF_TRANSPORT(t, "keep_reading");
}
- gpr_slice_buffer_reset_and_unref(&t->read_buffer);
+ grpc_slice_buffer_reset_and_unref(&t->read_buffer);
if (keep_reading) {
grpc_endpoint_read(exec_ctx, t->ep, &t->read_buffer, &t->read_action_begin);
@@ -1915,7 +1916,7 @@ static void incoming_byte_stream_unref(grpc_exec_ctx *exec_ctx,
grpc_chttp2_incoming_byte_stream *bs) {
if (gpr_unref(&bs->refs)) {
GRPC_ERROR_UNREF(bs->error);
- gpr_slice_buffer_destroy(&bs->slices);
+ grpc_slice_buffer_destroy(&bs->slices);
gpr_mu_destroy(&bs->slice_mu);
gpr_free(bs);
}
@@ -1977,7 +1978,7 @@ static void incoming_byte_stream_next_locked(grpc_exec_ctx *exec_ctx,
}
gpr_mu_lock(&bs->slice_mu);
if (bs->slices.count > 0) {
- *bs->next_action.slice = gpr_slice_buffer_take_first(&bs->slices);
+ *bs->next_action.slice = grpc_slice_buffer_take_first(&bs->slices);
grpc_closure_run(exec_ctx, bs->next_action.on_complete, GRPC_ERROR_NONE);
} else if (bs->error != GRPC_ERROR_NONE) {
grpc_closure_run(exec_ctx, bs->next_action.on_complete,
@@ -1992,7 +1993,7 @@ static void incoming_byte_stream_next_locked(grpc_exec_ctx *exec_ctx,
static int incoming_byte_stream_next(grpc_exec_ctx *exec_ctx,
grpc_byte_stream *byte_stream,
- gpr_slice *slice, size_t max_size_hint,
+ grpc_slice *slice, size_t max_size_hint,
grpc_closure *on_complete) {
GPR_TIMER_BEGIN("incoming_byte_stream_next", 0);
grpc_chttp2_incoming_byte_stream *bs =
@@ -2045,19 +2046,19 @@ static void incoming_byte_stream_publish_error(
void grpc_chttp2_incoming_byte_stream_push(grpc_exec_ctx *exec_ctx,
grpc_chttp2_incoming_byte_stream *bs,
- gpr_slice slice) {
+ grpc_slice slice) {
gpr_mu_lock(&bs->slice_mu);
- if (bs->remaining_bytes < GPR_SLICE_LENGTH(slice)) {
+ if (bs->remaining_bytes < GRPC_SLICE_LENGTH(slice)) {
incoming_byte_stream_publish_error(
exec_ctx, bs, GRPC_ERROR_CREATE("Too many bytes in stream"));
} else {
- bs->remaining_bytes -= (uint32_t)GPR_SLICE_LENGTH(slice);
+ bs->remaining_bytes -= (uint32_t)GRPC_SLICE_LENGTH(slice);
if (bs->on_next != NULL) {
*bs->next = slice;
grpc_exec_ctx_sched(exec_ctx, bs->on_next, GRPC_ERROR_NONE, NULL);
bs->on_next = NULL;
} else {
- gpr_slice_buffer_add(&bs->slices, slice);
+ grpc_slice_buffer_add(&bs->slices, slice);
}
}
gpr_mu_unlock(&bs->slice_mu);
@@ -2095,7 +2096,7 @@ grpc_chttp2_incoming_byte_stream *grpc_chttp2_incoming_byte_stream_create(
incoming_byte_stream->transport = t;
incoming_byte_stream->stream = s;
gpr_ref(&incoming_byte_stream->stream->active_streams);
- gpr_slice_buffer_init(&incoming_byte_stream->slices);
+ grpc_slice_buffer_init(&incoming_byte_stream->slices);
incoming_byte_stream->on_next = NULL;
incoming_byte_stream->is_tail = 1;
incoming_byte_stream->error = GRPC_ERROR_NONE;
@@ -2163,7 +2164,7 @@ static void benign_reclaimer_locked(grpc_exec_ctx *exec_ctx, void *arg,
t->peer_string);
}
send_goaway(exec_ctx, t, GRPC_CHTTP2_ENHANCE_YOUR_CALM,
- gpr_slice_from_static_string("Buffers full"));
+ grpc_slice_from_static_string("Buffers full"));
} else if (error == GRPC_ERROR_NONE && grpc_resource_quota_trace) {
gpr_log(GPR_DEBUG,
"HTTP2: %s - skip benign reclamation, there are still %" PRIdPTR
@@ -2314,12 +2315,12 @@ grpc_transport *grpc_create_chttp2_transport(
void grpc_chttp2_transport_start_reading(grpc_exec_ctx *exec_ctx,
grpc_transport *transport,
- gpr_slice_buffer *read_buffer) {
+ grpc_slice_buffer *read_buffer) {
grpc_chttp2_transport *t = (grpc_chttp2_transport *)transport;
GRPC_CHTTP2_REF_TRANSPORT(
t, "reading_action"); /* matches unref inside reading_action */
if (read_buffer != NULL) {
- gpr_slice_buffer_move_into(read_buffer, &t->read_buffer);
+ grpc_slice_buffer_move_into(read_buffer, &t->read_buffer);
gpr_free(read_buffer);
}
read_action_begin(exec_ctx, t, GRPC_ERROR_NONE);
diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.h b/src/core/ext/transport/chttp2/transport/chttp2_transport.h
index 4e2d0954bf..c372174f2d 100644
--- a/src/core/ext/transport/chttp2/transport/chttp2_transport.h
+++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.h
@@ -48,6 +48,6 @@ grpc_transport *grpc_create_chttp2_transport(
/// leftover bytes previously read from the endpoint (e.g., by handshakers).
void grpc_chttp2_transport_start_reading(grpc_exec_ctx *exec_ctx,
grpc_transport *transport,
- gpr_slice_buffer *read_buffer);
+ grpc_slice_buffer *read_buffer);
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_CHTTP2_TRANSPORT_H */
diff --git a/src/core/ext/transport/chttp2/transport/frame.h b/src/core/ext/transport/chttp2/transport/frame.h
index 1e444a91fd..ffd4d9669b 100644
--- a/src/core/ext/transport/chttp2/transport/frame.h
+++ b/src/core/ext/transport/chttp2/transport/frame.h
@@ -34,8 +34,8 @@
#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_H
#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_H
+#include <grpc/slice.h>
#include <grpc/support/port_platform.h>
-#include <grpc/support/slice.h>
#include "src/core/lib/iomgr/error.h"
diff --git a/src/core/ext/transport/chttp2/transport/frame_data.c b/src/core/ext/transport/chttp2/transport/frame_data.c
index 8668816930..f9b9e1b309 100644
--- a/src/core/ext/transport/chttp2/transport/frame_data.c
+++ b/src/core/ext/transport/chttp2/transport/frame_data.c
@@ -40,6 +40,7 @@
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
#include "src/core/ext/transport/chttp2/transport/internal.h"
+#include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/lib/support/string.h"
#include "src/core/lib/transport/transport.h"
@@ -112,16 +113,16 @@ grpc_byte_stream *grpc_chttp2_incoming_frame_queue_pop(
return out;
}
-void grpc_chttp2_encode_data(uint32_t id, gpr_slice_buffer *inbuf,
+void grpc_chttp2_encode_data(uint32_t id, grpc_slice_buffer *inbuf,
uint32_t write_bytes, int is_eof,
grpc_transport_one_way_stats *stats,
- gpr_slice_buffer *outbuf) {
- gpr_slice hdr;
+ grpc_slice_buffer *outbuf) {
+ grpc_slice hdr;
uint8_t *p;
static const size_t header_size = 9;
- hdr = gpr_slice_malloc(header_size);
- p = GPR_SLICE_START_PTR(hdr);
+ hdr = grpc_slice_malloc(header_size);
+ p = GRPC_SLICE_START_PTR(hdr);
GPR_ASSERT(write_bytes < (1 << 24));
*p++ = (uint8_t)(write_bytes >> 16);
*p++ = (uint8_t)(write_bytes >> 8);
@@ -132,9 +133,9 @@ void grpc_chttp2_encode_data(uint32_t id, gpr_slice_buffer *inbuf,
*p++ = (uint8_t)(id >> 16);
*p++ = (uint8_t)(id >> 8);
*p++ = (uint8_t)(id);
- gpr_slice_buffer_add(outbuf, hdr);
+ grpc_slice_buffer_add(outbuf, hdr);
- gpr_slice_buffer_move_first(inbuf, write_bytes, outbuf);
+ grpc_slice_buffer_move_first(inbuf, write_bytes, outbuf);
stats->framing_bytes += header_size;
stats->data_bytes += write_bytes;
@@ -143,9 +144,9 @@ void grpc_chttp2_encode_data(uint32_t id, gpr_slice_buffer *inbuf,
static grpc_error *parse_inner(grpc_exec_ctx *exec_ctx,
grpc_chttp2_data_parser *p,
grpc_chttp2_transport *t, grpc_chttp2_stream *s,
- gpr_slice slice) {
- uint8_t *const beg = GPR_SLICE_START_PTR(slice);
- uint8_t *const end = GPR_SLICE_END_PTR(slice);
+ grpc_slice slice) {
+ uint8_t *const beg = GRPC_SLICE_START_PTR(slice);
+ uint8_t *const end = GRPC_SLICE_END_PTR(slice);
uint8_t *cur = beg;
uint32_t message_flags;
grpc_chttp2_incoming_byte_stream *incoming_byte_stream;
@@ -176,7 +177,7 @@ static grpc_error *parse_inner(grpc_exec_ctx *exec_ctx,
p->error = grpc_error_set_int(p->error, GRPC_ERROR_INT_STREAM_ID,
(intptr_t)s->id);
gpr_free(msg);
- msg = gpr_dump_slice(slice, GPR_DUMP_HEX | GPR_DUMP_ASCII);
+ msg = grpc_dump_slice(slice, GPR_DUMP_HEX | GPR_DUMP_ASCII);
p->error =
grpc_error_set_str(p->error, GRPC_ERROR_STR_RAW_BYTES, msg);
gpr_free(msg);
@@ -236,7 +237,7 @@ static grpc_error *parse_inner(grpc_exec_ctx *exec_ctx,
s->stats.incoming.data_bytes += p->frame_size;
grpc_chttp2_incoming_byte_stream_push(
exec_ctx, p->parsing_frame,
- gpr_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg)));
+ grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg)));
grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame,
GRPC_ERROR_NONE);
p->parsing_frame = NULL;
@@ -246,8 +247,8 @@ static grpc_error *parse_inner(grpc_exec_ctx *exec_ctx,
s->stats.incoming.data_bytes += p->frame_size;
grpc_chttp2_incoming_byte_stream_push(
exec_ctx, p->parsing_frame,
- gpr_slice_sub(slice, (size_t)(cur - beg),
- (size_t)(cur + p->frame_size - beg)));
+ grpc_slice_sub(slice, (size_t)(cur - beg),
+ (size_t)(cur + p->frame_size - beg)));
grpc_chttp2_incoming_byte_stream_finished(exec_ctx, p->parsing_frame,
GRPC_ERROR_NONE);
p->parsing_frame = NULL;
@@ -257,7 +258,7 @@ static grpc_error *parse_inner(grpc_exec_ctx *exec_ctx,
GPR_ASSERT(remaining <= p->frame_size);
grpc_chttp2_incoming_byte_stream_push(
exec_ctx, p->parsing_frame,
- gpr_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg)));
+ grpc_slice_sub(slice, (size_t)(cur - beg), (size_t)(end - beg)));
p->frame_size -= remaining;
s->stats.incoming.data_bytes += remaining;
return GRPC_ERROR_NONE;
@@ -270,7 +271,7 @@ static grpc_error *parse_inner(grpc_exec_ctx *exec_ctx,
grpc_error *grpc_chttp2_data_parser_parse(grpc_exec_ctx *exec_ctx, void *parser,
grpc_chttp2_transport *t,
grpc_chttp2_stream *s,
- gpr_slice slice, int is_last) {
+ grpc_slice slice, int is_last) {
grpc_chttp2_data_parser *p = parser;
grpc_error *error = parse_inner(exec_ctx, p, t, s, slice);
diff --git a/src/core/ext/transport/chttp2/transport/frame_data.h b/src/core/ext/transport/chttp2/transport/frame_data.h
index eb2d97d898..264ad14608 100644
--- a/src/core/ext/transport/chttp2/transport/frame_data.h
+++ b/src/core/ext/transport/chttp2/transport/frame_data.h
@@ -36,8 +36,8 @@
/* Parser for GRPC streams embedded in DATA frames */
-#include <grpc/support/slice.h>
-#include <grpc/support/slice_buffer.h>
+#include <grpc/slice.h>
+#include <grpc/slice_buffer.h>
#include "src/core/ext/transport/chttp2/transport/frame.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/transport/byte_stream.h"
@@ -94,11 +94,11 @@ grpc_error *grpc_chttp2_data_parser_begin_frame(grpc_chttp2_data_parser *parser,
grpc_error *grpc_chttp2_data_parser_parse(grpc_exec_ctx *exec_ctx, void *parser,
grpc_chttp2_transport *t,
grpc_chttp2_stream *s,
- gpr_slice slice, int is_last);
+ grpc_slice slice, int is_last);
-void grpc_chttp2_encode_data(uint32_t id, gpr_slice_buffer *inbuf,
+void grpc_chttp2_encode_data(uint32_t id, grpc_slice_buffer *inbuf,
uint32_t write_bytes, int is_eof,
grpc_transport_one_way_stats *stats,
- gpr_slice_buffer *outbuf);
+ grpc_slice_buffer *outbuf);
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_DATA_H */
diff --git a/src/core/ext/transport/chttp2/transport/frame_goaway.c b/src/core/ext/transport/chttp2/transport/frame_goaway.c
index 33d2269169..d99d486c1b 100644
--- a/src/core/ext/transport/chttp2/transport/frame_goaway.c
+++ b/src/core/ext/transport/chttp2/transport/frame_goaway.c
@@ -71,9 +71,9 @@ grpc_error *grpc_chttp2_goaway_parser_parse(grpc_exec_ctx *exec_ctx,
void *parser,
grpc_chttp2_transport *t,
grpc_chttp2_stream *s,
- gpr_slice slice, int is_last) {
- uint8_t *const beg = GPR_SLICE_START_PTR(slice);
- uint8_t *const end = GPR_SLICE_END_PTR(slice);
+ grpc_slice slice, int is_last) {
+ uint8_t *const beg = GRPC_SLICE_START_PTR(slice);
+ uint8_t *const end = GRPC_SLICE_END_PTR(slice);
uint8_t *cur = beg;
grpc_chttp2_goaway_parser *p = parser;
@@ -151,7 +151,7 @@ grpc_error *grpc_chttp2_goaway_parser_parse(grpc_exec_ctx *exec_ctx,
if (is_last) {
grpc_chttp2_add_incoming_goaway(
exec_ctx, t, (uint32_t)p->error_code,
- gpr_slice_new(p->debug_data, p->debug_length, gpr_free));
+ grpc_slice_new(p->debug_data, p->debug_length, gpr_free));
p->debug_data = NULL;
}
return GRPC_ERROR_NONE;
@@ -160,13 +160,13 @@ grpc_error *grpc_chttp2_goaway_parser_parse(grpc_exec_ctx *exec_ctx,
}
void grpc_chttp2_goaway_append(uint32_t last_stream_id, uint32_t error_code,
- gpr_slice debug_data,
- gpr_slice_buffer *slice_buffer) {
- gpr_slice header = gpr_slice_malloc(9 + 4 + 4);
- uint8_t *p = GPR_SLICE_START_PTR(header);
+ grpc_slice debug_data,
+ grpc_slice_buffer *slice_buffer) {
+ grpc_slice header = grpc_slice_malloc(9 + 4 + 4);
+ uint8_t *p = GRPC_SLICE_START_PTR(header);
uint32_t frame_length;
- GPR_ASSERT(GPR_SLICE_LENGTH(debug_data) < UINT32_MAX - 4 - 4);
- frame_length = 4 + 4 + (uint32_t)GPR_SLICE_LENGTH(debug_data);
+ GPR_ASSERT(GRPC_SLICE_LENGTH(debug_data) < UINT32_MAX - 4 - 4);
+ frame_length = 4 + 4 + (uint32_t)GRPC_SLICE_LENGTH(debug_data);
/* frame header: length */
*p++ = (uint8_t)(frame_length >> 16);
@@ -191,7 +191,7 @@ void grpc_chttp2_goaway_append(uint32_t last_stream_id, uint32_t error_code,
*p++ = (uint8_t)(error_code >> 16);
*p++ = (uint8_t)(error_code >> 8);
*p++ = (uint8_t)(error_code);
- GPR_ASSERT(p == GPR_SLICE_END_PTR(header));
- gpr_slice_buffer_add(slice_buffer, header);
- gpr_slice_buffer_add(slice_buffer, debug_data);
+ GPR_ASSERT(p == GRPC_SLICE_END_PTR(header));
+ grpc_slice_buffer_add(slice_buffer, header);
+ grpc_slice_buffer_add(slice_buffer, debug_data);
}
diff --git a/src/core/ext/transport/chttp2/transport/frame_goaway.h b/src/core/ext/transport/chttp2/transport/frame_goaway.h
index 355104a5a7..21fe819488 100644
--- a/src/core/ext/transport/chttp2/transport/frame_goaway.h
+++ b/src/core/ext/transport/chttp2/transport/frame_goaway.h
@@ -34,9 +34,9 @@
#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_GOAWAY_H
#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_GOAWAY_H
+#include <grpc/slice.h>
+#include <grpc/slice_buffer.h>
#include <grpc/support/port_platform.h>
-#include <grpc/support/slice.h>
-#include <grpc/support/slice_buffer.h>
#include "src/core/ext/transport/chttp2/transport/frame.h"
#include "src/core/lib/iomgr/exec_ctx.h"
@@ -69,10 +69,10 @@ grpc_error *grpc_chttp2_goaway_parser_parse(grpc_exec_ctx *exec_ctx,
void *parser,
grpc_chttp2_transport *t,
grpc_chttp2_stream *s,
- gpr_slice slice, int is_last);
+ grpc_slice slice, int is_last);
void grpc_chttp2_goaway_append(uint32_t last_stream_id, uint32_t error_code,
- gpr_slice debug_data,
- gpr_slice_buffer *slice_buffer);
+ grpc_slice debug_data,
+ grpc_slice_buffer *slice_buffer);
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_GOAWAY_H */
diff --git a/src/core/ext/transport/chttp2/transport/frame_ping.c b/src/core/ext/transport/chttp2/transport/frame_ping.c
index 624f42649d..7de5f6362d 100644
--- a/src/core/ext/transport/chttp2/transport/frame_ping.c
+++ b/src/core/ext/transport/chttp2/transport/frame_ping.c
@@ -40,9 +40,9 @@
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
-gpr_slice grpc_chttp2_ping_create(uint8_t ack, uint8_t *opaque_8bytes) {
- gpr_slice slice = gpr_slice_malloc(9 + 8);
- uint8_t *p = GPR_SLICE_START_PTR(slice);
+grpc_slice grpc_chttp2_ping_create(uint8_t ack, uint8_t *opaque_8bytes) {
+ grpc_slice slice = grpc_slice_malloc(9 + 8);
+ uint8_t *p = GRPC_SLICE_START_PTR(slice);
*p++ = 0;
*p++ = 0;
@@ -76,9 +76,9 @@ grpc_error *grpc_chttp2_ping_parser_begin_frame(grpc_chttp2_ping_parser *parser,
grpc_error *grpc_chttp2_ping_parser_parse(grpc_exec_ctx *exec_ctx, void *parser,
grpc_chttp2_transport *t,
grpc_chttp2_stream *s,
- gpr_slice slice, int is_last) {
- uint8_t *const beg = GPR_SLICE_START_PTR(slice);
- uint8_t *const end = GPR_SLICE_END_PTR(slice);
+ grpc_slice slice, int is_last) {
+ uint8_t *const beg = GRPC_SLICE_START_PTR(slice);
+ uint8_t *const end = GRPC_SLICE_END_PTR(slice);
uint8_t *cur = beg;
grpc_chttp2_ping_parser *p = parser;
@@ -93,8 +93,8 @@ grpc_error *grpc_chttp2_ping_parser_parse(grpc_exec_ctx *exec_ctx, void *parser,
if (p->is_ack) {
grpc_chttp2_ack_ping(exec_ctx, t, p->opaque_8bytes);
} else {
- gpr_slice_buffer_add(&t->qbuf,
- grpc_chttp2_ping_create(1, p->opaque_8bytes));
+ grpc_slice_buffer_add(&t->qbuf,
+ grpc_chttp2_ping_create(1, p->opaque_8bytes));
grpc_chttp2_initiate_write(exec_ctx, t, false, "ping response");
}
}
diff --git a/src/core/ext/transport/chttp2/transport/frame_ping.h b/src/core/ext/transport/chttp2/transport/frame_ping.h
index 2071f647fb..b9889e2d11 100644
--- a/src/core/ext/transport/chttp2/transport/frame_ping.h
+++ b/src/core/ext/transport/chttp2/transport/frame_ping.h
@@ -34,7 +34,7 @@
#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_PING_H
#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_PING_H
-#include <grpc/support/slice.h>
+#include <grpc/slice.h>
#include "src/core/ext/transport/chttp2/transport/frame.h"
#include "src/core/lib/iomgr/exec_ctx.h"
@@ -44,13 +44,13 @@ typedef struct {
uint8_t opaque_8bytes[8];
} grpc_chttp2_ping_parser;
-gpr_slice grpc_chttp2_ping_create(uint8_t ack, uint8_t *opaque_8bytes);
+grpc_slice grpc_chttp2_ping_create(uint8_t ack, uint8_t *opaque_8bytes);
grpc_error *grpc_chttp2_ping_parser_begin_frame(grpc_chttp2_ping_parser *parser,
uint32_t length, uint8_t flags);
grpc_error *grpc_chttp2_ping_parser_parse(grpc_exec_ctx *exec_ctx, void *parser,
grpc_chttp2_transport *t,
grpc_chttp2_stream *s,
- gpr_slice slice, int is_last);
+ grpc_slice slice, int is_last);
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_PING_H */
diff --git a/src/core/ext/transport/chttp2/transport/frame_rst_stream.c b/src/core/ext/transport/chttp2/transport/frame_rst_stream.c
index 9eac050797..b4c5ed769b 100644
--- a/src/core/ext/transport/chttp2/transport/frame_rst_stream.c
+++ b/src/core/ext/transport/chttp2/transport/frame_rst_stream.c
@@ -42,12 +42,12 @@
#include "src/core/ext/transport/chttp2/transport/http2_errors.h"
#include "src/core/ext/transport/chttp2/transport/status_conversion.h"
-gpr_slice grpc_chttp2_rst_stream_create(uint32_t id, uint32_t code,
- grpc_transport_one_way_stats *stats) {
+grpc_slice grpc_chttp2_rst_stream_create(uint32_t id, uint32_t code,
+ grpc_transport_one_way_stats *stats) {
static const size_t frame_size = 13;
- gpr_slice slice = gpr_slice_malloc(frame_size);
+ grpc_slice slice = grpc_slice_malloc(frame_size);
stats->framing_bytes += frame_size;
- uint8_t *p = GPR_SLICE_START_PTR(slice);
+ uint8_t *p = GRPC_SLICE_START_PTR(slice);
// Frame size.
*p++ = 0;
@@ -89,9 +89,9 @@ grpc_error *grpc_chttp2_rst_stream_parser_parse(grpc_exec_ctx *exec_ctx,
void *parser,
grpc_chttp2_transport *t,
grpc_chttp2_stream *s,
- gpr_slice slice, int is_last) {
- uint8_t *const beg = GPR_SLICE_START_PTR(slice);
- uint8_t *const end = GPR_SLICE_END_PTR(slice);
+ grpc_slice slice, int is_last) {
+ uint8_t *const beg = GRPC_SLICE_START_PTR(slice);
+ uint8_t *const end = GRPC_SLICE_END_PTR(slice);
uint8_t *cur = beg;
grpc_chttp2_rst_stream_parser *p = parser;
@@ -117,7 +117,7 @@ grpc_error *grpc_chttp2_rst_stream_parser_parse(grpc_exec_ctx *exec_ctx,
char *status_details;
gpr_asprintf(&status_details, "Received RST_STREAM with error code %d",
reason);
- gpr_slice slice_details = gpr_slice_from_copied_string(status_details);
+ grpc_slice slice_details = grpc_slice_from_copied_string(status_details);
gpr_free(status_details);
grpc_chttp2_fake_status(exec_ctx, t, s, status_code, &slice_details);
}
diff --git a/src/core/ext/transport/chttp2/transport/frame_rst_stream.h b/src/core/ext/transport/chttp2/transport/frame_rst_stream.h
index 5a1f578a29..779507a617 100644
--- a/src/core/ext/transport/chttp2/transport/frame_rst_stream.h
+++ b/src/core/ext/transport/chttp2/transport/frame_rst_stream.h
@@ -34,7 +34,7 @@
#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_RST_STREAM_H
#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_RST_STREAM_H
-#include <grpc/support/slice.h>
+#include <grpc/slice.h>
#include "src/core/ext/transport/chttp2/transport/frame.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/transport/transport.h"
@@ -44,8 +44,8 @@ typedef struct {
uint8_t reason_bytes[4];
} grpc_chttp2_rst_stream_parser;
-gpr_slice grpc_chttp2_rst_stream_create(uint32_t stream_id, uint32_t code,
- grpc_transport_one_way_stats *stats);
+grpc_slice grpc_chttp2_rst_stream_create(uint32_t stream_id, uint32_t code,
+ grpc_transport_one_way_stats *stats);
grpc_error *grpc_chttp2_rst_stream_parser_begin_frame(
grpc_chttp2_rst_stream_parser *parser, uint32_t length, uint8_t flags);
@@ -53,6 +53,6 @@ grpc_error *grpc_chttp2_rst_stream_parser_parse(grpc_exec_ctx *exec_ctx,
void *parser,
grpc_chttp2_transport *t,
grpc_chttp2_stream *s,
- gpr_slice slice, int is_last);
+ grpc_slice slice, int is_last);
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_RST_STREAM_H */
diff --git a/src/core/ext/transport/chttp2/transport/frame_settings.c b/src/core/ext/transport/chttp2/transport/frame_settings.c
index 92022f90c9..98facae87f 100644
--- a/src/core/ext/transport/chttp2/transport/frame_settings.c
+++ b/src/core/ext/transport/chttp2/transport/frame_settings.c
@@ -82,19 +82,19 @@ static uint8_t *fill_header(uint8_t *out, uint32_t length, uint8_t flags) {
return out;
}
-gpr_slice grpc_chttp2_settings_create(uint32_t *old, const uint32_t *new,
- uint32_t force_mask, size_t count) {
+grpc_slice grpc_chttp2_settings_create(uint32_t *old, const uint32_t *new,
+ uint32_t force_mask, size_t count) {
size_t i;
uint32_t n = 0;
- gpr_slice output;
+ grpc_slice output;
uint8_t *p;
for (i = 0; i < count; i++) {
n += (new[i] != old[i] || (force_mask & (1u << i)) != 0);
}
- output = gpr_slice_malloc(9 + 6 * n);
- p = fill_header(GPR_SLICE_START_PTR(output), 6 * n, 0);
+ output = grpc_slice_malloc(9 + 6 * n);
+ p = fill_header(GRPC_SLICE_START_PTR(output), 6 * n, 0);
for (i = 0; i < count; i++) {
if (new[i] != old[i] || (force_mask & (1u << i)) != 0) {
@@ -109,14 +109,14 @@ gpr_slice grpc_chttp2_settings_create(uint32_t *old, const uint32_t *new,
}
}
- GPR_ASSERT(p == GPR_SLICE_END_PTR(output));
+ GPR_ASSERT(p == GRPC_SLICE_END_PTR(output));
return output;
}
-gpr_slice grpc_chttp2_settings_ack_create(void) {
- gpr_slice output = gpr_slice_malloc(9);
- fill_header(GPR_SLICE_START_PTR(output), 0, GRPC_CHTTP2_FLAG_ACK);
+grpc_slice grpc_chttp2_settings_ack_create(void) {
+ grpc_slice output = grpc_slice_malloc(9);
+ fill_header(GRPC_SLICE_START_PTR(output), 0, GRPC_CHTTP2_FLAG_ACK);
return output;
}
@@ -146,10 +146,10 @@ grpc_error *grpc_chttp2_settings_parser_begin_frame(
grpc_error *grpc_chttp2_settings_parser_parse(grpc_exec_ctx *exec_ctx, void *p,
grpc_chttp2_transport *t,
grpc_chttp2_stream *s,
- gpr_slice slice, int is_last) {
+ grpc_slice slice, int is_last) {
grpc_chttp2_settings_parser *parser = p;
- const uint8_t *cur = GPR_SLICE_START_PTR(slice);
- const uint8_t *end = GPR_SLICE_END_PTR(slice);
+ const uint8_t *cur = GRPC_SLICE_START_PTR(slice);
+ const uint8_t *end = GRPC_SLICE_END_PTR(slice);
char *msg;
if (parser->is_ack) {
@@ -164,7 +164,7 @@ grpc_error *grpc_chttp2_settings_parser_parse(grpc_exec_ctx *exec_ctx, void *p,
if (is_last) {
memcpy(parser->target_settings, parser->incoming_settings,
GRPC_CHTTP2_NUM_SETTINGS * sizeof(uint32_t));
- gpr_slice_buffer_add(&t->qbuf, grpc_chttp2_settings_ack_create());
+ grpc_slice_buffer_add(&t->qbuf, grpc_chttp2_settings_ack_create());
}
return GRPC_ERROR_NONE;
}
@@ -225,7 +225,7 @@ grpc_error *grpc_chttp2_settings_parser_parse(grpc_exec_ctx *exec_ctx, void *p,
case GRPC_CHTTP2_DISCONNECT_ON_INVALID_VALUE:
grpc_chttp2_goaway_append(
t->last_new_stream_id, sp->error_value,
- gpr_slice_from_static_string("HTTP2 settings error"),
+ grpc_slice_from_static_string("HTTP2 settings error"),
&t->qbuf);
gpr_asprintf(&msg, "invalid value %u passed for %s",
parser->value, sp->name);
diff --git a/src/core/ext/transport/chttp2/transport/frame_settings.h b/src/core/ext/transport/chttp2/transport/frame_settings.h
index 4bfa944cf1..a29dc82106 100644
--- a/src/core/ext/transport/chttp2/transport/frame_settings.h
+++ b/src/core/ext/transport/chttp2/transport/frame_settings.h
@@ -34,8 +34,8 @@
#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_SETTINGS_H
#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_SETTINGS_H
+#include <grpc/slice.h>
#include <grpc/support/port_platform.h>
-#include <grpc/support/slice.h>
#include "src/core/ext/transport/chttp2/transport/frame.h"
#include "src/core/lib/iomgr/exec_ctx.h"
@@ -87,10 +87,10 @@ extern const grpc_chttp2_setting_parameters
grpc_chttp2_settings_parameters[GRPC_CHTTP2_NUM_SETTINGS];
/* Create a settings frame by diffing old & new, and updating old to be new */
-gpr_slice grpc_chttp2_settings_create(uint32_t *old, const uint32_t *new,
- uint32_t force_mask, size_t count);
+grpc_slice grpc_chttp2_settings_create(uint32_t *old, const uint32_t *new,
+ uint32_t force_mask, size_t count);
/* Create an ack settings frame */
-gpr_slice grpc_chttp2_settings_ack_create(void);
+grpc_slice grpc_chttp2_settings_ack_create(void);
grpc_error *grpc_chttp2_settings_parser_begin_frame(
grpc_chttp2_settings_parser *parser, uint32_t length, uint8_t flags,
@@ -99,6 +99,6 @@ grpc_error *grpc_chttp2_settings_parser_parse(grpc_exec_ctx *exec_ctx,
void *parser,
grpc_chttp2_transport *t,
grpc_chttp2_stream *s,
- gpr_slice slice, int is_last);
+ grpc_slice slice, int is_last);
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_SETTINGS_H */
diff --git a/src/core/ext/transport/chttp2/transport/frame_window_update.c b/src/core/ext/transport/chttp2/transport/frame_window_update.c
index 418166a6df..31a31c2871 100644
--- a/src/core/ext/transport/chttp2/transport/frame_window_update.c
+++ b/src/core/ext/transport/chttp2/transport/frame_window_update.c
@@ -38,12 +38,12 @@
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
-gpr_slice grpc_chttp2_window_update_create(
+grpc_slice grpc_chttp2_window_update_create(
uint32_t id, uint32_t window_update, grpc_transport_one_way_stats *stats) {
static const size_t frame_size = 13;
- gpr_slice slice = gpr_slice_malloc(frame_size);
+ grpc_slice slice = grpc_slice_malloc(frame_size);
stats->header_bytes += frame_size;
- uint8_t *p = GPR_SLICE_START_PTR(slice);
+ uint8_t *p = GRPC_SLICE_START_PTR(slice);
GPR_ASSERT(window_update);
@@ -81,9 +81,9 @@ grpc_error *grpc_chttp2_window_update_parser_begin_frame(
grpc_error *grpc_chttp2_window_update_parser_parse(
grpc_exec_ctx *exec_ctx, void *parser, grpc_chttp2_transport *t,
- grpc_chttp2_stream *s, gpr_slice slice, int is_last) {
- uint8_t *const beg = GPR_SLICE_START_PTR(slice);
- uint8_t *const end = GPR_SLICE_END_PTR(slice);
+ grpc_chttp2_stream *s, grpc_slice slice, int is_last) {
+ uint8_t *const beg = GRPC_SLICE_START_PTR(slice);
+ uint8_t *const end = GRPC_SLICE_END_PTR(slice);
uint8_t *cur = beg;
grpc_chttp2_window_update_parser *p = parser;
diff --git a/src/core/ext/transport/chttp2/transport/frame_window_update.h b/src/core/ext/transport/chttp2/transport/frame_window_update.h
index 6e62f31872..f75dfb3d87 100644
--- a/src/core/ext/transport/chttp2/transport/frame_window_update.h
+++ b/src/core/ext/transport/chttp2/transport/frame_window_update.h
@@ -34,7 +34,7 @@
#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_WINDOW_UPDATE_H
#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_WINDOW_UPDATE_H
-#include <grpc/support/slice.h>
+#include <grpc/slice.h>
#include "src/core/ext/transport/chttp2/transport/frame.h"
#include "src/core/lib/iomgr/exec_ctx.h"
#include "src/core/lib/transport/transport.h"
@@ -45,13 +45,13 @@ typedef struct {
uint32_t amount;
} grpc_chttp2_window_update_parser;
-gpr_slice grpc_chttp2_window_update_create(uint32_t id, uint32_t window_delta,
- grpc_transport_one_way_stats *stats);
+grpc_slice grpc_chttp2_window_update_create(
+ uint32_t id, uint32_t window_delta, grpc_transport_one_way_stats *stats);
grpc_error *grpc_chttp2_window_update_parser_begin_frame(
grpc_chttp2_window_update_parser *parser, uint32_t length, uint8_t flags);
grpc_error *grpc_chttp2_window_update_parser_parse(
grpc_exec_ctx *exec_ctx, void *parser, grpc_chttp2_transport *t,
- grpc_chttp2_stream *s, gpr_slice slice, int is_last);
+ grpc_chttp2_stream *s, grpc_slice slice, int is_last);
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_FRAME_WINDOW_UPDATE_H */
diff --git a/src/core/ext/transport/chttp2/transport/hpack_encoder.c b/src/core/ext/transport/chttp2/transport/hpack_encoder.c
index 581471ba02..eb68fe3138 100644
--- a/src/core/ext/transport/chttp2/transport/hpack_encoder.c
+++ b/src/core/ext/transport/chttp2/transport/hpack_encoder.c
@@ -76,7 +76,7 @@ typedef struct {
uint8_t seen_regular_header;
/* output stream id */
uint32_t stream_id;
- gpr_slice_buffer *output;
+ grpc_slice_buffer *output;
grpc_transport_one_way_stats *stats;
/* maximum size of a frame */
size_t max_frame_size;
@@ -104,7 +104,7 @@ static void finish_frame(framer_state *st, int is_header_boundary,
type = st->is_first_frame ? GRPC_CHTTP2_FRAME_HEADER
: GRPC_CHTTP2_FRAME_CONTINUATION;
fill_header(
- GPR_SLICE_START_PTR(st->output->slices[st->header_idx]), type,
+ GRPC_SLICE_START_PTR(st->output->slices[st->header_idx]), type,
st->stream_id, st->output->length - st->output_length_at_start_of_frame,
(uint8_t)((is_last_in_stream ? GRPC_CHTTP2_DATA_FLAG_END_STREAM : 0) |
(is_header_boundary ? GRPC_CHTTP2_DATA_FLAG_END_HEADERS : 0)));
@@ -116,7 +116,7 @@ static void finish_frame(framer_state *st, int is_header_boundary,
output before beginning */
static void begin_frame(framer_state *st) {
st->header_idx =
- gpr_slice_buffer_add_indexed(st->output, gpr_slice_malloc(9));
+ grpc_slice_buffer_add_indexed(st->output, grpc_slice_malloc(9));
st->output_length_at_start_of_frame = st->output->length;
}
@@ -147,18 +147,18 @@ static void inc_filter(uint8_t idx, uint32_t *sum, uint8_t *elems) {
}
}
-static void add_header_data(framer_state *st, gpr_slice slice) {
- size_t len = GPR_SLICE_LENGTH(slice);
+static void add_header_data(framer_state *st, grpc_slice slice) {
+ size_t len = GRPC_SLICE_LENGTH(slice);
size_t remaining;
if (len == 0) return;
remaining = st->max_frame_size + st->output_length_at_start_of_frame -
st->output->length;
if (len <= remaining) {
st->stats->header_bytes += len;
- gpr_slice_buffer_add(st->output, slice);
+ grpc_slice_buffer_add(st->output, slice);
} else {
st->stats->header_bytes += remaining;
- gpr_slice_buffer_add(st->output, gpr_slice_split_head(&slice, remaining));
+ grpc_slice_buffer_add(st->output, grpc_slice_split_head(&slice, remaining));
finish_frame(st, 0, 0);
begin_frame(st);
add_header_data(st, slice);
@@ -167,7 +167,7 @@ static void add_header_data(framer_state *st, gpr_slice slice) {
static uint8_t *add_tiny_header_data(framer_state *st, size_t len) {
ensure_space(st, len);
- return gpr_slice_buffer_tiny_add(st->output, len);
+ return grpc_slice_buffer_tiny_add(st->output, len);
}
static void evict_entry(grpc_chttp2_hpack_compressor *c) {
@@ -268,9 +268,10 @@ static void emit_indexed(grpc_chttp2_hpack_compressor *c, uint32_t elem_index,
len);
}
-static gpr_slice get_wire_value(grpc_mdelem *elem, uint8_t *huffman_prefix) {
- if (grpc_is_binary_header((const char *)GPR_SLICE_START_PTR(elem->key->slice),
- GPR_SLICE_LENGTH(elem->key->slice))) {
+static grpc_slice get_wire_value(grpc_mdelem *elem, uint8_t *huffman_prefix) {
+ if (grpc_is_binary_header(
+ (const char *)GRPC_SLICE_START_PTR(elem->key->slice),
+ GRPC_SLICE_LENGTH(elem->key->slice))) {
*huffman_prefix = 0x80;
return grpc_mdstr_as_base64_encoded_and_huffman_compressed(elem->value);
}
@@ -284,8 +285,8 @@ static void emit_lithdr_incidx(grpc_chttp2_hpack_compressor *c,
framer_state *st) {
uint32_t len_pfx = GRPC_CHTTP2_VARINT_LENGTH(key_index, 2);
uint8_t huffman_prefix;
- gpr_slice value_slice = get_wire_value(elem, &huffman_prefix);
- size_t len_val = GPR_SLICE_LENGTH(value_slice);
+ grpc_slice value_slice = get_wire_value(elem, &huffman_prefix);
+ size_t len_val = GRPC_SLICE_LENGTH(value_slice);
uint32_t len_val_len;
GPR_ASSERT(len_val <= UINT32_MAX);
len_val_len = GRPC_CHTTP2_VARINT_LENGTH((uint32_t)len_val, 1);
@@ -293,7 +294,7 @@ static void emit_lithdr_incidx(grpc_chttp2_hpack_compressor *c,
add_tiny_header_data(st, len_pfx), len_pfx);
GRPC_CHTTP2_WRITE_VARINT((uint32_t)len_val, 1, huffman_prefix,
add_tiny_header_data(st, len_val_len), len_val_len);
- add_header_data(st, gpr_slice_ref(value_slice));
+ add_header_data(st, grpc_slice_ref(value_slice));
}
static void emit_lithdr_noidx(grpc_chttp2_hpack_compressor *c,
@@ -301,8 +302,8 @@ static void emit_lithdr_noidx(grpc_chttp2_hpack_compressor *c,
framer_state *st) {
uint32_t len_pfx = GRPC_CHTTP2_VARINT_LENGTH(key_index, 4);
uint8_t huffman_prefix;
- gpr_slice value_slice = get_wire_value(elem, &huffman_prefix);
- size_t len_val = GPR_SLICE_LENGTH(value_slice);
+ grpc_slice value_slice = get_wire_value(elem, &huffman_prefix);
+ size_t len_val = GRPC_SLICE_LENGTH(value_slice);
uint32_t len_val_len;
GPR_ASSERT(len_val <= UINT32_MAX);
len_val_len = GRPC_CHTTP2_VARINT_LENGTH((uint32_t)len_val, 1);
@@ -310,45 +311,45 @@ static void emit_lithdr_noidx(grpc_chttp2_hpack_compressor *c,
add_tiny_header_data(st, len_pfx), len_pfx);
GRPC_CHTTP2_WRITE_VARINT((uint32_t)len_val, 1, huffman_prefix,
add_tiny_header_data(st, len_val_len), len_val_len);
- add_header_data(st, gpr_slice_ref(value_slice));
+ add_header_data(st, grpc_slice_ref(value_slice));
}
static void emit_lithdr_incidx_v(grpc_chttp2_hpack_compressor *c,
grpc_mdelem *elem, framer_state *st) {
- uint32_t len_key = (uint32_t)GPR_SLICE_LENGTH(elem->key->slice);
+ uint32_t len_key = (uint32_t)GRPC_SLICE_LENGTH(elem->key->slice);
uint8_t huffman_prefix;
- gpr_slice value_slice = get_wire_value(elem, &huffman_prefix);
- uint32_t len_val = (uint32_t)GPR_SLICE_LENGTH(value_slice);
+ grpc_slice value_slice = get_wire_value(elem, &huffman_prefix);
+ uint32_t len_val = (uint32_t)GRPC_SLICE_LENGTH(value_slice);
uint32_t len_key_len = GRPC_CHTTP2_VARINT_LENGTH(len_key, 1);
uint32_t len_val_len = GRPC_CHTTP2_VARINT_LENGTH(len_val, 1);
GPR_ASSERT(len_key <= UINT32_MAX);
- GPR_ASSERT(GPR_SLICE_LENGTH(value_slice) <= UINT32_MAX);
+ GPR_ASSERT(GRPC_SLICE_LENGTH(value_slice) <= UINT32_MAX);
*add_tiny_header_data(st, 1) = 0x40;
GRPC_CHTTP2_WRITE_VARINT(len_key, 1, 0x00,
add_tiny_header_data(st, len_key_len), len_key_len);
- add_header_data(st, gpr_slice_ref(elem->key->slice));
+ add_header_data(st, grpc_slice_ref(elem->key->slice));
GRPC_CHTTP2_WRITE_VARINT(len_val, 1, huffman_prefix,
add_tiny_header_data(st, len_val_len), len_val_len);
- add_header_data(st, gpr_slice_ref(value_slice));
+ add_header_data(st, grpc_slice_ref(value_slice));
}
static void emit_lithdr_noidx_v(grpc_chttp2_hpack_compressor *c,
grpc_mdelem *elem, framer_state *st) {
- uint32_t len_key = (uint32_t)GPR_SLICE_LENGTH(elem->key->slice);
+ uint32_t len_key = (uint32_t)GRPC_SLICE_LENGTH(elem->key->slice);
uint8_t huffman_prefix;
- gpr_slice value_slice = get_wire_value(elem, &huffman_prefix);
- uint32_t len_val = (uint32_t)GPR_SLICE_LENGTH(value_slice);
+ grpc_slice value_slice = get_wire_value(elem, &huffman_prefix);
+ uint32_t len_val = (uint32_t)GRPC_SLICE_LENGTH(value_slice);
uint32_t len_key_len = GRPC_CHTTP2_VARINT_LENGTH(len_key, 1);
uint32_t len_val_len = GRPC_CHTTP2_VARINT_LENGTH(len_val, 1);
GPR_ASSERT(len_key <= UINT32_MAX);
- GPR_ASSERT(GPR_SLICE_LENGTH(value_slice) <= UINT32_MAX);
+ GPR_ASSERT(GRPC_SLICE_LENGTH(value_slice) <= UINT32_MAX);
*add_tiny_header_data(st, 1) = 0x00;
GRPC_CHTTP2_WRITE_VARINT(len_key, 1, 0x00,
add_tiny_header_data(st, len_key_len), len_key_len);
- add_header_data(st, gpr_slice_ref(elem->key->slice));
+ add_header_data(st, grpc_slice_ref(elem->key->slice));
GRPC_CHTTP2_WRITE_VARINT(len_val, 1, huffman_prefix,
add_tiny_header_data(st, len_val_len), len_val_len);
- add_header_data(st, gpr_slice_ref(value_slice));
+ add_header_data(st, grpc_slice_ref(value_slice));
}
static void emit_advertise_table_size_change(grpc_chttp2_hpack_compressor *c,
@@ -373,8 +374,8 @@ static void hpack_enc(grpc_chttp2_hpack_compressor *c, grpc_mdelem *elem,
uint32_t indices_key;
int should_add_elem;
- GPR_ASSERT(GPR_SLICE_LENGTH(elem->key->slice) > 0);
- if (GPR_SLICE_START_PTR(elem->key->slice)[0] != ':') { /* regular header */
+ GPR_ASSERT(GRPC_SLICE_LENGTH(elem->key->slice) > 0);
+ if (GRPC_SLICE_START_PTR(elem->key->slice)[0] != ':') { /* regular header */
st->seen_regular_header = 1;
} else {
GPR_ASSERT(
@@ -546,7 +547,7 @@ void grpc_chttp2_encode_header(grpc_chttp2_hpack_compressor *c,
grpc_metadata_batch *metadata, int is_eof,
size_t max_frame_size,
grpc_transport_one_way_stats *stats,
- gpr_slice_buffer *outbuf) {
+ grpc_slice_buffer *outbuf) {
framer_state st;
grpc_linked_mdelem *l;
gpr_timespec deadline;
diff --git a/src/core/ext/transport/chttp2/transport/hpack_encoder.h b/src/core/ext/transport/chttp2/transport/hpack_encoder.h
index 4c3a931549..bcbd675ca2 100644
--- a/src/core/ext/transport/chttp2/transport/hpack_encoder.h
+++ b/src/core/ext/transport/chttp2/transport/hpack_encoder.h
@@ -34,9 +34,9 @@
#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_ENCODER_H
#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_ENCODER_H
+#include <grpc/slice.h>
+#include <grpc/slice_buffer.h>
#include <grpc/support/port_platform.h>
-#include <grpc/support/slice.h>
-#include <grpc/support/slice_buffer.h>
#include "src/core/ext/transport/chttp2/transport/frame.h"
#include "src/core/lib/transport/metadata.h"
#include "src/core/lib/transport/metadata_batch.h"
@@ -93,6 +93,6 @@ void grpc_chttp2_encode_header(grpc_chttp2_hpack_compressor *c, uint32_t id,
grpc_metadata_batch *metadata, int is_eof,
size_t max_frame_size,
grpc_transport_one_way_stats *stats,
- gpr_slice_buffer *outbuf);
+ grpc_slice_buffer *outbuf);
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_ENCODER_H */
diff --git a/src/core/ext/transport/chttp2/transport/hpack_parser.c b/src/core/ext/transport/chttp2/transport/hpack_parser.c
index 9702cb2c81..6a9200b8db 100644
--- a/src/core/ext/transport/chttp2/transport/hpack_parser.c
+++ b/src/core/ext/transport/chttp2/transport/hpack_parser.c
@@ -1502,9 +1502,9 @@ static grpc_error *is_binary_indexed_header(grpc_chttp2_hpack_parser *p,
GRPC_ERROR_INT_INDEX, (intptr_t)p->index),
GRPC_ERROR_INT_SIZE, (intptr_t)p->table.num_ents);
}
- *is =
- grpc_is_binary_header((const char *)GPR_SLICE_START_PTR(elem->key->slice),
- GPR_SLICE_LENGTH(elem->key->slice));
+ *is = grpc_is_binary_header(
+ (const char *)GRPC_SLICE_START_PTR(elem->key->slice),
+ GRPC_SLICE_LENGTH(elem->key->slice));
return GRPC_ERROR_NONE;
}
@@ -1584,7 +1584,7 @@ static void force_client_rst_stream(grpc_exec_ctx *exec_ctx, void *sp,
grpc_chttp2_stream *s = sp;
grpc_chttp2_transport *t = s->t;
if (!s->write_closed) {
- gpr_slice_buffer_add(
+ grpc_slice_buffer_add(
&t->qbuf, grpc_chttp2_rst_stream_create(s->id, GRPC_CHTTP2_NO_ERROR,
&s->stats.outgoing));
grpc_chttp2_initiate_write(exec_ctx, t, false, "force_rst_stream");
@@ -1597,14 +1597,14 @@ grpc_error *grpc_chttp2_header_parser_parse(grpc_exec_ctx *exec_ctx,
void *hpack_parser,
grpc_chttp2_transport *t,
grpc_chttp2_stream *s,
- gpr_slice slice, int is_last) {
+ grpc_slice slice, int is_last) {
grpc_chttp2_hpack_parser *parser = hpack_parser;
GPR_TIMER_BEGIN("grpc_chttp2_hpack_parser_parse", 0);
if (s != NULL) {
- s->stats.incoming.header_bytes += GPR_SLICE_LENGTH(slice);
+ s->stats.incoming.header_bytes += GRPC_SLICE_LENGTH(slice);
}
grpc_error *error = grpc_chttp2_hpack_parser_parse(
- exec_ctx, parser, GPR_SLICE_START_PTR(slice), GPR_SLICE_END_PTR(slice));
+ exec_ctx, parser, GRPC_SLICE_START_PTR(slice), GRPC_SLICE_END_PTR(slice));
if (error != GRPC_ERROR_NONE) {
GPR_TIMER_END("grpc_chttp2_hpack_parser_parse", 0);
return error;
diff --git a/src/core/ext/transport/chttp2/transport/hpack_parser.h b/src/core/ext/transport/chttp2/transport/hpack_parser.h
index 0290c78d5a..a39bf466cd 100644
--- a/src/core/ext/transport/chttp2/transport/hpack_parser.h
+++ b/src/core/ext/transport/chttp2/transport/hpack_parser.h
@@ -116,6 +116,6 @@ grpc_error *grpc_chttp2_header_parser_parse(grpc_exec_ctx *exec_ctx,
void *hpack_parser,
grpc_chttp2_transport *t,
grpc_chttp2_stream *s,
- gpr_slice slice, int is_last);
+ grpc_slice slice, int is_last);
#endif /* GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_PARSER_H */
diff --git a/src/core/ext/transport/chttp2/transport/hpack_table.c b/src/core/ext/transport/chttp2/transport/hpack_table.c
index 2b73ec969e..2dc793d304 100644
--- a/src/core/ext/transport/chttp2/transport/hpack_table.c
+++ b/src/core/ext/transport/chttp2/transport/hpack_table.c
@@ -226,8 +226,8 @@ grpc_mdelem *grpc_chttp2_hptbl_lookup(const grpc_chttp2_hptbl *tbl,
/* Evict one element from the table */
static void evict1(grpc_chttp2_hptbl *tbl) {
grpc_mdelem *first_ent = tbl->ents[tbl->first_ent];
- size_t elem_bytes = GPR_SLICE_LENGTH(first_ent->key->slice) +
- GPR_SLICE_LENGTH(first_ent->value->slice) +
+ size_t elem_bytes = GRPC_SLICE_LENGTH(first_ent->key->slice) +
+ GRPC_SLICE_LENGTH(first_ent->value->slice) +
GRPC_CHTTP2_HPACK_ENTRY_OVERHEAD;
GPR_ASSERT(elem_bytes <= tbl->mem_used);
tbl->mem_used -= (uint32_t)elem_bytes;
@@ -298,8 +298,8 @@ grpc_error *grpc_chttp2_hptbl_set_current_table_size(grpc_chttp2_hptbl *tbl,
grpc_error *grpc_chttp2_hptbl_add(grpc_chttp2_hptbl *tbl, grpc_mdelem *md) {
/* determine how many bytes of buffer this entry represents */
- size_t elem_bytes = GPR_SLICE_LENGTH(md->key->slice) +
- GPR_SLICE_LENGTH(md->value->slice) +
+ size_t elem_bytes = GRPC_SLICE_LENGTH(md->key->slice) +
+ GRPC_SLICE_LENGTH(md->value->slice) +
GRPC_CHTTP2_HPACK_ENTRY_OVERHEAD;
if (tbl->current_table_bytes > tbl->max_bytes) {
diff --git a/src/core/ext/transport/chttp2/transport/hpack_table.h b/src/core/ext/transport/chttp2/transport/hpack_table.h
index 45bd9255bf..2ca130e64b 100644
--- a/src/core/ext/transport/chttp2/transport/hpack_table.h
+++ b/src/core/ext/transport/chttp2/transport/hpack_table.h
@@ -34,8 +34,8 @@
#ifndef GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_TABLE_H
#define GRPC_CORE_EXT_TRANSPORT_CHTTP2_TRANSPORT_HPACK_TABLE_H
+#include <grpc/slice.h>
#include <grpc/support/port_platform.h>
-#include <grpc/support/slice.h>
#include "src/core/lib/iomgr/error.h"
#include "src/core/lib/transport/metadata.h"
diff --git a/src/core/ext/transport/chttp2/transport/internal.h b/src/core/ext/transport/chttp2/transport/internal.h
index e0c4a1e925..b74233d992 100644
--- a/src/core/ext/transport/chttp2/transport/internal.h
+++ b/src/core/ext/transport/chttp2/transport/internal.h
@@ -170,14 +170,14 @@ struct grpc_chttp2_incoming_byte_stream {
bool is_tail;
gpr_mu slice_mu; // protects slices, on_next
- gpr_slice_buffer slices;
+ grpc_slice_buffer slices;
grpc_closure *on_next;
- gpr_slice *next;
+ grpc_slice *next;
uint32_t remaining_bytes;
struct {
grpc_closure closure;
- gpr_slice *slice;
+ grpc_slice *slice;
size_t max_size_hint;
grpc_closure *on_complete;
} next_action;
@@ -219,7 +219,7 @@ struct grpc_chttp2_transport {
grpc_closure read_action_locked;
/** incoming read bytes */
- gpr_slice_buffer read_buffer;
+ grpc_slice_buffer read_buffer;
/** address to place a newly accepted stream - set and unset by
grpc_chttp2_parsing_accept_stream; used by init_stream to
@@ -237,7 +237,7 @@ struct grpc_chttp2_transport {
} channel_callback;
/** data to write now */
- gpr_slice_buffer outbuf;
+ grpc_slice_buffer outbuf;
/** hpack encoding */
grpc_chttp2_hpack_compressor hpack_compressor;
int64_t outgoing_window;
@@ -245,7 +245,7 @@ struct grpc_chttp2_transport {
uint8_t is_client;
/** data to write next write */
- gpr_slice_buffer qbuf;
+ grpc_slice_buffer qbuf;
/** window available to announce to peer */
int64_t announce_incoming_window;
@@ -314,12 +314,12 @@ struct grpc_chttp2_transport {
grpc_chttp2_stream *incoming_stream;
grpc_error *(*parser)(grpc_exec_ctx *exec_ctx, void *parser_user_data,
grpc_chttp2_transport *t, grpc_chttp2_stream *s,
- gpr_slice slice, int is_last);
+ grpc_slice slice, int is_last);
/* goaway data */
grpc_status_code goaway_error;
uint32_t goaway_last_stream_index;
- gpr_slice goaway_text;
+ grpc_slice goaway_text;
grpc_chttp2_write_cb *write_cb_pool;
@@ -374,7 +374,7 @@ struct grpc_chttp2_stream {
grpc_byte_stream *fetching_send_message;
uint32_t fetched_send_message_length;
- gpr_slice fetching_slice;
+ grpc_slice fetching_slice;
int64_t next_message_end_offset;
int64_t flow_controlled_bytes_written;
bool complete_fetch_covered_by_poller;
@@ -434,7 +434,7 @@ struct grpc_chttp2_stream {
bool sent_trailing_metadata;
/** how much window should we announce? */
uint32_t announce_window;
- gpr_slice_buffer flow_controlled_buffer;
+ grpc_slice_buffer flow_controlled_buffer;
grpc_chttp2_write_cb *on_write_finished_cbs;
grpc_chttp2_write_cb *finish_after_write;
@@ -466,7 +466,8 @@ void grpc_chttp2_end_write(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
/** Process one slice of incoming data; return 1 if the connection is still
viable after reading, or 0 if the connection should be torn down */
grpc_error *grpc_chttp2_perform_read(grpc_exec_ctx *exec_ctx,
- grpc_chttp2_transport *t, gpr_slice slice);
+ grpc_chttp2_transport *t,
+ grpc_slice slice);
bool grpc_chttp2_list_add_writable_stream(grpc_chttp2_transport *t,
grpc_chttp2_stream *s);
@@ -509,7 +510,7 @@ grpc_chttp2_stream *grpc_chttp2_parsing_accept_stream(grpc_exec_ctx *exec_ctx,
void grpc_chttp2_add_incoming_goaway(grpc_exec_ctx *exec_ctx,
grpc_chttp2_transport *t,
uint32_t goaway_error,
- gpr_slice goaway_text);
+ grpc_slice goaway_text);
void grpc_chttp2_parsing_become_skip_parser(grpc_exec_ctx *exec_ctx,
grpc_chttp2_transport *t);
@@ -611,7 +612,7 @@ void grpc_chttp2_flowctl_trace(const char *file, int line, const char *phase,
void grpc_chttp2_fake_status(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
grpc_chttp2_stream *stream,
- grpc_status_code status, gpr_slice *details);
+ grpc_status_code status, grpc_slice *details);
void grpc_chttp2_mark_stream_closed(grpc_exec_ctx *exec_ctx,
grpc_chttp2_transport *t,
grpc_chttp2_stream *s, int close_reads,
@@ -659,7 +660,7 @@ grpc_chttp2_incoming_byte_stream *grpc_chttp2_incoming_byte_stream_create(
uint32_t frame_size, uint32_t flags);
void grpc_chttp2_incoming_byte_stream_push(grpc_exec_ctx *exec_ctx,
grpc_chttp2_incoming_byte_stream *bs,
- gpr_slice slice);
+ grpc_slice slice);
void grpc_chttp2_incoming_byte_stream_finished(
grpc_exec_ctx *exec_ctx, grpc_chttp2_incoming_byte_stream *bs,
grpc_error *error);
diff --git a/src/core/ext/transport/chttp2/transport/parsing.c b/src/core/ext/transport/chttp2/transport/parsing.c
index 8005350ae7..b9c405158f 100644
--- a/src/core/ext/transport/chttp2/transport/parsing.c
+++ b/src/core/ext/transport/chttp2/transport/parsing.c
@@ -67,14 +67,14 @@ static grpc_error *init_skip_frame_parser(grpc_exec_ctx *exec_ctx,
int is_header);
static grpc_error *parse_frame_slice(grpc_exec_ctx *exec_ctx,
- grpc_chttp2_transport *t, gpr_slice slice,
+ grpc_chttp2_transport *t, grpc_slice slice,
int is_last);
grpc_error *grpc_chttp2_perform_read(grpc_exec_ctx *exec_ctx,
grpc_chttp2_transport *t,
- gpr_slice slice) {
- uint8_t *beg = GPR_SLICE_START_PTR(slice);
- uint8_t *end = GPR_SLICE_END_PTR(slice);
+ grpc_slice slice) {
+ uint8_t *beg = GRPC_SLICE_START_PTR(slice);
+ uint8_t *end = GRPC_SLICE_END_PTR(slice);
uint8_t *cur = beg;
grpc_error *err;
@@ -229,10 +229,10 @@ grpc_error *grpc_chttp2_perform_read(grpc_exec_ctx *exec_ctx,
case GRPC_DTS_FRAME:
GPR_ASSERT(cur < end);
if ((uint32_t)(end - cur) == t->incoming_frame_size) {
- err = parse_frame_slice(exec_ctx, t,
- gpr_slice_sub_no_ref(slice, (size_t)(cur - beg),
- (size_t)(end - beg)),
- 1);
+ err = parse_frame_slice(
+ exec_ctx, t, grpc_slice_sub_no_ref(slice, (size_t)(cur - beg),
+ (size_t)(end - beg)),
+ 1);
if (err != GRPC_ERROR_NONE) {
return err;
}
@@ -243,8 +243,8 @@ grpc_error *grpc_chttp2_perform_read(grpc_exec_ctx *exec_ctx,
size_t cur_offset = (size_t)(cur - beg);
err = parse_frame_slice(
exec_ctx, t,
- gpr_slice_sub_no_ref(slice, cur_offset,
- cur_offset + t->incoming_frame_size),
+ grpc_slice_sub_no_ref(slice, cur_offset,
+ cur_offset + t->incoming_frame_size),
1);
if (err != GRPC_ERROR_NONE) {
return err;
@@ -253,10 +253,10 @@ grpc_error *grpc_chttp2_perform_read(grpc_exec_ctx *exec_ctx,
t->incoming_stream = NULL;
goto dts_fh_0; /* loop */
} else {
- err = parse_frame_slice(exec_ctx, t,
- gpr_slice_sub_no_ref(slice, (size_t)(cur - beg),
- (size_t)(end - beg)),
- 0);
+ err = parse_frame_slice(
+ exec_ctx, t, grpc_slice_sub_no_ref(slice, (size_t)(cur - beg),
+ (size_t)(end - beg)),
+ 0);
if (err != GRPC_ERROR_NONE) {
return err;
}
@@ -331,7 +331,7 @@ static grpc_error *init_frame_parser(grpc_exec_ctx *exec_ctx,
static grpc_error *skip_parser(grpc_exec_ctx *exec_ctx, void *parser,
grpc_chttp2_transport *t, grpc_chttp2_stream *s,
- gpr_slice slice, int is_last) {
+ grpc_slice slice, int is_last) {
return GRPC_ERROR_NONE;
}
@@ -430,7 +430,7 @@ error_handler:
if (s != NULL) {
grpc_chttp2_mark_stream_closed(exec_ctx, t, s, true, false, err);
}
- gpr_slice_buffer_add(
+ grpc_slice_buffer_add(
&t->qbuf, grpc_chttp2_rst_stream_create(t->incoming_stream_id,
GRPC_CHTTP2_PROTOCOL_ERROR,
&s->stats.outgoing));
@@ -722,7 +722,7 @@ static grpc_error *init_settings_frame_parser(grpc_exec_ctx *exec_ctx,
}
static grpc_error *parse_frame_slice(grpc_exec_ctx *exec_ctx,
- grpc_chttp2_transport *t, gpr_slice slice,
+ grpc_chttp2_transport *t, grpc_slice slice,
int is_last) {
grpc_chttp2_stream *s = t->incoming_stream;
grpc_error *err = t->parser(exec_ctx, t->parser_data, t, s, slice, is_last);
@@ -737,7 +737,7 @@ static grpc_error *parse_frame_slice(grpc_exec_ctx *exec_ctx,
grpc_chttp2_parsing_become_skip_parser(exec_ctx, t);
if (s) {
s->forced_close_error = err;
- gpr_slice_buffer_add(
+ grpc_slice_buffer_add(
&t->qbuf, grpc_chttp2_rst_stream_create(t->incoming_stream_id,
GRPC_CHTTP2_PROTOCOL_ERROR,
&s->stats.outgoing));
diff --git a/src/core/ext/transport/chttp2/transport/writing.c b/src/core/ext/transport/chttp2/transport/writing.c
index b39695a1a5..139e7387c4 100644
--- a/src/core/ext/transport/chttp2/transport/writing.c
+++ b/src/core/ext/transport/chttp2/transport/writing.c
@@ -80,7 +80,7 @@ bool grpc_chttp2_begin_write(grpc_exec_ctx *exec_ctx,
GPR_TIMER_BEGIN("grpc_chttp2_begin_write", 0);
if (t->dirtied_local_settings && !t->sent_local_settings) {
- gpr_slice_buffer_add(
+ grpc_slice_buffer_add(
&t->outbuf,
grpc_chttp2_settings_create(
t->settings[GRPC_SENT_SETTINGS], t->settings[GRPC_LOCAL_SETTINGS],
@@ -91,7 +91,7 @@ bool grpc_chttp2_begin_write(grpc_exec_ctx *exec_ctx,
}
/* simple writes are queued to qbuf, and flushed here */
- gpr_slice_buffer_move_into(&t->qbuf, &t->outbuf);
+ grpc_slice_buffer_move_into(&t->qbuf, &t->outbuf);
GPR_ASSERT(t->qbuf.count == 0);
grpc_chttp2_hpack_compressor_set_max_table_size(
@@ -130,9 +130,9 @@ bool grpc_chttp2_begin_write(grpc_exec_ctx *exec_ctx,
/* send any window updates */
if (s->announce_window > 0) {
uint32_t announce = s->announce_window;
- gpr_slice_buffer_add(&t->outbuf,
- grpc_chttp2_window_update_create(
- s->id, s->announce_window, &s->stats.outgoing));
+ grpc_slice_buffer_add(&t->outbuf,
+ grpc_chttp2_window_update_create(
+ s->id, s->announce_window, &s->stats.outgoing));
GRPC_CHTTP2_FLOW_DEBIT_STREAM("write", t, s, announce_window, announce);
}
if (sent_initial_metadata) {
@@ -162,9 +162,9 @@ bool grpc_chttp2_begin_write(grpc_exec_ctx *exec_ctx,
s->send_trailing_metadata = NULL;
s->sent_trailing_metadata = true;
if (!t->is_client && !s->read_closed) {
- gpr_slice_buffer_add(&t->outbuf, grpc_chttp2_rst_stream_create(
- s->id, GRPC_CHTTP2_NO_ERROR,
- &s->stats.outgoing));
+ grpc_slice_buffer_add(&t->outbuf, grpc_chttp2_rst_stream_create(
+ s->id, GRPC_CHTTP2_NO_ERROR,
+ &s->stats.outgoing));
}
}
s->sending_bytes += send_bytes;
@@ -194,7 +194,7 @@ bool grpc_chttp2_begin_write(grpc_exec_ctx *exec_ctx,
s->send_trailing_metadata = NULL;
s->sent_trailing_metadata = true;
if (!t->is_client && !s->read_closed) {
- gpr_slice_buffer_add(
+ grpc_slice_buffer_add(
&t->outbuf, grpc_chttp2_rst_stream_create(
s->id, GRPC_CHTTP2_NO_ERROR, &s->stats.outgoing));
}
@@ -220,8 +220,8 @@ bool grpc_chttp2_begin_write(grpc_exec_ctx *exec_ctx,
GRPC_CHTTP2_FLOW_DEBIT_TRANSPORT("write", t, announce_incoming_window,
announced);
grpc_transport_one_way_stats throwaway_stats;
- gpr_slice_buffer_add(&t->outbuf, grpc_chttp2_window_update_create(
- 0, announced, &throwaway_stats));
+ grpc_slice_buffer_add(&t->outbuf, grpc_chttp2_window_update_create(
+ 0, announced, &throwaway_stats));
}
GPR_TIMER_END("grpc_chttp2_begin_write", 0);
@@ -254,7 +254,7 @@ void grpc_chttp2_end_write(grpc_exec_ctx *exec_ctx, grpc_chttp2_transport *t,
}
GRPC_CHTTP2_STREAM_UNREF(exec_ctx, s, "chttp2_writing:end");
}
- gpr_slice_buffer_reset_and_unref(&t->outbuf);
+ grpc_slice_buffer_reset_and_unref(&t->outbuf);
GRPC_ERROR_UNREF(error);
GPR_TIMER_END("grpc_chttp2_end_write", 0);
}
diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.c b/src/core/ext/transport/cronet/transport/cronet_transport.c
index 25ad40b935..1e5377c2b4 100644
--- a/src/core/ext/transport/cronet/transport/cronet_transport.c
+++ b/src/core/ext/transport/cronet/transport/cronet_transport.c
@@ -34,10 +34,10 @@
#include <string.h>
#include <grpc/impl/codegen/port_platform.h>
+#include <grpc/slice_buffer.h>
#include <grpc/support/alloc.h>
#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
-#include <grpc/support/slice_buffer.h>
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
@@ -130,7 +130,7 @@ struct read_state {
/* vars for holding data destined for the application */
struct grpc_slice_buffer_stream sbs;
- gpr_slice_buffer read_slice_buffer;
+ grpc_slice_buffer read_slice_buffer;
/* vars for trailing metadata */
grpc_chttp2_incoming_metadata_buffer trailing_metadata;
@@ -517,11 +517,11 @@ static void on_response_trailers_received(
Utility function that takes the data from s->write_slice_buffer and assembles
into a contiguous byte stream with 5 byte gRPC header prepended.
*/
-static void create_grpc_frame(gpr_slice_buffer *write_slice_buffer,
+static void create_grpc_frame(grpc_slice_buffer *write_slice_buffer,
char **pp_write_buffer,
size_t *p_write_buffer_size) {
- gpr_slice slice = gpr_slice_buffer_take_first(write_slice_buffer);
- size_t length = GPR_SLICE_LENGTH(slice);
+ grpc_slice slice = grpc_slice_buffer_take_first(write_slice_buffer);
+ size_t length = GRPC_SLICE_LENGTH(slice);
*p_write_buffer_size = length + GRPC_HEADER_SIZE_IN_BYTES;
/* This is freed in the on_write_completed callback */
char *write_buffer = gpr_malloc(length + GRPC_HEADER_SIZE_IN_BYTES);
@@ -534,7 +534,7 @@ static void create_grpc_frame(gpr_slice_buffer *write_slice_buffer,
*p++ = (uint8_t)(length >> 8);
*p++ = (uint8_t)(length);
/* append actual data */
- memcpy(p, GPR_SLICE_START_PTR(slice), length);
+ memcpy(p, GRPC_SLICE_START_PTR(slice), length);
}
/*
@@ -817,9 +817,9 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx,
result = NO_ACTION_POSSIBLE;
CRONET_LOG(GPR_DEBUG, "Stream is either cancelled or failed.");
} else {
- gpr_slice_buffer write_slice_buffer;
- gpr_slice slice;
- gpr_slice_buffer_init(&write_slice_buffer);
+ grpc_slice_buffer write_slice_buffer;
+ grpc_slice slice;
+ grpc_slice_buffer_init(&write_slice_buffer);
grpc_byte_stream_next(NULL, stream_op->send_message, &slice,
stream_op->send_message->length, NULL);
/* Check that compression flag is OFF. We don't support compression yet.
@@ -828,7 +828,7 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx,
gpr_log(GPR_ERROR, "Compression is not supported");
GPR_ASSERT(stream_op->send_message->flags == 0);
}
- gpr_slice_buffer_add(&write_slice_buffer, slice);
+ grpc_slice_buffer_add(&write_slice_buffer, slice);
if (write_slice_buffer.count != 1) {
/* Empty request not handled yet */
gpr_log(GPR_ERROR, "Empty request is not supported");
@@ -891,7 +891,7 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx,
} else {
stream_state->rs.remaining_bytes = 0;
CRONET_LOG(GPR_DEBUG, "read operation complete. Empty response.");
- gpr_slice_buffer_init(&stream_state->rs.read_slice_buffer);
+ grpc_slice_buffer_init(&stream_state->rs.read_slice_buffer);
grpc_slice_buffer_stream_init(&stream_state->rs.sbs,
&stream_state->rs.read_slice_buffer, 0);
*((grpc_byte_buffer **)stream_op->recv_message) =
@@ -918,15 +918,15 @@ static enum e_op_result execute_stream_op(grpc_exec_ctx *exec_ctx,
}
} else if (stream_state->rs.remaining_bytes == 0) {
CRONET_LOG(GPR_DEBUG, "read operation complete");
- gpr_slice read_data_slice =
- gpr_slice_malloc((uint32_t)stream_state->rs.length_field);
- uint8_t *dst_p = GPR_SLICE_START_PTR(read_data_slice);
+ grpc_slice read_data_slice =
+ grpc_slice_malloc((uint32_t)stream_state->rs.length_field);
+ uint8_t *dst_p = GRPC_SLICE_START_PTR(read_data_slice);
memcpy(dst_p, stream_state->rs.read_buffer,
(size_t)stream_state->rs.length_field);
free_read_buffer(s);
- gpr_slice_buffer_init(&stream_state->rs.read_slice_buffer);
- gpr_slice_buffer_add(&stream_state->rs.read_slice_buffer,
- read_data_slice);
+ grpc_slice_buffer_init(&stream_state->rs.read_slice_buffer);
+ grpc_slice_buffer_add(&stream_state->rs.read_slice_buffer,
+ read_data_slice);
grpc_slice_buffer_stream_init(&stream_state->rs.sbs,
&stream_state->rs.read_slice_buffer, 0);
*((grpc_byte_buffer **)stream_op->recv_message) =
diff --git a/src/core/lib/channel/channel_stack.c b/src/core/lib/channel/channel_stack.c
index 2c5367901d..9da81959e7 100644
--- a/src/core/lib/channel/channel_stack.c
+++ b/src/core/lib/channel/channel_stack.c
@@ -288,7 +288,7 @@ void grpc_call_element_send_cancel(grpc_exec_ctx *exec_ctx,
void grpc_call_element_send_cancel_with_message(grpc_exec_ctx *exec_ctx,
grpc_call_element *elem,
grpc_status_code status,
- gpr_slice *optional_message) {
+ grpc_slice *optional_message) {
grpc_transport_stream_op *op = gpr_malloc(sizeof(*op));
memset(op, 0, sizeof(*op));
op->on_complete = grpc_closure_create(destroy_op, op);
@@ -300,7 +300,7 @@ void grpc_call_element_send_cancel_with_message(grpc_exec_ctx *exec_ctx,
void grpc_call_element_send_close_with_message(grpc_exec_ctx *exec_ctx,
grpc_call_element *elem,
grpc_status_code status,
- gpr_slice *optional_message) {
+ grpc_slice *optional_message) {
grpc_transport_stream_op *op = gpr_malloc(sizeof(*op));
memset(op, 0, sizeof(*op));
op->on_complete = grpc_closure_create(destroy_op, op);
diff --git a/src/core/lib/channel/channel_stack.h b/src/core/lib/channel/channel_stack.h
index 27f3be7b29..0d58994726 100644
--- a/src/core/lib/channel/channel_stack.h
+++ b/src/core/lib/channel/channel_stack.h
@@ -289,12 +289,12 @@ void grpc_call_element_send_cancel(grpc_exec_ctx *exec_ctx,
void grpc_call_element_send_cancel_with_message(grpc_exec_ctx *exec_ctx,
grpc_call_element *cur_elem,
grpc_status_code status,
- gpr_slice *optional_message);
+ grpc_slice *optional_message);
void grpc_call_element_send_close_with_message(grpc_exec_ctx *exec_ctx,
grpc_call_element *cur_elem,
grpc_status_code status,
- gpr_slice *optional_message);
+ grpc_slice *optional_message);
extern int grpc_trace_channel;
diff --git a/src/core/lib/channel/compress_filter.c b/src/core/lib/channel/compress_filter.c
index 23b7dfb8fd..294aa2fa18 100644
--- a/src/core/lib/channel/compress_filter.c
+++ b/src/core/lib/channel/compress_filter.c
@@ -35,9 +35,9 @@
#include <string.h>
#include <grpc/compression.h>
+#include <grpc/slice_buffer.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/slice_buffer.h>
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/channel/compress_filter.h"
@@ -50,7 +50,7 @@
int grpc_compression_trace = 0;
typedef struct call_data {
- gpr_slice_buffer slices; /**< Buffers up input slices to be compressed */
+ grpc_slice_buffer slices; /**< Buffers up input slices to be compressed */
grpc_linked_mdelem compression_algorithm_storage;
grpc_linked_mdelem accept_encoding_storage;
uint32_t remaining_slice_bytes;
@@ -63,7 +63,7 @@ typedef struct call_data {
grpc_transport_stream_op *send_op;
uint32_t send_length;
uint32_t send_flags;
- gpr_slice incoming_slice;
+ grpc_slice incoming_slice;
grpc_slice_buffer_stream replacement_stream;
grpc_closure *post_send;
grpc_closure send_done;
@@ -161,7 +161,7 @@ static void continue_send_message(grpc_exec_ctx *exec_ctx,
static void send_done(grpc_exec_ctx *exec_ctx, void *elemp, grpc_error *error) {
grpc_call_element *elem = elemp;
call_data *calld = elem->call_data;
- gpr_slice_buffer_reset_and_unref(&calld->slices);
+ grpc_slice_buffer_reset_and_unref(&calld->slices);
calld->post_send->cb(exec_ctx, calld->post_send->cb_arg, error);
}
@@ -169,8 +169,8 @@ static void finish_send_message(grpc_exec_ctx *exec_ctx,
grpc_call_element *elem) {
call_data *calld = elem->call_data;
int did_compress;
- gpr_slice_buffer tmp;
- gpr_slice_buffer_init(&tmp);
+ grpc_slice_buffer tmp;
+ grpc_slice_buffer_init(&tmp);
did_compress =
grpc_msg_compress(calld->compression_algorithm, &calld->slices, &tmp);
if (did_compress) {
@@ -185,7 +185,7 @@ static void finish_send_message(grpc_exec_ctx *exec_ctx,
" bytes (%.2f%% savings)",
algo_name, before_size, after_size, 100 * savings_ratio);
}
- gpr_slice_buffer_swap(&calld->slices, &tmp);
+ grpc_slice_buffer_swap(&calld->slices, &tmp);
calld->send_flags |= GRPC_WRITE_INTERNAL_COMPRESS;
} else {
if (grpc_compression_trace) {
@@ -199,7 +199,7 @@ static void finish_send_message(grpc_exec_ctx *exec_ctx,
}
}
- gpr_slice_buffer_destroy(&tmp);
+ grpc_slice_buffer_destroy(&tmp);
grpc_slice_buffer_stream_init(&calld->replacement_stream, &calld->slices,
calld->send_flags);
@@ -213,7 +213,7 @@ static void finish_send_message(grpc_exec_ctx *exec_ctx,
static void got_slice(grpc_exec_ctx *exec_ctx, void *elemp, grpc_error *error) {
grpc_call_element *elem = elemp;
call_data *calld = elem->call_data;
- gpr_slice_buffer_add(&calld->slices, calld->incoming_slice);
+ grpc_slice_buffer_add(&calld->slices, calld->incoming_slice);
if (calld->send_length == calld->slices.length) {
finish_send_message(exec_ctx, elem);
} else {
@@ -227,7 +227,7 @@ static void continue_send_message(grpc_exec_ctx *exec_ctx,
while (grpc_byte_stream_next(exec_ctx, calld->send_op->send_message,
&calld->incoming_slice, ~(size_t)0,
&calld->got_slice)) {
- gpr_slice_buffer_add(&calld->slices, calld->incoming_slice);
+ grpc_slice_buffer_add(&calld->slices, calld->incoming_slice);
if (calld->send_length == calld->slices.length) {
finish_send_message(exec_ctx, elem);
break;
@@ -267,7 +267,7 @@ static grpc_error *init_call_elem(grpc_exec_ctx *exec_ctx,
call_data *calld = elem->call_data;
/* initialize members */
- gpr_slice_buffer_init(&calld->slices);
+ grpc_slice_buffer_init(&calld->slices);
calld->has_compression_algorithm = 0;
grpc_closure_init(&calld->got_slice, got_slice, elem);
grpc_closure_init(&calld->send_done, send_done, elem);
@@ -281,7 +281,7 @@ static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
void *ignored) {
/* grab pointers to our data from the call element */
call_data *calld = elem->call_data;
- gpr_slice_buffer_destroy(&calld->slices);
+ grpc_slice_buffer_destroy(&calld->slices);
}
/* Constructor for channel_data */
diff --git a/src/core/lib/channel/connected_channel.c b/src/core/lib/channel/connected_channel.c
index 918379c845..0e62d58475 100644
--- a/src/core/lib/channel/connected_channel.c
+++ b/src/core/lib/channel/connected_channel.c
@@ -38,9 +38,9 @@
#include <string.h>
#include <grpc/byte_buffer.h>
+#include <grpc/slice_buffer.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/slice_buffer.h>
#include "src/core/lib/profiling/timers.h"
#include "src/core/lib/support/string.h"
#include "src/core/lib/transport/transport.h"
diff --git a/src/core/lib/channel/deadline_filter.c b/src/core/lib/channel/deadline_filter.c
index d2ea5250f6..449eb7b8d6 100644
--- a/src/core/lib/channel/deadline_filter.c
+++ b/src/core/lib/channel/deadline_filter.c
@@ -55,10 +55,10 @@ static void timer_callback(grpc_exec_ctx* exec_ctx, void* arg,
deadline_state->timer_pending = false;
gpr_mu_unlock(&deadline_state->timer_mu);
if (error != GRPC_ERROR_CANCELLED) {
- gpr_slice msg = gpr_slice_from_static_string("Deadline Exceeded");
+ grpc_slice msg = grpc_slice_from_static_string("Deadline Exceeded");
grpc_call_element_send_cancel_with_message(
exec_ctx, elem, GRPC_STATUS_DEADLINE_EXCEEDED, &msg);
- gpr_slice_unref(msg);
+ grpc_slice_unref(msg);
}
GRPC_CALL_STACK_UNREF(exec_ctx, deadline_state->call_stack, "deadline_timer");
}
diff --git a/src/core/lib/channel/handshaker.c b/src/core/lib/channel/handshaker.c
index 0d759887bc..a45a39981c 100644
--- a/src/core/lib/channel/handshaker.c
+++ b/src/core/lib/channel/handshaker.c
@@ -62,7 +62,7 @@ void grpc_handshaker_do_handshake(grpc_exec_ctx* exec_ctx,
grpc_handshaker* handshaker,
grpc_endpoint* endpoint,
grpc_channel_args* args,
- gpr_slice_buffer* read_buffer,
+ grpc_slice_buffer* read_buffer,
gpr_timespec deadline,
grpc_tcp_server_acceptor* acceptor,
grpc_handshaker_done_cb cb, void* user_data) {
@@ -146,8 +146,8 @@ void grpc_handshake_manager_shutdown(grpc_exec_ctx* exec_ctx,
static void call_next_handshaker(grpc_exec_ctx* exec_ctx,
grpc_endpoint* endpoint,
grpc_channel_args* args,
- gpr_slice_buffer* read_buffer, void* user_data,
- grpc_error* error) {
+ grpc_slice_buffer* read_buffer,
+ void* user_data, grpc_error* error) {
grpc_handshake_manager* mgr = user_data;
GPR_ASSERT(mgr->state != NULL);
GPR_ASSERT(mgr->state->index < mgr->count);
@@ -183,8 +183,8 @@ void grpc_handshake_manager_do_handshake(
gpr_timespec deadline, grpc_tcp_server_acceptor* acceptor,
grpc_handshaker_done_cb cb, void* user_data) {
grpc_channel_args* args_copy = grpc_channel_args_copy(args);
- gpr_slice_buffer* read_buffer = gpr_malloc(sizeof(*read_buffer));
- gpr_slice_buffer_init(read_buffer);
+ grpc_slice_buffer* read_buffer = gpr_malloc(sizeof(*read_buffer));
+ grpc_slice_buffer_init(read_buffer);
if (mgr->count == 0) {
// No handshakers registered, so we just immediately call the done
// callback with the passed-in endpoint.
diff --git a/src/core/lib/channel/handshaker.h b/src/core/lib/channel/handshaker.h
index d574b46242..f8a36c6473 100644
--- a/src/core/lib/channel/handshaker.h
+++ b/src/core/lib/channel/handshaker.h
@@ -59,7 +59,7 @@ typedef struct grpc_handshaker grpc_handshaker;
typedef void (*grpc_handshaker_done_cb)(grpc_exec_ctx* exec_ctx,
grpc_endpoint* endpoint,
grpc_channel_args* args,
- gpr_slice_buffer* read_buffer,
+ grpc_slice_buffer* read_buffer,
void* user_data, grpc_error* error);
struct grpc_handshaker_vtable {
@@ -77,7 +77,7 @@ struct grpc_handshaker_vtable {
/// \a acceptor will be NULL for client-side handshakers.
void (*do_handshake)(grpc_exec_ctx* exec_ctx, grpc_handshaker* handshaker,
grpc_endpoint* endpoint, grpc_channel_args* args,
- gpr_slice_buffer* read_buffer, gpr_timespec deadline,
+ grpc_slice_buffer* read_buffer, gpr_timespec deadline,
grpc_tcp_server_acceptor* acceptor,
grpc_handshaker_done_cb cb, void* user_data);
};
@@ -103,7 +103,7 @@ void grpc_handshaker_do_handshake(grpc_exec_ctx* exec_ctx,
grpc_handshaker* handshaker,
grpc_endpoint* endpoint,
grpc_channel_args* args,
- gpr_slice_buffer* read_buffer,
+ grpc_slice_buffer* read_buffer,
gpr_timespec deadline,
grpc_tcp_server_acceptor* acceptor,
grpc_handshaker_done_cb cb, void* user_data);
diff --git a/src/core/lib/channel/http_client_filter.c b/src/core/lib/channel/http_client_filter.c
index 1dc05fb20d..0714f31bdd 100644
--- a/src/core/lib/channel/http_client_filter.c
+++ b/src/core/lib/channel/http_client_filter.c
@@ -62,9 +62,9 @@ typedef struct call_data {
grpc_transport_stream_op send_op;
uint32_t send_length;
uint32_t send_flags;
- gpr_slice incoming_slice;
+ grpc_slice incoming_slice;
grpc_slice_buffer_stream replacement_stream;
- gpr_slice_buffer slices;
+ grpc_slice_buffer slices;
/* flag that indicates that all slices of send_messages aren't availble */
bool send_message_blocked;
@@ -101,7 +101,7 @@ static grpc_mdelem *client_recv_filter(void *user_data, grpc_mdelem *md) {
char *message_string;
gpr_asprintf(&message_string, "Received http2 header with status: %s",
grpc_mdstr_as_c_string(md->value));
- gpr_slice message = gpr_slice_from_copied_string(message_string);
+ grpc_slice message = grpc_slice_from_copied_string(message_string);
gpr_free(message_string);
grpc_call_element_send_close_with_message(a->exec_ctx, a->elem,
GRPC_STATUS_CANCELLED, &message);
@@ -155,7 +155,7 @@ static void hc_on_complete(grpc_exec_ctx *exec_ctx, void *user_data,
static void send_done(grpc_exec_ctx *exec_ctx, void *elemp, grpc_error *error) {
grpc_call_element *elem = elemp;
call_data *calld = elem->call_data;
- gpr_slice_buffer_reset_and_unref(&calld->slices);
+ grpc_slice_buffer_reset_and_unref(&calld->slices);
calld->post_send->cb(exec_ctx, calld->post_send->cb_arg, error);
}
@@ -176,10 +176,10 @@ static void continue_send_message(grpc_exec_ctx *exec_ctx,
while (grpc_byte_stream_next(exec_ctx, calld->send_op.send_message,
&calld->incoming_slice, ~(size_t)0,
&calld->got_slice)) {
- memcpy(wrptr, GPR_SLICE_START_PTR(calld->incoming_slice),
- GPR_SLICE_LENGTH(calld->incoming_slice));
- wrptr += GPR_SLICE_LENGTH(calld->incoming_slice);
- gpr_slice_buffer_add(&calld->slices, calld->incoming_slice);
+ memcpy(wrptr, GRPC_SLICE_START_PTR(calld->incoming_slice),
+ GRPC_SLICE_LENGTH(calld->incoming_slice));
+ wrptr += GRPC_SLICE_LENGTH(calld->incoming_slice);
+ grpc_slice_buffer_add(&calld->slices, calld->incoming_slice);
if (calld->send_length == calld->slices.length) {
calld->send_message_blocked = false;
break;
@@ -191,7 +191,7 @@ static void got_slice(grpc_exec_ctx *exec_ctx, void *elemp, grpc_error *error) {
grpc_call_element *elem = elemp;
call_data *calld = elem->call_data;
calld->send_message_blocked = false;
- gpr_slice_buffer_add(&calld->slices, calld->incoming_slice);
+ grpc_slice_buffer_add(&calld->slices, calld->incoming_slice);
if (calld->send_length == calld->slices.length) {
/* Pass down the original send_message op that was blocked.*/
grpc_slice_buffer_stream_init(&calld->replacement_stream, &calld->slices,
@@ -311,7 +311,7 @@ static grpc_error *init_call_elem(grpc_exec_ctx *exec_ctx,
calld->on_done_recv = NULL;
calld->on_complete = NULL;
calld->payload_bytes = NULL;
- gpr_slice_buffer_init(&calld->slices);
+ grpc_slice_buffer_init(&calld->slices);
grpc_closure_init(&calld->hc_on_recv, hc_on_recv, elem);
grpc_closure_init(&calld->hc_on_complete, hc_on_complete, elem);
grpc_closure_init(&calld->got_slice, got_slice, elem);
@@ -324,7 +324,7 @@ static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
const grpc_call_final_info *final_info,
void *ignored) {
call_data *calld = elem->call_data;
- gpr_slice_buffer_destroy(&calld->slices);
+ grpc_slice_buffer_destroy(&calld->slices);
}
static grpc_mdelem *scheme_from_args(const grpc_channel_args *args) {
diff --git a/src/core/lib/channel/http_server_filter.c b/src/core/lib/channel/http_server_filter.c
index 04670ff233..6f1a9f6349 100644
--- a/src/core/lib/channel/http_server_filter.c
+++ b/src/core/lib/channel/http_server_filter.c
@@ -68,7 +68,7 @@ typedef struct call_data {
grpc_closure *recv_message_ready;
grpc_closure *on_complete;
grpc_byte_stream **pp_recv_message;
- gpr_slice_buffer read_slice_buffer;
+ grpc_slice_buffer read_slice_buffer;
grpc_slice_buffer_stream read_stream;
/** Receive closures are chained: we inject this closure as the on_done_recv
@@ -162,8 +162,8 @@ static grpc_mdelem *server_filter(void *user_data, grpc_mdelem *md) {
/* Retrieve the payload from the value of the 'grpc-internal-payload-bin'
header field */
calld->seen_payload_bin = 1;
- gpr_slice_buffer_add(&calld->read_slice_buffer,
- gpr_slice_ref(md->value->slice));
+ grpc_slice_buffer_add(&calld->read_slice_buffer,
+ grpc_slice_ref(md->value->slice));
grpc_slice_buffer_stream_init(&calld->read_stream,
&calld->read_slice_buffer, 0);
return NULL;
@@ -313,7 +313,7 @@ static grpc_error *init_call_elem(grpc_exec_ctx *exec_ctx,
grpc_closure_init(&calld->hs_on_recv, hs_on_recv, elem);
grpc_closure_init(&calld->hs_on_complete, hs_on_complete, elem);
grpc_closure_init(&calld->hs_recv_message_ready, hs_recv_message_ready, elem);
- gpr_slice_buffer_init(&calld->read_slice_buffer);
+ grpc_slice_buffer_init(&calld->read_slice_buffer);
return GRPC_ERROR_NONE;
}
@@ -322,7 +322,7 @@ static void destroy_call_elem(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
const grpc_call_final_info *final_info,
void *ignored) {
call_data *calld = elem->call_data;
- gpr_slice_buffer_destroy(&calld->read_slice_buffer);
+ grpc_slice_buffer_destroy(&calld->read_slice_buffer);
}
/* Constructor for channel_data */
diff --git a/src/core/lib/channel/message_size_filter.c b/src/core/lib/channel/message_size_filter.c
index 7dc5ae0df1..85c307702f 100644
--- a/src/core/lib/channel/message_size_filter.c
+++ b/src/core/lib/channel/message_size_filter.c
@@ -141,7 +141,7 @@ static void start_transport_stream_op(grpc_exec_ctx* exec_ctx,
char* message_string;
gpr_asprintf(&message_string, "Sent message larger than max (%u vs. %d)",
op->send_message->length, calld->max_send_size);
- gpr_slice message = gpr_slice_from_copied_string(message_string);
+ grpc_slice message = grpc_slice_from_copied_string(message_string);
gpr_free(message_string);
grpc_call_element_send_close_with_message(
exec_ctx, elem, GRPC_STATUS_INVALID_ARGUMENT, &message);
diff --git a/src/core/lib/compression/message_compress.c b/src/core/lib/compression/message_compress.c
index cbe0b5a285..6c245acf61 100644
--- a/src/core/lib/compression/message_compress.c
+++ b/src/core/lib/compression/message_compress.c
@@ -42,31 +42,31 @@
#define OUTPUT_BLOCK_SIZE 1024
-static int zlib_body(z_stream* zs, gpr_slice_buffer* input,
- gpr_slice_buffer* output,
+static int zlib_body(z_stream* zs, grpc_slice_buffer* input,
+ grpc_slice_buffer* output,
int (*flate)(z_stream* zs, int flush)) {
int r;
int flush;
size_t i;
- gpr_slice outbuf = gpr_slice_malloc(OUTPUT_BLOCK_SIZE);
+ grpc_slice outbuf = grpc_slice_malloc(OUTPUT_BLOCK_SIZE);
const uInt uint_max = ~(uInt)0;
- GPR_ASSERT(GPR_SLICE_LENGTH(outbuf) <= uint_max);
- zs->avail_out = (uInt)GPR_SLICE_LENGTH(outbuf);
- zs->next_out = GPR_SLICE_START_PTR(outbuf);
+ GPR_ASSERT(GRPC_SLICE_LENGTH(outbuf) <= uint_max);
+ zs->avail_out = (uInt)GRPC_SLICE_LENGTH(outbuf);
+ zs->next_out = GRPC_SLICE_START_PTR(outbuf);
flush = Z_NO_FLUSH;
for (i = 0; i < input->count; i++) {
if (i == input->count - 1) flush = Z_FINISH;
- GPR_ASSERT(GPR_SLICE_LENGTH(input->slices[i]) <= uint_max);
- zs->avail_in = (uInt)GPR_SLICE_LENGTH(input->slices[i]);
- zs->next_in = GPR_SLICE_START_PTR(input->slices[i]);
+ GPR_ASSERT(GRPC_SLICE_LENGTH(input->slices[i]) <= uint_max);
+ zs->avail_in = (uInt)GRPC_SLICE_LENGTH(input->slices[i]);
+ zs->next_in = GRPC_SLICE_START_PTR(input->slices[i]);
do {
if (zs->avail_out == 0) {
- gpr_slice_buffer_add_indexed(output, outbuf);
- outbuf = gpr_slice_malloc(OUTPUT_BLOCK_SIZE);
- GPR_ASSERT(GPR_SLICE_LENGTH(outbuf) <= uint_max);
- zs->avail_out = (uInt)GPR_SLICE_LENGTH(outbuf);
- zs->next_out = GPR_SLICE_START_PTR(outbuf);
+ grpc_slice_buffer_add_indexed(output, outbuf);
+ outbuf = grpc_slice_malloc(OUTPUT_BLOCK_SIZE);
+ GPR_ASSERT(GRPC_SLICE_LENGTH(outbuf) <= uint_max);
+ zs->avail_out = (uInt)GRPC_SLICE_LENGTH(outbuf);
+ zs->next_out = GRPC_SLICE_START_PTR(outbuf);
}
r = flate(zs, flush);
if (r < 0 && r != Z_BUF_ERROR /* not fatal */) {
@@ -82,12 +82,12 @@ static int zlib_body(z_stream* zs, gpr_slice_buffer* input,
GPR_ASSERT(outbuf.refcount);
outbuf.data.refcounted.length -= zs->avail_out;
- gpr_slice_buffer_add_indexed(output, outbuf);
+ grpc_slice_buffer_add_indexed(output, outbuf);
return 1;
error:
- gpr_slice_unref(outbuf);
+ grpc_slice_unref(outbuf);
return 0;
}
@@ -97,7 +97,7 @@ static void* zalloc_gpr(void* opaque, unsigned int items, unsigned int size) {
static void zfree_gpr(void* opaque, void* address) { gpr_free(address); }
-static int zlib_compress(gpr_slice_buffer* input, gpr_slice_buffer* output,
+static int zlib_compress(grpc_slice_buffer* input, grpc_slice_buffer* output,
int gzip) {
z_stream zs;
int r;
@@ -113,7 +113,7 @@ static int zlib_compress(gpr_slice_buffer* input, gpr_slice_buffer* output,
r = zlib_body(&zs, input, output, deflate) && output->length < input->length;
if (!r) {
for (i = count_before; i < output->count; i++) {
- gpr_slice_unref(output->slices[i]);
+ grpc_slice_unref(output->slices[i]);
}
output->count = count_before;
output->length = length_before;
@@ -122,7 +122,7 @@ static int zlib_compress(gpr_slice_buffer* input, gpr_slice_buffer* output,
return r;
}
-static int zlib_decompress(gpr_slice_buffer* input, gpr_slice_buffer* output,
+static int zlib_decompress(grpc_slice_buffer* input, grpc_slice_buffer* output,
int gzip) {
z_stream zs;
int r;
@@ -137,7 +137,7 @@ static int zlib_decompress(gpr_slice_buffer* input, gpr_slice_buffer* output,
r = zlib_body(&zs, input, output, inflate);
if (!r) {
for (i = count_before; i < output->count; i++) {
- gpr_slice_unref(output->slices[i]);
+ grpc_slice_unref(output->slices[i]);
}
output->count = count_before;
output->length = length_before;
@@ -146,16 +146,16 @@ static int zlib_decompress(gpr_slice_buffer* input, gpr_slice_buffer* output,
return r;
}
-static int copy(gpr_slice_buffer* input, gpr_slice_buffer* output) {
+static int copy(grpc_slice_buffer* input, grpc_slice_buffer* output) {
size_t i;
for (i = 0; i < input->count; i++) {
- gpr_slice_buffer_add(output, gpr_slice_ref(input->slices[i]));
+ grpc_slice_buffer_add(output, grpc_slice_ref(input->slices[i]));
}
return 1;
}
static int compress_inner(grpc_compression_algorithm algorithm,
- gpr_slice_buffer* input, gpr_slice_buffer* output) {
+ grpc_slice_buffer* input, grpc_slice_buffer* output) {
switch (algorithm) {
case GRPC_COMPRESS_NONE:
/* the fallback path always needs to be send uncompressed: we simply
@@ -173,7 +173,7 @@ static int compress_inner(grpc_compression_algorithm algorithm,
}
int grpc_msg_compress(grpc_compression_algorithm algorithm,
- gpr_slice_buffer* input, gpr_slice_buffer* output) {
+ grpc_slice_buffer* input, grpc_slice_buffer* output) {
if (!compress_inner(algorithm, input, output)) {
copy(input, output);
return 0;
@@ -182,7 +182,7 @@ int grpc_msg_compress(grpc_compression_algorithm algorithm,
}
int grpc_msg_decompress(grpc_compression_algorithm algorithm,
- gpr_slice_buffer* input, gpr_slice_buffer* output) {
+ grpc_slice_buffer* input, grpc_slice_buffer* output) {
switch (algorithm) {
case GRPC_COMPRESS_NONE:
return copy(input, output);
diff --git a/src/core/lib/compression/message_compress.h b/src/core/lib/compression/message_compress.h
index c69eaaf006..448d36a863 100644
--- a/src/core/lib/compression/message_compress.h
+++ b/src/core/lib/compression/message_compress.h
@@ -35,18 +35,18 @@
#define GRPC_CORE_LIB_COMPRESSION_MESSAGE_COMPRESS_H
#include <grpc/compression.h>
-#include <grpc/support/slice_buffer.h>
+#include <grpc/slice_buffer.h>
/* compress 'input' to 'output' using 'algorithm'.
On success, appends compressed slices to output and returns 1.
On failure, appends uncompressed slices to output and returns 0. */
int grpc_msg_compress(grpc_compression_algorithm algorithm,
- gpr_slice_buffer* input, gpr_slice_buffer* output);
+ grpc_slice_buffer* input, grpc_slice_buffer* output);
/* decompress 'input' to 'output' using 'algorithm'.
On success, appends slices to output and returns 1.
On failure, output is unchanged, and returns 0. */
int grpc_msg_decompress(grpc_compression_algorithm algorithm,
- gpr_slice_buffer* input, gpr_slice_buffer* output);
+ grpc_slice_buffer* input, grpc_slice_buffer* output);
#endif /* GRPC_CORE_LIB_COMPRESSION_MESSAGE_COMPRESS_H */
diff --git a/src/core/lib/http/format_request.c b/src/core/lib/http/format_request.c
index e818b70113..024664b6ee 100644
--- a/src/core/lib/http/format_request.c
+++ b/src/core/lib/http/format_request.c
@@ -37,8 +37,8 @@
#include <stdio.h>
#include <string.h>
+#include <grpc/slice.h>
#include <grpc/support/alloc.h>
-#include <grpc/support/slice.h>
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
#include "src/core/lib/support/string.h"
@@ -65,7 +65,8 @@ static void fill_common_header(const grpc_httpcli_request *request,
}
}
-gpr_slice grpc_httpcli_format_get_request(const grpc_httpcli_request *request) {
+grpc_slice grpc_httpcli_format_get_request(
+ const grpc_httpcli_request *request) {
gpr_strvec out;
char *flat;
size_t flat_len;
@@ -78,12 +79,12 @@ gpr_slice grpc_httpcli_format_get_request(const grpc_httpcli_request *request) {
flat = gpr_strvec_flatten(&out, &flat_len);
gpr_strvec_destroy(&out);
- return gpr_slice_new(flat, flat_len, gpr_free);
+ return grpc_slice_new(flat, flat_len, gpr_free);
}
-gpr_slice grpc_httpcli_format_post_request(const grpc_httpcli_request *request,
- const char *body_bytes,
- size_t body_size) {
+grpc_slice grpc_httpcli_format_post_request(const grpc_httpcli_request *request,
+ const char *body_bytes,
+ size_t body_size) {
gpr_strvec out;
char *tmp;
size_t out_len;
@@ -117,10 +118,10 @@ gpr_slice grpc_httpcli_format_post_request(const grpc_httpcli_request *request,
out_len += body_size;
}
- return gpr_slice_new(tmp, out_len, gpr_free);
+ return grpc_slice_new(tmp, out_len, gpr_free);
}
-gpr_slice grpc_httpcli_format_connect_request(
+grpc_slice grpc_httpcli_format_connect_request(
const grpc_httpcli_request *request) {
gpr_strvec out;
gpr_strvec_init(&out);
@@ -130,5 +131,5 @@ gpr_slice grpc_httpcli_format_connect_request(
size_t flat_len;
char *flat = gpr_strvec_flatten(&out, &flat_len);
gpr_strvec_destroy(&out);
- return gpr_slice_new(flat, flat_len, gpr_free);
+ return grpc_slice_new(flat, flat_len, gpr_free);
}
diff --git a/src/core/lib/http/format_request.h b/src/core/lib/http/format_request.h
index 7abd55f2f7..1c8e3f68c5 100644
--- a/src/core/lib/http/format_request.h
+++ b/src/core/lib/http/format_request.h
@@ -34,14 +34,14 @@
#ifndef GRPC_CORE_LIB_HTTP_FORMAT_REQUEST_H
#define GRPC_CORE_LIB_HTTP_FORMAT_REQUEST_H
-#include <grpc/support/slice.h>
+#include <grpc/slice.h>
#include "src/core/lib/http/httpcli.h"
-gpr_slice grpc_httpcli_format_get_request(const grpc_httpcli_request *request);
-gpr_slice grpc_httpcli_format_post_request(const grpc_httpcli_request *request,
- const char *body_bytes,
- size_t body_size);
-gpr_slice grpc_httpcli_format_connect_request(
+grpc_slice grpc_httpcli_format_get_request(const grpc_httpcli_request *request);
+grpc_slice grpc_httpcli_format_post_request(const grpc_httpcli_request *request,
+ const char *body_bytes,
+ size_t body_size);
+grpc_slice grpc_httpcli_format_connect_request(
const grpc_httpcli_request *request);
#endif /* GRPC_CORE_LIB_HTTP_FORMAT_REQUEST_H */
diff --git a/src/core/lib/http/httpcli.c b/src/core/lib/http/httpcli.c
index 411e669b53..fdb8abaa2d 100644
--- a/src/core/lib/http/httpcli.c
+++ b/src/core/lib/http/httpcli.c
@@ -50,7 +50,7 @@
#include "src/core/lib/support/string.h"
typedef struct {
- gpr_slice request_text;
+ grpc_slice request_text;
grpc_http_parser parser;
grpc_resolved_addresses *addresses;
size_t next_address;
@@ -64,8 +64,8 @@ typedef struct {
grpc_httpcli_context *context;
grpc_polling_entity *pollent;
grpc_iomgr_object iomgr_obj;
- gpr_slice_buffer incoming;
- gpr_slice_buffer outgoing;
+ grpc_slice_buffer incoming;
+ grpc_slice_buffer outgoing;
grpc_closure on_read;
grpc_closure done_write;
grpc_closure connected;
@@ -111,12 +111,12 @@ static void finish(grpc_exec_ctx *exec_ctx, internal_request *req,
if (req->ep != NULL) {
grpc_endpoint_destroy(exec_ctx, req->ep);
}
- gpr_slice_unref(req->request_text);
+ grpc_slice_unref(req->request_text);
gpr_free(req->host);
gpr_free(req->ssl_host_override);
grpc_iomgr_unregister_object(&req->iomgr_obj);
- gpr_slice_buffer_destroy(&req->incoming);
- gpr_slice_buffer_destroy(&req->outgoing);
+ grpc_slice_buffer_destroy(&req->incoming);
+ grpc_slice_buffer_destroy(&req->outgoing);
GRPC_ERROR_UNREF(req->overall_error);
grpc_resource_quota_internal_unref(exec_ctx, req->resource_quota);
gpr_free(req);
@@ -144,7 +144,7 @@ static void on_read(grpc_exec_ctx *exec_ctx, void *user_data,
size_t i;
for (i = 0; i < req->incoming.count; i++) {
- if (GPR_SLICE_LENGTH(req->incoming.slices[i])) {
+ if (GRPC_SLICE_LENGTH(req->incoming.slices[i])) {
req->have_read_byte = 1;
grpc_error *err =
grpc_http_parser_parse(&req->parser, req->incoming.slices[i], NULL);
@@ -178,8 +178,8 @@ static void done_write(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
}
static void start_write(grpc_exec_ctx *exec_ctx, internal_request *req) {
- gpr_slice_ref(req->request_text);
- gpr_slice_buffer_add(&req->outgoing, req->request_text);
+ grpc_slice_ref(req->request_text);
+ grpc_slice_buffer_add(&req->outgoing, req->request_text);
grpc_endpoint_write(exec_ctx, req->ep, &req->outgoing, &req->done_write);
}
@@ -253,7 +253,7 @@ static void internal_request_begin(grpc_exec_ctx *exec_ctx,
const grpc_httpcli_request *request,
gpr_timespec deadline, grpc_closure *on_done,
grpc_httpcli_response *response,
- const char *name, gpr_slice request_text) {
+ const char *name, grpc_slice request_text) {
internal_request *req = gpr_malloc(sizeof(internal_request));
memset(req, 0, sizeof(*req));
req->request_text = request_text;
@@ -268,8 +268,8 @@ static void internal_request_begin(grpc_exec_ctx *exec_ctx,
req->resource_quota = grpc_resource_quota_internal_ref(resource_quota);
grpc_closure_init(&req->on_read, on_read, req);
grpc_closure_init(&req->done_write, done_write, req);
- gpr_slice_buffer_init(&req->incoming);
- gpr_slice_buffer_init(&req->outgoing);
+ grpc_slice_buffer_init(&req->incoming);
+ grpc_slice_buffer_init(&req->outgoing);
grpc_iomgr_register_object(&req->iomgr_obj, name);
req->host = gpr_strdup(request->host);
req->ssl_host_override = gpr_strdup(request->ssl_host_override);
diff --git a/src/core/lib/http/httpcli_security_connector.c b/src/core/lib/http/httpcli_security_connector.c
index 0006e809a6..24d264c32a 100644
--- a/src/core/lib/http/httpcli_security_connector.c
+++ b/src/core/lib/http/httpcli_security_connector.c
@@ -61,7 +61,7 @@ static void httpcli_ssl_destroy(grpc_security_connector *sc) {
static void httpcli_ssl_do_handshake(grpc_exec_ctx *exec_ctx,
grpc_channel_security_connector *sc,
grpc_endpoint *nonsecure_endpoint,
- gpr_slice_buffer *read_buffer,
+ grpc_slice_buffer *read_buffer,
gpr_timespec deadline,
grpc_security_handshake_done_cb cb,
void *user_data) {
diff --git a/src/core/lib/http/parser.c b/src/core/lib/http/parser.c
index be9e9b6b63..2f84adc187 100644
--- a/src/core/lib/http/parser.c
+++ b/src/core/lib/http/parser.c
@@ -333,12 +333,12 @@ void grpc_http_response_destroy(grpc_http_response *response) {
gpr_free(response->hdrs);
}
-grpc_error *grpc_http_parser_parse(grpc_http_parser *parser, gpr_slice slice,
+grpc_error *grpc_http_parser_parse(grpc_http_parser *parser, grpc_slice slice,
size_t *start_of_body) {
- for (size_t i = 0; i < GPR_SLICE_LENGTH(slice); i++) {
+ for (size_t i = 0; i < GRPC_SLICE_LENGTH(slice); i++) {
bool found_body_start = false;
grpc_error *err =
- addbyte(parser, GPR_SLICE_START_PTR(slice)[i], &found_body_start);
+ addbyte(parser, GRPC_SLICE_START_PTR(slice)[i], &found_body_start);
if (err != GRPC_ERROR_NONE) return err;
if (found_body_start && start_of_body != NULL) *start_of_body = i + 1;
}
diff --git a/src/core/lib/http/parser.h b/src/core/lib/http/parser.h
index fab42979cd..a68011dd43 100644
--- a/src/core/lib/http/parser.h
+++ b/src/core/lib/http/parser.h
@@ -34,8 +34,8 @@
#ifndef GRPC_CORE_LIB_HTTP_PARSER_H
#define GRPC_CORE_LIB_HTTP_PARSER_H
+#include <grpc/slice.h>
#include <grpc/support/port_platform.h>
-#include <grpc/support/slice.h>
#include "src/core/lib/iomgr/error.h"
/* Maximum length of a header string of the form 'Key: Value\r\n' */
@@ -114,7 +114,7 @@ void grpc_http_parser_init(grpc_http_parser *parser, grpc_http_type type,
void grpc_http_parser_destroy(grpc_http_parser *parser);
/* Sets \a start_of_body to the offset in \a slice of the start of the body. */
-grpc_error *grpc_http_parser_parse(grpc_http_parser *parser, gpr_slice slice,
+grpc_error *grpc_http_parser_parse(grpc_http_parser *parser, grpc_slice slice,
size_t *start_of_body);
grpc_error *grpc_http_parser_eof(grpc_http_parser *parser);
diff --git a/src/core/lib/iomgr/endpoint.c b/src/core/lib/iomgr/endpoint.c
index 74fa9c45df..a4b6668276 100644
--- a/src/core/lib/iomgr/endpoint.c
+++ b/src/core/lib/iomgr/endpoint.c
@@ -34,12 +34,12 @@
#include "src/core/lib/iomgr/endpoint.h"
void grpc_endpoint_read(grpc_exec_ctx* exec_ctx, grpc_endpoint* ep,
- gpr_slice_buffer* slices, grpc_closure* cb) {
+ grpc_slice_buffer* slices, grpc_closure* cb) {
ep->vtable->read(exec_ctx, ep, slices, cb);
}
void grpc_endpoint_write(grpc_exec_ctx* exec_ctx, grpc_endpoint* ep,
- gpr_slice_buffer* slices, grpc_closure* cb) {
+ grpc_slice_buffer* slices, grpc_closure* cb) {
ep->vtable->write(exec_ctx, ep, slices, cb);
}
diff --git a/src/core/lib/iomgr/endpoint.h b/src/core/lib/iomgr/endpoint.h
index 0ac5486ff5..bf211ca16a 100644
--- a/src/core/lib/iomgr/endpoint.h
+++ b/src/core/lib/iomgr/endpoint.h
@@ -34,8 +34,8 @@
#ifndef GRPC_CORE_LIB_IOMGR_ENDPOINT_H
#define GRPC_CORE_LIB_IOMGR_ENDPOINT_H
-#include <grpc/support/slice.h>
-#include <grpc/support/slice_buffer.h>
+#include <grpc/slice.h>
+#include <grpc/slice_buffer.h>
#include <grpc/support/time.h>
#include "src/core/lib/iomgr/pollset.h"
#include "src/core/lib/iomgr/pollset_set.h"
@@ -49,9 +49,9 @@ typedef struct grpc_endpoint_vtable grpc_endpoint_vtable;
struct grpc_endpoint_vtable {
void (*read)(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
- gpr_slice_buffer *slices, grpc_closure *cb);
+ grpc_slice_buffer *slices, grpc_closure *cb);
void (*write)(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
- gpr_slice_buffer *slices, grpc_closure *cb);
+ grpc_slice_buffer *slices, grpc_closure *cb);
grpc_workqueue *(*get_workqueue)(grpc_endpoint *ep);
void (*add_to_pollset)(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
grpc_pollset *pollset);
@@ -69,7 +69,7 @@ struct grpc_endpoint_vtable {
Valid slices may be placed into \a slices even when the callback is
invoked with error != GRPC_ERROR_NONE. */
void grpc_endpoint_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
- gpr_slice_buffer *slices, grpc_closure *cb);
+ grpc_slice_buffer *slices, grpc_closure *cb);
char *grpc_endpoint_get_peer(grpc_endpoint *ep);
@@ -87,7 +87,7 @@ grpc_workqueue *grpc_endpoint_get_workqueue(grpc_endpoint *ep);
it is a valid slice buffer.
*/
void grpc_endpoint_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
- gpr_slice_buffer *slices, grpc_closure *cb);
+ grpc_slice_buffer *slices, grpc_closure *cb);
/* Causes any pending and future read/write callbacks to run immediately with
success==0 */
diff --git a/src/core/lib/iomgr/load_file.c b/src/core/lib/iomgr/load_file.c
index b62ecbc534..217bc5da59 100644
--- a/src/core/lib/iomgr/load_file.c
+++ b/src/core/lib/iomgr/load_file.c
@@ -44,10 +44,10 @@
#include "src/core/lib/support/string.h"
grpc_error *grpc_load_file(const char *filename, int add_null_terminator,
- gpr_slice *output) {
+ grpc_slice *output) {
unsigned char *contents = NULL;
size_t contents_size = 0;
- gpr_slice result = gpr_empty_slice();
+ grpc_slice result = gpr_empty_slice();
FILE *file;
size_t bytes_read = 0;
grpc_error *error = GRPC_ERROR_NONE;
@@ -72,7 +72,7 @@ grpc_error *grpc_load_file(const char *filename, int add_null_terminator,
if (add_null_terminator) {
contents[contents_size++] = 0;
}
- result = gpr_slice_new(contents, contents_size, gpr_free);
+ result = grpc_slice_new(contents, contents_size, gpr_free);
end:
*output = result;
diff --git a/src/core/lib/iomgr/load_file.h b/src/core/lib/iomgr/load_file.h
index 9aac2225d1..73ee8c3abf 100644
--- a/src/core/lib/iomgr/load_file.h
+++ b/src/core/lib/iomgr/load_file.h
@@ -36,7 +36,7 @@
#include <stdio.h>
-#include <grpc/support/slice.h>
+#include <grpc/slice.h>
#include "src/core/lib/iomgr/error.h"
@@ -47,7 +47,7 @@ extern "C" {
/* Loads the content of a file into a slice. add_null_terminator will add
a NULL terminator if non-zero. */
grpc_error *grpc_load_file(const char *filename, int add_null_terminator,
- gpr_slice *slice);
+ grpc_slice *slice);
#ifdef __cplusplus
}
diff --git a/src/core/lib/iomgr/resource_quota.c b/src/core/lib/iomgr/resource_quota.c
index 1770d72268..051a30baa3 100644
--- a/src/core/lib/iomgr/resource_quota.c
+++ b/src/core/lib/iomgr/resource_quota.c
@@ -347,7 +347,7 @@ static bool rq_reclaim(grpc_exec_ctx *exec_ctx,
*/
typedef struct {
- gpr_slice_refcount base;
+ grpc_slice_refcount base;
gpr_refcount refs;
grpc_resource_user *resource_user;
size_t size;
@@ -364,7 +364,7 @@ static void ru_slice_unref(void *p) {
/* TODO(ctiller): this is dangerous, but I think safe for now:
we have no guarantee here that we're at a safe point for creating an
execution context, but we have no way of writing this code otherwise.
- In the future: consider lifting gpr_slice to grpc, and offering an
+ In the future: consider lifting grpc_slice to grpc, and offering an
internal_{ref,unref} pair that is execution context aware.
Alternatively,
make exec_ctx be thread local and 'do the right thing' (whatever that
@@ -377,15 +377,15 @@ static void ru_slice_unref(void *p) {
}
}
-static gpr_slice ru_slice_create(grpc_resource_user *resource_user,
- size_t size) {
+static grpc_slice ru_slice_create(grpc_resource_user *resource_user,
+ size_t size) {
ru_slice_refcount *rc = gpr_malloc(sizeof(ru_slice_refcount) + size);
rc->base.ref = ru_slice_ref;
rc->base.unref = ru_slice_unref;
gpr_ref_init(&rc->refs, 1);
rc->resource_user = resource_user;
rc->size = size;
- gpr_slice slice;
+ grpc_slice slice;
slice.refcount = &rc->base;
slice.data.refcounted.bytes = (uint8_t *)(rc + 1);
slice.data.refcounted.length = size;
@@ -483,7 +483,7 @@ static void ru_allocated_slices(grpc_exec_ctx *exec_ctx, void *arg,
grpc_resource_user_slice_allocator *slice_allocator = arg;
if (error == GRPC_ERROR_NONE) {
for (size_t i = 0; i < slice_allocator->count; i++) {
- gpr_slice_buffer_add_indexed(
+ grpc_slice_buffer_add_indexed(
slice_allocator->dest, ru_slice_create(slice_allocator->resource_user,
slice_allocator->length));
}
@@ -783,7 +783,7 @@ void grpc_resource_user_slice_allocator_init(
void grpc_resource_user_alloc_slices(
grpc_exec_ctx *exec_ctx,
grpc_resource_user_slice_allocator *slice_allocator, size_t length,
- size_t count, gpr_slice_buffer *dest) {
+ size_t count, grpc_slice_buffer *dest) {
slice_allocator->length = length;
slice_allocator->count = count;
slice_allocator->dest = dest;
@@ -791,9 +791,9 @@ void grpc_resource_user_alloc_slices(
count * length, &slice_allocator->on_allocated);
}
-gpr_slice grpc_resource_user_slice_malloc(grpc_exec_ctx *exec_ctx,
- grpc_resource_user *resource_user,
- size_t size) {
+grpc_slice grpc_resource_user_slice_malloc(grpc_exec_ctx *exec_ctx,
+ grpc_resource_user *resource_user,
+ size_t size) {
grpc_resource_user_alloc(exec_ctx, resource_user, size, NULL);
return ru_slice_create(resource_user, size);
}
diff --git a/src/core/lib/iomgr/resource_quota.h b/src/core/lib/iomgr/resource_quota.h
index bbe0af1a14..0181fd978b 100644
--- a/src/core/lib/iomgr/resource_quota.h
+++ b/src/core/lib/iomgr/resource_quota.h
@@ -127,7 +127,7 @@ typedef struct grpc_resource_user_slice_allocator {
/* Number of slices to allocate on the current request */
size_t count;
/* Destination for slices to allocate on the current request */
- gpr_slice_buffer *dest;
+ grpc_slice_buffer *dest;
/* Parent resource user */
grpc_resource_user *resource_user;
} grpc_resource_user_slice_allocator;
@@ -143,11 +143,11 @@ void grpc_resource_user_slice_allocator_init(
void grpc_resource_user_alloc_slices(
grpc_exec_ctx *exec_ctx,
grpc_resource_user_slice_allocator *slice_allocator, size_t length,
- size_t count, gpr_slice_buffer *dest);
+ size_t count, grpc_slice_buffer *dest);
/* Allocate one slice of length \a size synchronously. */
-gpr_slice grpc_resource_user_slice_malloc(grpc_exec_ctx *exec_ctx,
- grpc_resource_user *resource_user,
- size_t size);
+grpc_slice grpc_resource_user_slice_malloc(grpc_exec_ctx *exec_ctx,
+ grpc_resource_user *resource_user,
+ size_t size);
#endif /* GRPC_CORE_LIB_IOMGR_RESOURCE_QUOTA_H */
diff --git a/src/core/lib/iomgr/tcp_client_windows.c b/src/core/lib/iomgr/tcp_client_windows.c
index 30f7c66f15..4d1e809872 100644
--- a/src/core/lib/iomgr/tcp_client_windows.c
+++ b/src/core/lib/iomgr/tcp_client_windows.c
@@ -37,10 +37,10 @@
#include "src/core/lib/iomgr/sockaddr_windows.h"
+#include <grpc/slice_buffer.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/log_windows.h>
-#include <grpc/support/slice_buffer.h>
#include <grpc/support/useful.h>
#include "src/core/lib/channel/channel_args.h"
diff --git a/src/core/lib/iomgr/tcp_posix.c b/src/core/lib/iomgr/tcp_posix.c
index 70416c6eef..c48f4e83cf 100644
--- a/src/core/lib/iomgr/tcp_posix.c
+++ b/src/core/lib/iomgr/tcp_posix.c
@@ -46,9 +46,9 @@
#include <sys/types.h>
#include <unistd.h>
+#include <grpc/slice.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/slice.h>
#include <grpc/support/string_util.h>
#include <grpc/support/sync.h>
#include <grpc/support/time.h>
@@ -56,6 +56,7 @@
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/iomgr/ev_posix.h"
#include "src/core/lib/profiling/timers.h"
+#include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/lib/support/string.h"
#ifdef GRPC_HAVE_MSG_NOSIGNAL
@@ -83,10 +84,10 @@ typedef struct {
gpr_atm shutdown_count;
/* garbage after the last read */
- gpr_slice_buffer last_read_buffer;
+ grpc_slice_buffer last_read_buffer;
- gpr_slice_buffer *incoming_buffer;
- gpr_slice_buffer *outgoing_buffer;
+ grpc_slice_buffer *incoming_buffer;
+ grpc_slice_buffer *outgoing_buffer;
/** slice within outgoing_buffer to write next */
size_t outgoing_slice_idx;
/** byte within outgoing_buffer->slices[outgoing_slice_idx] to write next */
@@ -120,7 +121,7 @@ static void tcp_shutdown(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep) {
static void tcp_free(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp) {
grpc_fd_orphan(exec_ctx, tcp->em_fd, tcp->release_fd_cb, tcp->release_fd,
"tcp_unref_orphan");
- gpr_slice_buffer_destroy(&tcp->last_read_buffer);
+ grpc_slice_buffer_destroy(&tcp->last_read_buffer);
grpc_resource_user_unref(exec_ctx, tcp->resource_user);
gpr_free(tcp->peer_string);
gpr_free(tcp);
@@ -161,7 +162,7 @@ static void tcp_ref(grpc_tcp *tcp) { gpr_ref(&tcp->refcount); }
static void tcp_destroy(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep) {
grpc_network_status_unregister_endpoint(ep);
grpc_tcp *tcp = (grpc_tcp *)ep;
- gpr_slice_buffer_reset_and_unref(&tcp->last_read_buffer);
+ grpc_slice_buffer_reset_and_unref(&tcp->last_read_buffer);
TCP_UNREF(exec_ctx, tcp, "destroy");
}
@@ -175,8 +176,8 @@ static void call_read_cb(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp,
gpr_log(GPR_DEBUG, "read: error=%s", str);
grpc_error_free_string(str);
for (i = 0; i < tcp->incoming_buffer->count; i++) {
- char *dump = gpr_dump_slice(tcp->incoming_buffer->slices[i],
- GPR_DUMP_HEX | GPR_DUMP_ASCII);
+ char *dump = grpc_dump_slice(tcp->incoming_buffer->slices[i],
+ GPR_DUMP_HEX | GPR_DUMP_ASCII);
gpr_log(GPR_DEBUG, "READ %p (peer=%s): %s", tcp, tcp->peer_string, dump);
gpr_free(dump);
}
@@ -200,8 +201,8 @@ static void tcp_do_read(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp) {
GPR_TIMER_BEGIN("tcp_continue_read", 0);
for (i = 0; i < tcp->incoming_buffer->count; i++) {
- iov[i].iov_base = GPR_SLICE_START_PTR(tcp->incoming_buffer->slices[i]);
- iov[i].iov_len = GPR_SLICE_LENGTH(tcp->incoming_buffer->slices[i]);
+ iov[i].iov_base = GRPC_SLICE_START_PTR(tcp->incoming_buffer->slices[i]);
+ iov[i].iov_len = GRPC_SLICE_LENGTH(tcp->incoming_buffer->slices[i]);
}
msg.msg_name = NULL;
@@ -228,19 +229,19 @@ static void tcp_do_read(grpc_exec_ctx *exec_ctx, grpc_tcp *tcp) {
/* We've consumed the edge, request a new one */
grpc_fd_notify_on_read(exec_ctx, tcp->em_fd, &tcp->read_closure);
} else {
- gpr_slice_buffer_reset_and_unref(tcp->incoming_buffer);
+ grpc_slice_buffer_reset_and_unref(tcp->incoming_buffer);
call_read_cb(exec_ctx, tcp, GRPC_OS_ERROR(errno, "recvmsg"));
TCP_UNREF(exec_ctx, tcp, "read");
}
} else if (read_bytes == 0) {
/* 0 read size ==> end of stream */
- gpr_slice_buffer_reset_and_unref(tcp->incoming_buffer);
+ grpc_slice_buffer_reset_and_unref(tcp->incoming_buffer);
call_read_cb(exec_ctx, tcp, GRPC_ERROR_CREATE("Socket closed"));
TCP_UNREF(exec_ctx, tcp, "read");
} else {
GPR_ASSERT((size_t)read_bytes <= tcp->incoming_buffer->length);
if ((size_t)read_bytes < tcp->incoming_buffer->length) {
- gpr_slice_buffer_trim_end(
+ grpc_slice_buffer_trim_end(
tcp->incoming_buffer,
tcp->incoming_buffer->length - (size_t)read_bytes,
&tcp->last_read_buffer);
@@ -259,8 +260,8 @@ static void tcp_read_allocation_done(grpc_exec_ctx *exec_ctx, void *tcpp,
grpc_error *error) {
grpc_tcp *tcp = tcpp;
if (error != GRPC_ERROR_NONE) {
- gpr_slice_buffer_reset_and_unref(tcp->incoming_buffer);
- gpr_slice_buffer_reset_and_unref(&tcp->last_read_buffer);
+ grpc_slice_buffer_reset_and_unref(tcp->incoming_buffer);
+ grpc_slice_buffer_reset_and_unref(&tcp->last_read_buffer);
call_read_cb(exec_ctx, tcp, GRPC_ERROR_REF(error));
TCP_UNREF(exec_ctx, tcp, "read");
} else {
@@ -285,8 +286,8 @@ static void tcp_handle_read(grpc_exec_ctx *exec_ctx, void *arg /* grpc_tcp */,
GPR_ASSERT(!tcp->finished_edge);
if (error != GRPC_ERROR_NONE) {
- gpr_slice_buffer_reset_and_unref(tcp->incoming_buffer);
- gpr_slice_buffer_reset_and_unref(&tcp->last_read_buffer);
+ grpc_slice_buffer_reset_and_unref(tcp->incoming_buffer);
+ grpc_slice_buffer_reset_and_unref(&tcp->last_read_buffer);
call_read_cb(exec_ctx, tcp, GRPC_ERROR_REF(error));
TCP_UNREF(exec_ctx, tcp, "read");
} else {
@@ -295,13 +296,13 @@ static void tcp_handle_read(grpc_exec_ctx *exec_ctx, void *arg /* grpc_tcp */,
}
static void tcp_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
- gpr_slice_buffer *incoming_buffer, grpc_closure *cb) {
+ grpc_slice_buffer *incoming_buffer, grpc_closure *cb) {
grpc_tcp *tcp = (grpc_tcp *)ep;
GPR_ASSERT(tcp->read_cb == NULL);
tcp->read_cb = cb;
tcp->incoming_buffer = incoming_buffer;
- gpr_slice_buffer_reset_and_unref(incoming_buffer);
- gpr_slice_buffer_swap(incoming_buffer, &tcp->last_read_buffer);
+ grpc_slice_buffer_reset_and_unref(incoming_buffer);
+ grpc_slice_buffer_swap(incoming_buffer, &tcp->last_read_buffer);
TCP_REF(tcp, "read");
if (tcp->finished_edge) {
tcp->finished_edge = false;
@@ -331,11 +332,11 @@ static bool tcp_flush(grpc_tcp *tcp, grpc_error **error) {
iov_size != MAX_WRITE_IOVEC;
iov_size++) {
iov[iov_size].iov_base =
- GPR_SLICE_START_PTR(
+ GRPC_SLICE_START_PTR(
tcp->outgoing_buffer->slices[tcp->outgoing_slice_idx]) +
tcp->outgoing_byte_idx;
iov[iov_size].iov_len =
- GPR_SLICE_LENGTH(
+ GRPC_SLICE_LENGTH(
tcp->outgoing_buffer->slices[tcp->outgoing_slice_idx]) -
tcp->outgoing_byte_idx;
sending_length += iov[iov_size].iov_len;
@@ -376,7 +377,7 @@ static bool tcp_flush(grpc_tcp *tcp, grpc_error **error) {
size_t slice_length;
tcp->outgoing_slice_idx--;
- slice_length = GPR_SLICE_LENGTH(
+ slice_length = GRPC_SLICE_LENGTH(
tcp->outgoing_buffer->slices[tcp->outgoing_slice_idx]);
if (slice_length > trailing) {
tcp->outgoing_byte_idx = slice_length - trailing;
@@ -426,7 +427,7 @@ static void tcp_handle_write(grpc_exec_ctx *exec_ctx, void *arg /* grpc_tcp */,
}
static void tcp_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
- gpr_slice_buffer *buf, grpc_closure *cb) {
+ grpc_slice_buffer *buf, grpc_closure *cb) {
grpc_tcp *tcp = (grpc_tcp *)ep;
grpc_error *error = GRPC_ERROR_NONE;
@@ -435,7 +436,7 @@ static void tcp_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
for (i = 0; i < buf->count; i++) {
char *data =
- gpr_dump_slice(buf->slices[i], GPR_DUMP_HEX | GPR_DUMP_ASCII);
+ grpc_dump_slice(buf->slices[i], GPR_DUMP_HEX | GPR_DUMP_ASCII);
gpr_log(GPR_DEBUG, "WRITE %p (peer=%s): %s", tcp, tcp->peer_string, data);
gpr_free(data);
}
@@ -535,7 +536,7 @@ grpc_endpoint *grpc_tcp_create(grpc_fd *em_fd,
tcp->read_closure.cb_arg = tcp;
tcp->write_closure.cb = tcp_handle_write;
tcp->write_closure.cb_arg = tcp;
- gpr_slice_buffer_init(&tcp->last_read_buffer);
+ grpc_slice_buffer_init(&tcp->last_read_buffer);
tcp->resource_user = grpc_resource_user_create(resource_quota, peer_string);
grpc_resource_user_slice_allocator_init(
&tcp->slice_allocator, tcp->resource_user, tcp_read_allocation_done, tcp);
@@ -558,7 +559,7 @@ void grpc_tcp_destroy_and_release_fd(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
GPR_ASSERT(ep->vtable == &vtable);
tcp->release_fd = fd;
tcp->release_fd_cb = done;
- gpr_slice_buffer_reset_and_unref(&tcp->last_read_buffer);
+ grpc_slice_buffer_reset_and_unref(&tcp->last_read_buffer);
TCP_UNREF(exec_ctx, tcp, "destroy");
}
diff --git a/src/core/lib/iomgr/tcp_uv.c b/src/core/lib/iomgr/tcp_uv.c
index 8e74c9e863..8b58c04ff5 100644
--- a/src/core/lib/iomgr/tcp_uv.c
+++ b/src/core/lib/iomgr/tcp_uv.c
@@ -62,9 +62,9 @@ typedef struct {
grpc_closure *read_cb;
grpc_closure *write_cb;
- gpr_slice read_slice;
- gpr_slice_buffer *read_slices;
- gpr_slice_buffer *write_slices;
+ GRPC_SLICE read_slice;
+ GRPC_SLICE_buffer *read_slices;
+ GRPC_SLICE_buffer *write_slices;
uv_buf_t *write_buffers;
grpc_resource_user resource_user;
@@ -123,14 +123,14 @@ static void alloc_uv_buf(uv_handle_t *handle, size_t suggested_size,
(void)suggested_size;
tcp->read_slice = grpc_resource_user_slice_malloc(
&exec_ctx, &tcp->resource_user, GRPC_TCP_DEFAULT_READ_SLICE_SIZE);
- buf->base = (char *)GPR_SLICE_START_PTR(tcp->read_slice);
- buf->len = GPR_SLICE_LENGTH(tcp->read_slice);
+ buf->base = (char *)GRPC_SLICE_START_PTR(tcp->read_slice);
+ buf->len = GRPC_SLICE_LENGTH(tcp->read_slice);
grpc_exec_ctx_finish(&exec_ctx);
}
static void read_callback(uv_stream_t *stream, ssize_t nread,
const uv_buf_t *buf) {
- gpr_slice sub;
+ GRPC_SLICE sub;
grpc_error *error;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_tcp *tcp = stream->data;
@@ -147,8 +147,8 @@ static void read_callback(uv_stream_t *stream, ssize_t nread,
error = GRPC_ERROR_CREATE("EOF");
} else if (nread > 0) {
// Successful read
- sub = gpr_slice_sub_no_ref(tcp->read_slice, 0, (size_t)nread);
- gpr_slice_buffer_add(tcp->read_slices, sub);
+ sub = GRPC_SLICE_sub_no_ref(tcp->read_slice, 0, (size_t)nread);
+ GRPC_SLICE_buffer_add(tcp->read_slices, sub);
error = GRPC_ERROR_NONE;
if (grpc_tcp_trace) {
size_t i;
@@ -172,14 +172,14 @@ static void read_callback(uv_stream_t *stream, ssize_t nread,
}
static void uv_endpoint_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
- gpr_slice_buffer *read_slices, grpc_closure *cb) {
+ GRPC_SLICE_buffer *read_slices, grpc_closure *cb) {
grpc_tcp *tcp = (grpc_tcp *)ep;
int status;
grpc_error *error = GRPC_ERROR_NONE;
GPR_ASSERT(tcp->read_cb == NULL);
tcp->read_cb = cb;
tcp->read_slices = read_slices;
- gpr_slice_buffer_reset_and_unref(read_slices);
+ GRPC_SLICE_buffer_reset_and_unref(read_slices);
TCP_REF(tcp, "read");
// TODO(murgatroid99): figure out what the return value here means
status =
@@ -220,13 +220,13 @@ static void write_callback(uv_write_t *req, int status) {
}
static void uv_endpoint_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
- gpr_slice_buffer *write_slices,
+ GRPC_SLICE_buffer *write_slices,
grpc_closure *cb) {
grpc_tcp *tcp = (grpc_tcp *)ep;
uv_buf_t *buffers;
unsigned int buffer_count;
unsigned int i;
- gpr_slice *slice;
+ GRPC_SLICE *slice;
uv_write_t *write_req;
if (grpc_tcp_trace) {
@@ -263,8 +263,8 @@ static void uv_endpoint_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
sizeof(uv_buf_t) * buffer_count, NULL);
for (i = 0; i < buffer_count; i++) {
slice = &tcp->write_slices->slices[i];
- buffers[i].base = (char *)GPR_SLICE_START_PTR(*slice);
- buffers[i].len = GPR_SLICE_LENGTH(*slice);
+ buffers[i].base = (char *)GRPC_SLICE_START_PTR(*slice);
+ buffers[i].len = GRPC_SLICE_LENGTH(*slice);
}
tcp->write_buffers = buffers;
write_req = &tcp->write_req;
diff --git a/src/core/lib/iomgr/tcp_windows.c b/src/core/lib/iomgr/tcp_windows.c
index e7abf2971f..1fb7edc2b1 100644
--- a/src/core/lib/iomgr/tcp_windows.c
+++ b/src/core/lib/iomgr/tcp_windows.c
@@ -40,10 +40,10 @@
#include "src/core/lib/iomgr/network_status_tracker.h"
#include "src/core/lib/iomgr/sockaddr_windows.h"
+#include <grpc/slice_buffer.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/log_windows.h>
-#include <grpc/support/slice_buffer.h>
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
@@ -105,9 +105,9 @@ typedef struct grpc_tcp {
grpc_closure *read_cb;
grpc_closure *write_cb;
- gpr_slice read_slice;
- gpr_slice_buffer *write_slices;
- gpr_slice_buffer *read_slices;
+ grpc_slice read_slice;
+ grpc_slice_buffer *write_slices;
+ grpc_slice_buffer *read_slices;
grpc_resource_user *resource_user;
@@ -164,7 +164,7 @@ static void on_read(grpc_exec_ctx *exec_ctx, void *tcpp, grpc_error *error) {
grpc_tcp *tcp = tcpp;
grpc_closure *cb = tcp->read_cb;
grpc_winsocket *socket = tcp->socket;
- gpr_slice sub;
+ grpc_slice sub;
grpc_winsocket_callback_info *info = &socket->read_info;
GRPC_ERROR_REF(error);
@@ -174,13 +174,13 @@ static void on_read(grpc_exec_ctx *exec_ctx, void *tcpp, grpc_error *error) {
char *utf8_message = gpr_format_message(info->wsa_error);
error = GRPC_ERROR_CREATE(utf8_message);
gpr_free(utf8_message);
- gpr_slice_unref(tcp->read_slice);
+ grpc_slice_unref(tcp->read_slice);
} else {
if (info->bytes_transfered != 0 && !tcp->shutting_down) {
- sub = gpr_slice_sub_no_ref(tcp->read_slice, 0, info->bytes_transfered);
- gpr_slice_buffer_add(tcp->read_slices, sub);
+ sub = grpc_slice_sub_no_ref(tcp->read_slice, 0, info->bytes_transfered);
+ grpc_slice_buffer_add(tcp->read_slices, sub);
} else {
- gpr_slice_unref(tcp->read_slice);
+ grpc_slice_unref(tcp->read_slice);
error = GRPC_ERROR_CREATE("End of TCP stream");
}
}
@@ -192,7 +192,7 @@ static void on_read(grpc_exec_ctx *exec_ctx, void *tcpp, grpc_error *error) {
}
static void win_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
- gpr_slice_buffer *read_slices, grpc_closure *cb) {
+ grpc_slice_buffer *read_slices, grpc_closure *cb) {
grpc_tcp *tcp = (grpc_tcp *)ep;
grpc_winsocket *handle = tcp->socket;
grpc_winsocket_callback_info *info = &handle->read_info;
@@ -209,13 +209,13 @@ static void win_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
tcp->read_cb = cb;
tcp->read_slices = read_slices;
- gpr_slice_buffer_reset_and_unref(read_slices);
+ grpc_slice_buffer_reset_and_unref(read_slices);
- tcp->read_slice = gpr_slice_malloc(8192);
+ tcp->read_slice = grpc_slice_malloc(8192);
- buffer.len = (ULONG)GPR_SLICE_LENGTH(
+ buffer.len = (ULONG)GRPC_SLICE_LENGTH(
tcp->read_slice); // we know slice size fits in 32bit.
- buffer.buf = (char *)GPR_SLICE_START_PTR(tcp->read_slice);
+ buffer.buf = (char *)GRPC_SLICE_START_PTR(tcp->read_slice);
TCP_REF(tcp, "read");
@@ -277,7 +277,7 @@ static void on_write(grpc_exec_ctx *exec_ctx, void *tcpp, grpc_error *error) {
/* Initiates a write. */
static void win_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
- gpr_slice_buffer *slices, grpc_closure *cb) {
+ grpc_slice_buffer *slices, grpc_closure *cb) {
grpc_tcp *tcp = (grpc_tcp *)ep;
grpc_winsocket *socket = tcp->socket;
grpc_winsocket_callback_info *info = &socket->write_info;
@@ -304,10 +304,10 @@ static void win_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
}
for (i = 0; i < tcp->write_slices->count; i++) {
- len = GPR_SLICE_LENGTH(tcp->write_slices->slices[i]);
+ len = GRPC_SLICE_LENGTH(tcp->write_slices->slices[i]);
GPR_ASSERT(len <= ULONG_MAX);
buffers[i].len = (ULONG)len;
- buffers[i].buf = (char *)GPR_SLICE_START_PTR(tcp->write_slices->slices[i]);
+ buffers[i].buf = (char *)GRPC_SLICE_START_PTR(tcp->write_slices->slices[i]);
}
/* First, let's try a synchronous, non-blocking write. */
diff --git a/src/core/lib/security/credentials/credentials.h b/src/core/lib/security/credentials/credentials.h
index 6fb5b5b15a..85b3bc5350 100644
--- a/src/core/lib/security/credentials/credentials.h
+++ b/src/core/lib/security/credentials/credentials.h
@@ -141,8 +141,8 @@ grpc_channel_credentials_duplicate_without_call_credentials(
/* --- grpc_credentials_md. --- */
typedef struct {
- gpr_slice key;
- gpr_slice value;
+ grpc_slice key;
+ grpc_slice value;
} grpc_credentials_md;
typedef struct {
@@ -157,7 +157,7 @@ grpc_credentials_md_store *grpc_credentials_md_store_create(
/* Will ref key and value. */
void grpc_credentials_md_store_add(grpc_credentials_md_store *store,
- gpr_slice key, gpr_slice value);
+ grpc_slice key, grpc_slice value);
void grpc_credentials_md_store_add_cstrings(grpc_credentials_md_store *store,
const char *key, const char *value);
grpc_credentials_md_store *grpc_credentials_md_store_ref(
diff --git a/src/core/lib/security/credentials/credentials_metadata.c b/src/core/lib/security/credentials/credentials_metadata.c
index 6a352aab3a..e6cb567734 100644
--- a/src/core/lib/security/credentials/credentials_metadata.c
+++ b/src/core/lib/security/credentials/credentials_metadata.c
@@ -59,11 +59,11 @@ grpc_credentials_md_store *grpc_credentials_md_store_create(
}
void grpc_credentials_md_store_add(grpc_credentials_md_store *store,
- gpr_slice key, gpr_slice value) {
+ grpc_slice key, grpc_slice value) {
if (store == NULL) return;
store_ensure_capacity(store);
- store->entries[store->num_entries].key = gpr_slice_ref(key);
- store->entries[store->num_entries].value = gpr_slice_ref(value);
+ store->entries[store->num_entries].key = grpc_slice_ref(key);
+ store->entries[store->num_entries].value = grpc_slice_ref(value);
store->num_entries++;
}
@@ -72,9 +72,9 @@ void grpc_credentials_md_store_add_cstrings(grpc_credentials_md_store *store,
const char *value) {
if (store == NULL) return;
store_ensure_capacity(store);
- store->entries[store->num_entries].key = gpr_slice_from_copied_string(key);
+ store->entries[store->num_entries].key = grpc_slice_from_copied_string(key);
store->entries[store->num_entries].value =
- gpr_slice_from_copied_string(value);
+ grpc_slice_from_copied_string(value);
store->num_entries++;
}
@@ -91,8 +91,8 @@ void grpc_credentials_md_store_unref(grpc_credentials_md_store *store) {
if (store->entries != NULL) {
size_t i;
for (i = 0; i < store->num_entries; i++) {
- gpr_slice_unref(store->entries[i].key);
- gpr_slice_unref(store->entries[i].value);
+ grpc_slice_unref(store->entries[i].key);
+ grpc_slice_unref(store->entries[i].value);
}
gpr_free(store->entries);
}
diff --git a/src/core/lib/security/credentials/google_default/google_default_credentials.c b/src/core/lib/security/credentials/google_default/google_default_credentials.c
index cb5ba554b0..afe0e3d357 100644
--- a/src/core/lib/security/credentials/google_default/google_default_credentials.c
+++ b/src/core/lib/security/credentials/google_default/google_default_credentials.c
@@ -45,6 +45,7 @@
#include "src/core/lib/iomgr/polling_entity.h"
#include "src/core/lib/security/credentials/jwt/jwt_credentials.h"
#include "src/core/lib/security/credentials/oauth2/oauth2_credentials.h"
+#include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/lib/support/env.h"
#include "src/core/lib/support/string.h"
#include "src/core/lib/surface/api_trace.h"
@@ -174,7 +175,7 @@ static grpc_error *create_default_creds_from_path(
grpc_auth_json_key key;
grpc_auth_refresh_token token;
grpc_call_credentials *result = NULL;
- gpr_slice creds_data = gpr_empty_slice();
+ grpc_slice creds_data = gpr_empty_slice();
grpc_error *error = GRPC_ERROR_NONE;
if (creds_path == NULL) {
error = GRPC_ERROR_CREATE("creds_path unset");
@@ -185,9 +186,9 @@ static grpc_error *create_default_creds_from_path(
goto end;
}
json = grpc_json_parse_string_with_len(
- (char *)GPR_SLICE_START_PTR(creds_data), GPR_SLICE_LENGTH(creds_data));
+ (char *)GRPC_SLICE_START_PTR(creds_data), GRPC_SLICE_LENGTH(creds_data));
if (json == NULL) {
- char *dump = gpr_dump_slice(creds_data, GPR_DUMP_HEX | GPR_DUMP_ASCII);
+ char *dump = grpc_dump_slice(creds_data, GPR_DUMP_HEX | GPR_DUMP_ASCII);
error = grpc_error_set_str(GRPC_ERROR_CREATE("Failed to parse JSON"),
GRPC_ERROR_STR_RAW_BYTES, dump);
gpr_free(dump);
@@ -224,7 +225,7 @@ static grpc_error *create_default_creds_from_path(
end:
GPR_ASSERT((result == NULL) + (error == GRPC_ERROR_NONE) == 1);
if (creds_path != NULL) gpr_free(creds_path);
- gpr_slice_unref(creds_data);
+ grpc_slice_unref(creds_data);
if (json != NULL) grpc_json_destroy(json);
*creds = result;
return error;
diff --git a/src/core/lib/security/credentials/jwt/json_token.h b/src/core/lib/security/credentials/jwt/json_token.h
index 07fc5bf0e0..c13eb55803 100644
--- a/src/core/lib/security/credentials/jwt/json_token.h
+++ b/src/core/lib/security/credentials/jwt/json_token.h
@@ -34,7 +34,7 @@
#ifndef GRPC_CORE_LIB_SECURITY_CREDENTIALS_JWT_JSON_TOKEN_H
#define GRPC_CORE_LIB_SECURITY_CREDENTIALS_JWT_JSON_TOKEN_H
-#include <grpc/support/slice.h>
+#include <grpc/slice.h>
#include <openssl/rsa.h>
#include "src/core/lib/json/json.h"
diff --git a/src/core/lib/security/credentials/jwt/jwt_verifier.c b/src/core/lib/security/credentials/jwt/jwt_verifier.c
index 43eb642515..42bd89dd0a 100644
--- a/src/core/lib/security/credentials/jwt/jwt_verifier.c
+++ b/src/core/lib/security/credentials/jwt/jwt_verifier.c
@@ -85,18 +85,18 @@ static const EVP_MD *evp_md_from_alg(const char *alg) {
}
static grpc_json *parse_json_part_from_jwt(const char *str, size_t len,
- gpr_slice *buffer) {
+ grpc_slice *buffer) {
grpc_json *json;
*buffer = grpc_base64_decode_with_len(str, len, 1);
- if (GPR_SLICE_IS_EMPTY(*buffer)) {
+ if (GRPC_SLICE_IS_EMPTY(*buffer)) {
gpr_log(GPR_ERROR, "Invalid base64.");
return NULL;
}
- json = grpc_json_parse_string_with_len((char *)GPR_SLICE_START_PTR(*buffer),
- GPR_SLICE_LENGTH(*buffer));
+ json = grpc_json_parse_string_with_len((char *)GRPC_SLICE_START_PTR(*buffer),
+ GRPC_SLICE_LENGTH(*buffer));
if (json == NULL) {
- gpr_slice_unref(*buffer);
+ grpc_slice_unref(*buffer);
gpr_log(GPR_ERROR, "JSON parsing error.");
}
return json;
@@ -129,16 +129,16 @@ typedef struct {
const char *kid;
const char *typ;
/* TODO(jboeuf): Add others as needed (jku, jwk, x5u, x5c and so on...). */
- gpr_slice buffer;
+ grpc_slice buffer;
} jose_header;
static void jose_header_destroy(jose_header *h) {
- gpr_slice_unref(h->buffer);
+ grpc_slice_unref(h->buffer);
gpr_free(h);
}
/* Takes ownership of json and buffer. */
-static jose_header *jose_header_from_json(grpc_json *json, gpr_slice buffer) {
+static jose_header *jose_header_from_json(grpc_json *json, grpc_slice buffer) {
grpc_json *cur;
jose_header *h = gpr_malloc(sizeof(jose_header));
memset(h, 0, sizeof(jose_header));
@@ -190,12 +190,12 @@ struct grpc_jwt_claims {
gpr_timespec nbf;
grpc_json *json;
- gpr_slice buffer;
+ grpc_slice buffer;
};
void grpc_jwt_claims_destroy(grpc_jwt_claims *claims) {
grpc_json_destroy(claims->json);
- gpr_slice_unref(claims->buffer);
+ grpc_slice_unref(claims->buffer);
gpr_free(claims);
}
@@ -240,7 +240,7 @@ gpr_timespec grpc_jwt_claims_not_before(const grpc_jwt_claims *claims) {
}
/* Takes ownership of json and buffer even in case of failure. */
-grpc_jwt_claims *grpc_jwt_claims_from_json(grpc_json *json, gpr_slice buffer) {
+grpc_jwt_claims *grpc_jwt_claims_from_json(grpc_json *json, grpc_slice buffer) {
grpc_json *cur;
grpc_jwt_claims *claims = gpr_malloc(sizeof(grpc_jwt_claims));
memset(claims, 0, sizeof(grpc_jwt_claims));
@@ -333,8 +333,8 @@ typedef struct {
jose_header *header;
grpc_jwt_claims *claims;
char *audience;
- gpr_slice signature;
- gpr_slice signed_data;
+ grpc_slice signature;
+ grpc_slice signed_data;
void *user_data;
grpc_jwt_verification_done_cb user_cb;
grpc_http_response responses[HTTP_RESPONSE_COUNT];
@@ -343,7 +343,7 @@ typedef struct {
/* Takes ownership of the header, claims and signature. */
static verifier_cb_ctx *verifier_cb_ctx_create(
grpc_jwt_verifier *verifier, grpc_pollset *pollset, jose_header *header,
- grpc_jwt_claims *claims, const char *audience, gpr_slice signature,
+ grpc_jwt_claims *claims, const char *audience, grpc_slice signature,
const char *signed_jwt, size_t signed_jwt_len, void *user_data,
grpc_jwt_verification_done_cb cb) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
@@ -355,7 +355,7 @@ static verifier_cb_ctx *verifier_cb_ctx_create(
ctx->audience = gpr_strdup(audience);
ctx->claims = claims;
ctx->signature = signature;
- ctx->signed_data = gpr_slice_from_copied_buffer(signed_jwt, signed_jwt_len);
+ ctx->signed_data = grpc_slice_from_copied_buffer(signed_jwt, signed_jwt_len);
ctx->user_data = user_data;
ctx->user_cb = cb;
grpc_exec_ctx_finish(&exec_ctx);
@@ -365,8 +365,8 @@ static verifier_cb_ctx *verifier_cb_ctx_create(
void verifier_cb_ctx_destroy(verifier_cb_ctx *ctx) {
if (ctx->audience != NULL) gpr_free(ctx->audience);
if (ctx->claims != NULL) grpc_jwt_claims_destroy(ctx->claims);
- gpr_slice_unref(ctx->signature);
- gpr_slice_unref(ctx->signed_data);
+ grpc_slice_unref(ctx->signature);
+ grpc_slice_unref(ctx->signed_data);
jose_header_destroy(ctx->header);
for (size_t i = 0; i < HTTP_RESPONSE_COUNT; i++) {
grpc_http_response_destroy(&ctx->responses[i]);
@@ -449,17 +449,17 @@ end:
static BIGNUM *bignum_from_base64(const char *b64) {
BIGNUM *result = NULL;
- gpr_slice bin;
+ grpc_slice bin;
if (b64 == NULL) return NULL;
bin = grpc_base64_decode(b64, 1);
- if (GPR_SLICE_IS_EMPTY(bin)) {
+ if (GRPC_SLICE_IS_EMPTY(bin)) {
gpr_log(GPR_ERROR, "Invalid base64 for big num.");
return NULL;
}
- result = BN_bin2bn(GPR_SLICE_START_PTR(bin),
- TSI_SIZE_AS_SIZE(GPR_SLICE_LENGTH(bin)), NULL);
- gpr_slice_unref(bin);
+ result = BN_bin2bn(GRPC_SLICE_START_PTR(bin),
+ TSI_SIZE_AS_SIZE(GRPC_SLICE_LENGTH(bin)), NULL);
+ grpc_slice_unref(bin);
return result;
}
@@ -553,7 +553,7 @@ static EVP_PKEY *find_verification_key(const grpc_json *json,
}
static int verify_jwt_signature(EVP_PKEY *key, const char *alg,
- gpr_slice signature, gpr_slice signed_data) {
+ grpc_slice signature, grpc_slice signed_data) {
EVP_MD_CTX *md_ctx = EVP_MD_CTX_create();
const EVP_MD *md = evp_md_from_alg(alg);
int result = 0;
@@ -567,13 +567,13 @@ static int verify_jwt_signature(EVP_PKEY *key, const char *alg,
gpr_log(GPR_ERROR, "EVP_DigestVerifyInit failed.");
goto end;
}
- if (EVP_DigestVerifyUpdate(md_ctx, GPR_SLICE_START_PTR(signed_data),
- GPR_SLICE_LENGTH(signed_data)) != 1) {
+ if (EVP_DigestVerifyUpdate(md_ctx, GRPC_SLICE_START_PTR(signed_data),
+ GRPC_SLICE_LENGTH(signed_data)) != 1) {
gpr_log(GPR_ERROR, "EVP_DigestVerifyUpdate failed.");
goto end;
}
- if (EVP_DigestVerifyFinal(md_ctx, GPR_SLICE_START_PTR(signature),
- GPR_SLICE_LENGTH(signature)) != 1) {
+ if (EVP_DigestVerifyFinal(md_ctx, GRPC_SLICE_START_PTR(signature),
+ GRPC_SLICE_LENGTH(signature)) != 1) {
gpr_log(GPR_ERROR, "JWT signature verification failed.");
goto end;
}
@@ -799,9 +799,9 @@ void grpc_jwt_verifier_verify(grpc_exec_ctx *exec_ctx,
grpc_json *json;
jose_header *header = NULL;
grpc_jwt_claims *claims = NULL;
- gpr_slice header_buffer;
- gpr_slice claims_buffer;
- gpr_slice signature;
+ grpc_slice header_buffer;
+ grpc_slice claims_buffer;
+ grpc_slice signature;
size_t signed_jwt_len;
const char *cur = jwt;
@@ -824,7 +824,7 @@ void grpc_jwt_verifier_verify(grpc_exec_ctx *exec_ctx,
signed_jwt_len = (size_t)(dot - jwt);
cur = dot + 1;
signature = grpc_base64_decode(cur, 1);
- if (GPR_SLICE_IS_EMPTY(signature)) goto error;
+ if (GRPC_SLICE_IS_EMPTY(signature)) goto error;
retrieve_key_and_verify(
exec_ctx,
verifier_cb_ctx_create(verifier, pollset, header, claims, audience,
diff --git a/src/core/lib/security/credentials/jwt/jwt_verifier.h b/src/core/lib/security/credentials/jwt/jwt_verifier.h
index b0f6d1c240..f09f9d5d47 100644
--- a/src/core/lib/security/credentials/jwt/jwt_verifier.h
+++ b/src/core/lib/security/credentials/jwt/jwt_verifier.h
@@ -37,7 +37,7 @@
#include "src/core/lib/iomgr/pollset.h"
#include "src/core/lib/json/json.h"
-#include <grpc/support/slice.h>
+#include <grpc/slice.h>
#include <grpc/support/time.h>
/* --- Constants. --- */
@@ -129,7 +129,7 @@ void grpc_jwt_verifier_verify(grpc_exec_ctx *exec_ctx,
/* --- TESTING ONLY exposed functions. --- */
-grpc_jwt_claims *grpc_jwt_claims_from_json(grpc_json *json, gpr_slice buffer);
+grpc_jwt_claims *grpc_jwt_claims_from_json(grpc_json *json, grpc_slice buffer);
grpc_jwt_verifier_status grpc_jwt_claims_check(const grpc_jwt_claims *claims,
const char *audience);
diff --git a/src/core/lib/security/credentials/plugin/plugin_credentials.c b/src/core/lib/security/credentials/plugin/plugin_credentials.c
index 905de3723e..61c10862da 100644
--- a/src/core/lib/security/credentials/plugin/plugin_credentials.c
+++ b/src/core/lib/security/credentials/plugin/plugin_credentials.c
@@ -93,15 +93,15 @@ static void plugin_md_request_metadata_ready(void *request,
} else if (num_md > 0) {
md_array = gpr_malloc(num_md * sizeof(grpc_credentials_md));
for (i = 0; i < num_md; i++) {
- md_array[i].key = gpr_slice_from_copied_string(md[i].key);
+ md_array[i].key = grpc_slice_from_copied_string(md[i].key);
md_array[i].value =
- gpr_slice_from_copied_buffer(md[i].value, md[i].value_length);
+ grpc_slice_from_copied_buffer(md[i].value, md[i].value_length);
}
r->cb(&exec_ctx, r->user_data, md_array, num_md, GRPC_CREDENTIALS_OK,
NULL);
for (i = 0; i < num_md; i++) {
- gpr_slice_unref(md_array[i].key);
- gpr_slice_unref(md_array[i].value);
+ grpc_slice_unref(md_array[i].key);
+ grpc_slice_unref(md_array[i].value);
}
gpr_free(md_array);
}
diff --git a/src/core/lib/security/transport/client_auth_filter.c b/src/core/lib/security/transport/client_auth_filter.c
index b366d1410f..cd4769ea10 100644
--- a/src/core/lib/security/transport/client_auth_filter.c
+++ b/src/core/lib/security/transport/client_auth_filter.c
@@ -92,7 +92,7 @@ static void bubble_up_error(grpc_exec_ctx *exec_ctx, grpc_call_element *elem,
grpc_status_code status, const char *error_msg) {
call_data *calld = elem->call_data;
gpr_log(GPR_ERROR, "Client side authentication failure: %s", error_msg);
- gpr_slice error_slice = gpr_slice_from_copied_string(error_msg);
+ grpc_slice error_slice = grpc_slice_from_copied_string(error_msg);
grpc_transport_stream_op_add_close(&calld->op, status, &error_slice);
grpc_call_next_op(exec_ctx, elem, &calld->op);
}
@@ -121,8 +121,8 @@ static void on_credentials_metadata(grpc_exec_ctx *exec_ctx, void *user_data,
for (i = 0; i < num_md; i++) {
grpc_metadata_batch_add_tail(
mdb, &calld->md_links[i],
- grpc_mdelem_from_slices(gpr_slice_ref(md_elems[i].key),
- gpr_slice_ref(md_elems[i].value)));
+ grpc_mdelem_from_slices(grpc_slice_ref(md_elems[i].key),
+ grpc_slice_ref(md_elems[i].value)));
}
grpc_call_next_op(exec_ctx, elem, op);
}
diff --git a/src/core/lib/security/transport/handshake.c b/src/core/lib/security/transport/handshake.c
index fbeec312b6..01e7fab773 100644
--- a/src/core/lib/security/transport/handshake.c
+++ b/src/core/lib/security/transport/handshake.c
@@ -36,9 +36,9 @@
#include <stdbool.h>
#include <string.h>
+#include <grpc/slice_buffer.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/slice_buffer.h>
#include "src/core/lib/iomgr/timer.h"
#include "src/core/lib/security/context/security_context.h"
#include "src/core/lib/security/transport/secure_endpoint.h"
@@ -54,9 +54,9 @@ typedef struct {
size_t handshake_buffer_size;
grpc_endpoint *wrapped_endpoint;
grpc_endpoint *secure_endpoint;
- gpr_slice_buffer left_overs;
- gpr_slice_buffer incoming;
- gpr_slice_buffer outgoing;
+ grpc_slice_buffer left_overs;
+ grpc_slice_buffer incoming;
+ grpc_slice_buffer outgoing;
grpc_security_handshake_done_cb cb;
void *user_data;
grpc_closure on_handshake_data_sent_to_peer;
@@ -104,9 +104,9 @@ static void unref_handshake(grpc_security_handshake *h) {
if (gpr_unref(&h->refs)) {
if (h->handshaker != NULL) tsi_handshaker_destroy(h->handshaker);
if (h->handshake_buffer != NULL) gpr_free(h->handshake_buffer);
- gpr_slice_buffer_destroy(&h->left_overs);
- gpr_slice_buffer_destroy(&h->outgoing);
- gpr_slice_buffer_destroy(&h->incoming);
+ grpc_slice_buffer_destroy(&h->left_overs);
+ grpc_slice_buffer_destroy(&h->outgoing);
+ grpc_slice_buffer_destroy(&h->incoming);
GRPC_AUTH_CONTEXT_UNREF(h->auth_context, "handshake");
GRPC_SECURITY_CONNECTOR_UNREF(h->connector, "handshake");
gpr_free(h);
@@ -190,7 +190,7 @@ static void send_handshake_bytes_to_peer(grpc_exec_ctx *exec_ctx,
grpc_security_handshake *h) {
size_t offset = 0;
tsi_result result = TSI_OK;
- gpr_slice to_send;
+ grpc_slice to_send;
do {
size_t to_send_size = h->handshake_buffer_size - offset;
@@ -212,9 +212,9 @@ static void send_handshake_bytes_to_peer(grpc_exec_ctx *exec_ctx,
}
to_send =
- gpr_slice_from_copied_buffer((const char *)h->handshake_buffer, offset);
- gpr_slice_buffer_reset_and_unref(&h->outgoing);
- gpr_slice_buffer_add(&h->outgoing, to_send);
+ grpc_slice_from_copied_buffer((const char *)h->handshake_buffer, offset);
+ grpc_slice_buffer_reset_and_unref(&h->outgoing);
+ grpc_slice_buffer_add(&h->outgoing, to_send);
/* TODO(klempner,jboeuf): This should probably use the client setup
deadline */
grpc_endpoint_write(exec_ctx, h->wrapped_endpoint, &h->outgoing,
@@ -239,9 +239,9 @@ static void on_handshake_data_received_from_peer(grpc_exec_ctx *exec_ctx,
}
for (i = 0; i < h->incoming.count; i++) {
- consumed_slice_size = GPR_SLICE_LENGTH(h->incoming.slices[i]);
+ consumed_slice_size = GRPC_SLICE_LENGTH(h->incoming.slices[i]);
result = tsi_handshaker_process_bytes_from_peer(
- h->handshaker, GPR_SLICE_START_PTR(h->incoming.slices[i]),
+ h->handshaker, GRPC_SLICE_START_PTR(h->incoming.slices[i]),
&consumed_slice_size);
if (!tsi_handshaker_is_in_progress(h->handshaker)) break;
}
@@ -267,7 +267,7 @@ static void on_handshake_data_received_from_peer(grpc_exec_ctx *exec_ctx,
/* Handshake is done and successful this point. */
has_left_overs_in_current_slice =
- (consumed_slice_size < GPR_SLICE_LENGTH(h->incoming.slices[i]));
+ (consumed_slice_size < GRPC_SLICE_LENGTH(h->incoming.slices[i]));
num_left_overs =
(has_left_overs_in_current_slice ? 1 : 0) + h->incoming.count - i - 1;
if (num_left_overs == 0) {
@@ -277,13 +277,13 @@ static void on_handshake_data_received_from_peer(grpc_exec_ctx *exec_ctx,
/* Put the leftovers in our buffer (ownership transfered). */
if (has_left_overs_in_current_slice) {
- gpr_slice_buffer_add(
+ grpc_slice_buffer_add(
&h->left_overs,
- gpr_slice_split_tail(&h->incoming.slices[i], consumed_slice_size));
- gpr_slice_unref(
+ grpc_slice_split_tail(&h->incoming.slices[i], consumed_slice_size));
+ grpc_slice_unref(
h->incoming.slices[i]); /* split_tail above increments refcount. */
}
- gpr_slice_buffer_addn(
+ grpc_slice_buffer_addn(
&h->left_overs, &h->incoming.slices[i + 1],
num_left_overs - (size_t)has_left_overs_in_current_slice);
check_peer(exec_ctx, h);
@@ -325,7 +325,7 @@ static void on_timeout(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
void grpc_do_security_handshake(
grpc_exec_ctx *exec_ctx, tsi_handshaker *handshaker,
grpc_security_connector *connector, bool is_client_side,
- grpc_endpoint *nonsecure_endpoint, gpr_slice_buffer *read_buffer,
+ grpc_endpoint *nonsecure_endpoint, grpc_slice_buffer *read_buffer,
gpr_timespec deadline, grpc_security_handshake_done_cb cb,
void *user_data) {
grpc_security_connector_handshake_list *handshake_node;
@@ -344,11 +344,11 @@ void grpc_do_security_handshake(
on_handshake_data_sent_to_peer, h);
grpc_closure_init(&h->on_handshake_data_received_from_peer,
on_handshake_data_received_from_peer, h);
- gpr_slice_buffer_init(&h->left_overs);
- gpr_slice_buffer_init(&h->outgoing);
- gpr_slice_buffer_init(&h->incoming);
+ grpc_slice_buffer_init(&h->left_overs);
+ grpc_slice_buffer_init(&h->outgoing);
+ grpc_slice_buffer_init(&h->incoming);
if (read_buffer != NULL) {
- gpr_slice_buffer_move_into(read_buffer, &h->incoming);
+ grpc_slice_buffer_move_into(read_buffer, &h->incoming);
gpr_free(read_buffer);
}
if (!is_client_side) {
diff --git a/src/core/lib/security/transport/handshake.h b/src/core/lib/security/transport/handshake.h
index 53092f5421..f894540515 100644
--- a/src/core/lib/security/transport/handshake.h
+++ b/src/core/lib/security/transport/handshake.h
@@ -42,7 +42,7 @@
void grpc_do_security_handshake(
grpc_exec_ctx *exec_ctx, tsi_handshaker *handshaker,
grpc_security_connector *connector, bool is_client_side,
- grpc_endpoint *nonsecure_endpoint, gpr_slice_buffer *read_buffer,
+ grpc_endpoint *nonsecure_endpoint, grpc_slice_buffer *read_buffer,
gpr_timespec deadline, grpc_security_handshake_done_cb cb, void *user_data);
void grpc_security_handshake_shutdown(grpc_exec_ctx *exec_ctx, void *handshake);
diff --git a/src/core/lib/security/transport/secure_endpoint.c b/src/core/lib/security/transport/secure_endpoint.c
index 3924997d31..fba3314812 100644
--- a/src/core/lib/security/transport/secure_endpoint.c
+++ b/src/core/lib/security/transport/secure_endpoint.c
@@ -32,14 +32,15 @@
*/
#include "src/core/lib/security/transport/secure_endpoint.h"
+#include <grpc/slice.h>
+#include <grpc/slice_buffer.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/slice.h>
-#include <grpc/support/slice_buffer.h>
#include <grpc/support/sync.h>
#include "src/core/lib/debug/trace.h"
#include "src/core/lib/profiling/timers.h"
#include "src/core/lib/security/transport/tsi_error.h"
+#include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/lib/support/string.h"
#include "src/core/lib/tsi/transport_security_interface.h"
@@ -54,15 +55,15 @@ typedef struct {
grpc_closure *read_cb;
grpc_closure *write_cb;
grpc_closure on_read;
- gpr_slice_buffer *read_buffer;
- gpr_slice_buffer source_buffer;
+ grpc_slice_buffer *read_buffer;
+ grpc_slice_buffer source_buffer;
/* saved handshaker leftover data to unprotect. */
- gpr_slice_buffer leftover_bytes;
+ grpc_slice_buffer leftover_bytes;
/* buffers for read and write */
- gpr_slice read_staging_buffer;
+ grpc_slice read_staging_buffer;
- gpr_slice write_staging_buffer;
- gpr_slice_buffer output_buffer;
+ grpc_slice write_staging_buffer;
+ grpc_slice_buffer output_buffer;
gpr_refcount ref;
} secure_endpoint;
@@ -73,11 +74,11 @@ static void destroy(grpc_exec_ctx *exec_ctx, secure_endpoint *secure_ep) {
secure_endpoint *ep = secure_ep;
grpc_endpoint_destroy(exec_ctx, ep->wrapped_ep);
tsi_frame_protector_destroy(ep->protector);
- gpr_slice_buffer_destroy(&ep->leftover_bytes);
- gpr_slice_unref(ep->read_staging_buffer);
- gpr_slice_unref(ep->write_staging_buffer);
- gpr_slice_buffer_destroy(&ep->output_buffer);
- gpr_slice_buffer_destroy(&ep->source_buffer);
+ grpc_slice_buffer_destroy(&ep->leftover_bytes);
+ grpc_slice_unref(ep->read_staging_buffer);
+ grpc_slice_unref(ep->write_staging_buffer);
+ grpc_slice_buffer_destroy(&ep->output_buffer);
+ grpc_slice_buffer_destroy(&ep->source_buffer);
gpr_mu_destroy(&ep->protector_mu);
gpr_free(ep);
}
@@ -121,10 +122,10 @@ static void secure_endpoint_ref(secure_endpoint *ep) { gpr_ref(&ep->ref); }
static void flush_read_staging_buffer(secure_endpoint *ep, uint8_t **cur,
uint8_t **end) {
- gpr_slice_buffer_add(ep->read_buffer, ep->read_staging_buffer);
- ep->read_staging_buffer = gpr_slice_malloc(STAGING_BUFFER_SIZE);
- *cur = GPR_SLICE_START_PTR(ep->read_staging_buffer);
- *end = GPR_SLICE_END_PTR(ep->read_staging_buffer);
+ grpc_slice_buffer_add(ep->read_buffer, ep->read_staging_buffer);
+ ep->read_staging_buffer = grpc_slice_malloc(STAGING_BUFFER_SIZE);
+ *cur = GRPC_SLICE_START_PTR(ep->read_staging_buffer);
+ *end = GRPC_SLICE_END_PTR(ep->read_staging_buffer);
}
static void call_read_cb(grpc_exec_ctx *exec_ctx, secure_endpoint *ep,
@@ -132,8 +133,8 @@ static void call_read_cb(grpc_exec_ctx *exec_ctx, secure_endpoint *ep,
if (grpc_trace_secure_endpoint) {
size_t i;
for (i = 0; i < ep->read_buffer->count; i++) {
- char *data = gpr_dump_slice(ep->read_buffer->slices[i],
- GPR_DUMP_HEX | GPR_DUMP_ASCII);
+ char *data = grpc_dump_slice(ep->read_buffer->slices[i],
+ GPR_DUMP_HEX | GPR_DUMP_ASCII);
gpr_log(GPR_DEBUG, "READ %p: %s", ep, data);
gpr_free(data);
}
@@ -149,11 +150,11 @@ static void on_read(grpc_exec_ctx *exec_ctx, void *user_data,
uint8_t keep_looping = 0;
tsi_result result = TSI_OK;
secure_endpoint *ep = (secure_endpoint *)user_data;
- uint8_t *cur = GPR_SLICE_START_PTR(ep->read_staging_buffer);
- uint8_t *end = GPR_SLICE_END_PTR(ep->read_staging_buffer);
+ uint8_t *cur = GRPC_SLICE_START_PTR(ep->read_staging_buffer);
+ uint8_t *end = GRPC_SLICE_END_PTR(ep->read_staging_buffer);
if (error != GRPC_ERROR_NONE) {
- gpr_slice_buffer_reset_and_unref(ep->read_buffer);
+ grpc_slice_buffer_reset_and_unref(ep->read_buffer);
call_read_cb(exec_ctx, ep, GRPC_ERROR_CREATE_REFERENCING(
"Secure read failed", &error, 1));
return;
@@ -161,9 +162,9 @@ static void on_read(grpc_exec_ctx *exec_ctx, void *user_data,
/* TODO(yangg) check error, maybe bail out early */
for (i = 0; i < ep->source_buffer.count; i++) {
- gpr_slice encrypted = ep->source_buffer.slices[i];
- uint8_t *message_bytes = GPR_SLICE_START_PTR(encrypted);
- size_t message_size = GPR_SLICE_LENGTH(encrypted);
+ grpc_slice encrypted = ep->source_buffer.slices[i];
+ uint8_t *message_bytes = GRPC_SLICE_START_PTR(encrypted);
+ size_t message_size = GRPC_SLICE_LENGTH(encrypted);
while (message_size > 0 || keep_looping) {
size_t unprotected_buffer_size_written = (size_t)(end - cur);
@@ -198,20 +199,20 @@ static void on_read(grpc_exec_ctx *exec_ctx, void *user_data,
if (result != TSI_OK) break;
}
- if (cur != GPR_SLICE_START_PTR(ep->read_staging_buffer)) {
- gpr_slice_buffer_add(
+ if (cur != GRPC_SLICE_START_PTR(ep->read_staging_buffer)) {
+ grpc_slice_buffer_add(
ep->read_buffer,
- gpr_slice_split_head(
+ grpc_slice_split_head(
&ep->read_staging_buffer,
- (size_t)(cur - GPR_SLICE_START_PTR(ep->read_staging_buffer))));
+ (size_t)(cur - GRPC_SLICE_START_PTR(ep->read_staging_buffer))));
}
/* TODO(yangg) experiment with moving this block after read_cb to see if it
helps latency */
- gpr_slice_buffer_reset_and_unref(&ep->source_buffer);
+ grpc_slice_buffer_reset_and_unref(&ep->source_buffer);
if (result != TSI_OK) {
- gpr_slice_buffer_reset_and_unref(ep->read_buffer);
+ grpc_slice_buffer_reset_and_unref(ep->read_buffer);
call_read_cb(exec_ctx, ep, grpc_set_tsi_error_result(
GRPC_ERROR_CREATE("Unwrap failed"), result));
return;
@@ -221,15 +222,15 @@ static void on_read(grpc_exec_ctx *exec_ctx, void *user_data,
}
static void endpoint_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *secure_ep,
- gpr_slice_buffer *slices, grpc_closure *cb) {
+ grpc_slice_buffer *slices, grpc_closure *cb) {
secure_endpoint *ep = (secure_endpoint *)secure_ep;
ep->read_cb = cb;
ep->read_buffer = slices;
- gpr_slice_buffer_reset_and_unref(ep->read_buffer);
+ grpc_slice_buffer_reset_and_unref(ep->read_buffer);
SECURE_ENDPOINT_REF(ep, "read");
if (ep->leftover_bytes.count) {
- gpr_slice_buffer_swap(&ep->leftover_bytes, &ep->source_buffer);
+ grpc_slice_buffer_swap(&ep->leftover_bytes, &ep->source_buffer);
GPR_ASSERT(ep->leftover_bytes.count == 0);
on_read(exec_ctx, ep, GRPC_ERROR_NONE);
return;
@@ -241,37 +242,37 @@ static void endpoint_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *secure_ep,
static void flush_write_staging_buffer(secure_endpoint *ep, uint8_t **cur,
uint8_t **end) {
- gpr_slice_buffer_add(&ep->output_buffer, ep->write_staging_buffer);
- ep->write_staging_buffer = gpr_slice_malloc(STAGING_BUFFER_SIZE);
- *cur = GPR_SLICE_START_PTR(ep->write_staging_buffer);
- *end = GPR_SLICE_END_PTR(ep->write_staging_buffer);
+ grpc_slice_buffer_add(&ep->output_buffer, ep->write_staging_buffer);
+ ep->write_staging_buffer = grpc_slice_malloc(STAGING_BUFFER_SIZE);
+ *cur = GRPC_SLICE_START_PTR(ep->write_staging_buffer);
+ *end = GRPC_SLICE_END_PTR(ep->write_staging_buffer);
}
static void endpoint_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *secure_ep,
- gpr_slice_buffer *slices, grpc_closure *cb) {
+ grpc_slice_buffer *slices, grpc_closure *cb) {
GPR_TIMER_BEGIN("secure_endpoint.endpoint_write", 0);
unsigned i;
tsi_result result = TSI_OK;
secure_endpoint *ep = (secure_endpoint *)secure_ep;
- uint8_t *cur = GPR_SLICE_START_PTR(ep->write_staging_buffer);
- uint8_t *end = GPR_SLICE_END_PTR(ep->write_staging_buffer);
+ uint8_t *cur = GRPC_SLICE_START_PTR(ep->write_staging_buffer);
+ uint8_t *end = GRPC_SLICE_END_PTR(ep->write_staging_buffer);
- gpr_slice_buffer_reset_and_unref(&ep->output_buffer);
+ grpc_slice_buffer_reset_and_unref(&ep->output_buffer);
if (grpc_trace_secure_endpoint) {
for (i = 0; i < slices->count; i++) {
char *data =
- gpr_dump_slice(slices->slices[i], GPR_DUMP_HEX | GPR_DUMP_ASCII);
+ grpc_dump_slice(slices->slices[i], GPR_DUMP_HEX | GPR_DUMP_ASCII);
gpr_log(GPR_DEBUG, "WRITE %p: %s", ep, data);
gpr_free(data);
}
}
for (i = 0; i < slices->count; i++) {
- gpr_slice plain = slices->slices[i];
- uint8_t *message_bytes = GPR_SLICE_START_PTR(plain);
- size_t message_size = GPR_SLICE_LENGTH(plain);
+ grpc_slice plain = slices->slices[i];
+ uint8_t *message_bytes = GRPC_SLICE_START_PTR(plain);
+ size_t message_size = GRPC_SLICE_LENGTH(plain);
while (message_size > 0) {
size_t protected_buffer_size_to_send = (size_t)(end - cur);
size_t processed_message_size = message_size;
@@ -310,18 +311,18 @@ static void endpoint_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *secure_ep,
flush_write_staging_buffer(ep, &cur, &end);
}
} while (still_pending_size > 0);
- if (cur != GPR_SLICE_START_PTR(ep->write_staging_buffer)) {
- gpr_slice_buffer_add(
+ if (cur != GRPC_SLICE_START_PTR(ep->write_staging_buffer)) {
+ grpc_slice_buffer_add(
&ep->output_buffer,
- gpr_slice_split_head(
+ grpc_slice_split_head(
&ep->write_staging_buffer,
- (size_t)(cur - GPR_SLICE_START_PTR(ep->write_staging_buffer))));
+ (size_t)(cur - GRPC_SLICE_START_PTR(ep->write_staging_buffer))));
}
}
if (result != TSI_OK) {
/* TODO(yangg) do different things according to the error type? */
- gpr_slice_buffer_reset_and_unref(&ep->output_buffer);
+ grpc_slice_buffer_reset_and_unref(&ep->output_buffer);
grpc_exec_ctx_sched(
exec_ctx, cb,
grpc_set_tsi_error_result(GRPC_ERROR_CREATE("Wrap failed"), result),
@@ -388,21 +389,21 @@ static const grpc_endpoint_vtable vtable = {endpoint_read,
grpc_endpoint *grpc_secure_endpoint_create(
struct tsi_frame_protector *protector, grpc_endpoint *transport,
- gpr_slice *leftover_slices, size_t leftover_nslices) {
+ grpc_slice *leftover_slices, size_t leftover_nslices) {
size_t i;
secure_endpoint *ep = (secure_endpoint *)gpr_malloc(sizeof(secure_endpoint));
ep->base.vtable = &vtable;
ep->wrapped_ep = transport;
ep->protector = protector;
- gpr_slice_buffer_init(&ep->leftover_bytes);
+ grpc_slice_buffer_init(&ep->leftover_bytes);
for (i = 0; i < leftover_nslices; i++) {
- gpr_slice_buffer_add(&ep->leftover_bytes,
- gpr_slice_ref(leftover_slices[i]));
+ grpc_slice_buffer_add(&ep->leftover_bytes,
+ grpc_slice_ref(leftover_slices[i]));
}
- ep->write_staging_buffer = gpr_slice_malloc(STAGING_BUFFER_SIZE);
- ep->read_staging_buffer = gpr_slice_malloc(STAGING_BUFFER_SIZE);
- gpr_slice_buffer_init(&ep->output_buffer);
- gpr_slice_buffer_init(&ep->source_buffer);
+ ep->write_staging_buffer = grpc_slice_malloc(STAGING_BUFFER_SIZE);
+ ep->read_staging_buffer = grpc_slice_malloc(STAGING_BUFFER_SIZE);
+ grpc_slice_buffer_init(&ep->output_buffer);
+ grpc_slice_buffer_init(&ep->source_buffer);
ep->read_buffer = NULL;
grpc_closure_init(&ep->on_read, on_read, ep);
gpr_mu_init(&ep->protector_mu);
diff --git a/src/core/lib/security/transport/secure_endpoint.h b/src/core/lib/security/transport/secure_endpoint.h
index d00075b769..a61f40a4fa 100644
--- a/src/core/lib/security/transport/secure_endpoint.h
+++ b/src/core/lib/security/transport/secure_endpoint.h
@@ -34,7 +34,7 @@
#ifndef GRPC_CORE_LIB_SECURITY_TRANSPORT_SECURE_ENDPOINT_H
#define GRPC_CORE_LIB_SECURITY_TRANSPORT_SECURE_ENDPOINT_H
-#include <grpc/support/slice.h>
+#include <grpc/slice.h>
#include "src/core/lib/iomgr/endpoint.h"
struct tsi_frame_protector;
@@ -44,6 +44,6 @@ extern int grpc_trace_secure_endpoint;
/* Takes ownership of protector and to_wrap, and refs leftover_slices. */
grpc_endpoint *grpc_secure_endpoint_create(
struct tsi_frame_protector *protector, grpc_endpoint *to_wrap,
- gpr_slice *leftover_slices, size_t leftover_nslices);
+ grpc_slice *leftover_slices, size_t leftover_nslices);
#endif /* GRPC_CORE_LIB_SECURITY_TRANSPORT_SECURE_ENDPOINT_H */
diff --git a/src/core/lib/security/transport/security_connector.c b/src/core/lib/security/transport/security_connector.c
index ebf72a3abb..0fbd63a7e1 100644
--- a/src/core/lib/security/transport/security_connector.c
+++ b/src/core/lib/security/transport/security_connector.c
@@ -36,10 +36,10 @@
#include <stdbool.h>
#include <string.h>
+#include <grpc/slice_buffer.h>
#include <grpc/support/alloc.h>
#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
-#include <grpc/support/slice_buffer.h>
#include <grpc/support/string_util.h>
#include "src/core/ext/transport/chttp2/alpn/alpn.h"
@@ -127,7 +127,7 @@ void grpc_server_security_connector_shutdown(
void grpc_channel_security_connector_do_handshake(
grpc_exec_ctx *exec_ctx, grpc_channel_security_connector *sc,
- grpc_endpoint *nonsecure_endpoint, gpr_slice_buffer *read_buffer,
+ grpc_endpoint *nonsecure_endpoint, grpc_slice_buffer *read_buffer,
gpr_timespec deadline, grpc_security_handshake_done_cb cb,
void *user_data) {
if (sc == NULL || nonsecure_endpoint == NULL) {
@@ -142,7 +142,7 @@ void grpc_channel_security_connector_do_handshake(
void grpc_server_security_connector_do_handshake(
grpc_exec_ctx *exec_ctx, grpc_server_security_connector *sc,
grpc_tcp_server_acceptor *acceptor, grpc_endpoint *nonsecure_endpoint,
- gpr_slice_buffer *read_buffer, gpr_timespec deadline,
+ grpc_slice_buffer *read_buffer, gpr_timespec deadline,
grpc_security_handshake_done_cb cb, void *user_data) {
if (sc == NULL || nonsecure_endpoint == NULL) {
gpr_free(read_buffer);
@@ -316,7 +316,7 @@ static void fake_channel_check_call_host(grpc_exec_ctx *exec_ctx,
static void fake_channel_do_handshake(grpc_exec_ctx *exec_ctx,
grpc_channel_security_connector *sc,
grpc_endpoint *nonsecure_endpoint,
- gpr_slice_buffer *read_buffer,
+ grpc_slice_buffer *read_buffer,
gpr_timespec deadline,
grpc_security_handshake_done_cb cb,
void *user_data) {
@@ -328,7 +328,7 @@ static void fake_channel_do_handshake(grpc_exec_ctx *exec_ctx,
static void fake_server_do_handshake(
grpc_exec_ctx *exec_ctx, grpc_server_security_connector *sc,
grpc_tcp_server_acceptor *acceptor, grpc_endpoint *nonsecure_endpoint,
- gpr_slice_buffer *read_buffer, gpr_timespec deadline,
+ grpc_slice_buffer *read_buffer, gpr_timespec deadline,
grpc_security_handshake_done_cb cb, void *user_data) {
grpc_do_security_handshake(exec_ctx, tsi_create_fake_handshaker(0), &sc->base,
false, nonsecure_endpoint, read_buffer, deadline,
@@ -422,7 +422,7 @@ static grpc_security_status ssl_create_handshaker(
static void ssl_channel_do_handshake(grpc_exec_ctx *exec_ctx,
grpc_channel_security_connector *sc,
grpc_endpoint *nonsecure_endpoint,
- gpr_slice_buffer *read_buffer,
+ grpc_slice_buffer *read_buffer,
gpr_timespec deadline,
grpc_security_handshake_done_cb cb,
void *user_data) {
@@ -447,7 +447,7 @@ static void ssl_channel_do_handshake(grpc_exec_ctx *exec_ctx,
static void ssl_server_do_handshake(
grpc_exec_ctx *exec_ctx, grpc_server_security_connector *sc,
grpc_tcp_server_acceptor *acceptor, grpc_endpoint *nonsecure_endpoint,
- gpr_slice_buffer *read_buffer, gpr_timespec deadline,
+ grpc_slice_buffer *read_buffer, gpr_timespec deadline,
grpc_security_handshake_done_cb cb, void *user_data) {
grpc_ssl_server_security_connector *c =
(grpc_ssl_server_security_connector *)sc;
@@ -642,8 +642,8 @@ static grpc_security_connector_vtable ssl_channel_vtable = {
static grpc_security_connector_vtable ssl_server_vtable = {
ssl_server_destroy, ssl_server_check_peer};
-static gpr_slice compute_default_pem_root_certs_once(void) {
- gpr_slice result = gpr_empty_slice();
+static grpc_slice compute_default_pem_root_certs_once(void) {
+ grpc_slice result = gpr_empty_slice();
/* First try to load the roots from the environment. */
char *default_root_certs_path =
@@ -656,17 +656,17 @@ static gpr_slice compute_default_pem_root_certs_once(void) {
/* Try overridden roots if needed. */
grpc_ssl_roots_override_result ovrd_res = GRPC_SSL_ROOTS_OVERRIDE_FAIL;
- if (GPR_SLICE_IS_EMPTY(result) && ssl_roots_override_cb != NULL) {
+ if (GRPC_SLICE_IS_EMPTY(result) && ssl_roots_override_cb != NULL) {
char *pem_root_certs = NULL;
ovrd_res = ssl_roots_override_cb(&pem_root_certs);
if (ovrd_res == GRPC_SSL_ROOTS_OVERRIDE_OK) {
GPR_ASSERT(pem_root_certs != NULL);
- result = gpr_slice_new(pem_root_certs, strlen(pem_root_certs), gpr_free);
+ result = grpc_slice_new(pem_root_certs, strlen(pem_root_certs), gpr_free);
}
}
/* Fall back to installed certs if needed. */
- if (GPR_SLICE_IS_EMPTY(result) &&
+ if (GRPC_SLICE_IS_EMPTY(result) &&
ovrd_res != GRPC_SSL_ROOTS_OVERRIDE_FAIL_PERMANENTLY) {
GRPC_LOG_IF_ERROR("load_file",
grpc_load_file(installed_roots_path, 0, &result));
@@ -674,13 +674,13 @@ static gpr_slice compute_default_pem_root_certs_once(void) {
return result;
}
-static gpr_slice default_pem_root_certs;
+static grpc_slice default_pem_root_certs;
static void init_default_pem_root_certs(void) {
default_pem_root_certs = compute_default_pem_root_certs_once();
}
-gpr_slice grpc_get_default_ssl_roots_for_testing(void) {
+grpc_slice grpc_get_default_ssl_roots_for_testing(void) {
return compute_default_pem_root_certs_once();
}
@@ -714,8 +714,8 @@ size_t grpc_get_default_ssl_roots(const unsigned char **pem_root_certs) {
loading all the roots once for the lifetime of the process. */
static gpr_once once = GPR_ONCE_INIT;
gpr_once_init(&once, init_default_pem_root_certs);
- *pem_root_certs = GPR_SLICE_START_PTR(default_pem_root_certs);
- return GPR_SLICE_LENGTH(default_pem_root_certs);
+ *pem_root_certs = GRPC_SLICE_START_PTR(default_pem_root_certs);
+ return GRPC_SLICE_LENGTH(default_pem_root_certs);
}
grpc_security_status grpc_ssl_channel_security_connector_create(
diff --git a/src/core/lib/security/transport/security_connector.h b/src/core/lib/security/transport/security_connector.h
index 0b5b44bf1a..dc02692b01 100644
--- a/src/core/lib/security/transport/security_connector.h
+++ b/src/core/lib/security/transport/security_connector.h
@@ -144,7 +144,7 @@ struct grpc_channel_security_connector {
void (*do_handshake)(grpc_exec_ctx *exec_ctx,
grpc_channel_security_connector *sc,
grpc_endpoint *nonsecure_endpoint,
- gpr_slice_buffer *read_buffer, gpr_timespec deadline,
+ grpc_slice_buffer *read_buffer, gpr_timespec deadline,
grpc_security_handshake_done_cb cb, void *user_data);
};
@@ -157,7 +157,7 @@ void grpc_channel_security_connector_check_call_host(
/* Handshake. */
void grpc_channel_security_connector_do_handshake(
grpc_exec_ctx *exec_ctx, grpc_channel_security_connector *connector,
- grpc_endpoint *nonsecure_endpoint, gpr_slice_buffer *read_buffer,
+ grpc_endpoint *nonsecure_endpoint, grpc_slice_buffer *read_buffer,
gpr_timespec deadline, grpc_security_handshake_done_cb cb, void *user_data);
/* --- server_security_connector object. ---
@@ -176,14 +176,14 @@ struct grpc_server_security_connector {
grpc_server_security_connector *sc,
grpc_tcp_server_acceptor *acceptor,
grpc_endpoint *nonsecure_endpoint,
- gpr_slice_buffer *read_buffer, gpr_timespec deadline,
+ grpc_slice_buffer *read_buffer, gpr_timespec deadline,
grpc_security_handshake_done_cb cb, void *user_data);
};
void grpc_server_security_connector_do_handshake(
grpc_exec_ctx *exec_ctx, grpc_server_security_connector *sc,
grpc_tcp_server_acceptor *acceptor, grpc_endpoint *nonsecure_endpoint,
- gpr_slice_buffer *read_buffer, gpr_timespec deadline,
+ grpc_slice_buffer *read_buffer, gpr_timespec deadline,
grpc_security_handshake_done_cb cb, void *user_data);
void grpc_server_security_connector_shutdown(
@@ -233,7 +233,7 @@ grpc_security_status grpc_ssl_channel_security_connector_create(
size_t grpc_get_default_ssl_roots(const unsigned char **pem_root_certs);
/* Exposed for TESTING ONLY!. */
-gpr_slice grpc_get_default_ssl_roots_for_testing(void);
+grpc_slice grpc_get_default_ssl_roots_for_testing(void);
/* Config for ssl servers. */
typedef struct {
diff --git a/src/core/lib/security/transport/server_auth_filter.c b/src/core/lib/security/transport/server_auth_filter.c
index b2c6815af8..dd465be6f5 100644
--- a/src/core/lib/security/transport/server_auth_filter.c
+++ b/src/core/lib/security/transport/server_auth_filter.c
@@ -78,7 +78,7 @@ static grpc_metadata_array metadata_batch_to_md_array(
usr_md = &result.metadata[result.count++];
usr_md->key = grpc_mdstr_as_c_string(key);
usr_md->value = grpc_mdstr_as_c_string(value);
- usr_md->value_length = GPR_SLICE_LENGTH(value->slice);
+ usr_md->value_length = GRPC_SLICE_LENGTH(value->slice);
}
return result;
}
@@ -92,14 +92,14 @@ static grpc_mdelem *remove_consumed_md(void *user_data, grpc_mdelem *md) {
/* Maybe we could do a pointer comparison but we do not have any guarantee
that the metadata processor used the same pointers for consumed_md in the
callback. */
- if (GPR_SLICE_LENGTH(md->key->slice) != strlen(consumed_md->key) ||
- GPR_SLICE_LENGTH(md->value->slice) != consumed_md->value_length) {
+ if (GRPC_SLICE_LENGTH(md->key->slice) != strlen(consumed_md->key) ||
+ GRPC_SLICE_LENGTH(md->value->slice) != consumed_md->value_length) {
continue;
}
- if (memcmp(GPR_SLICE_START_PTR(md->key->slice), consumed_md->key,
- GPR_SLICE_LENGTH(md->key->slice)) == 0 &&
- memcmp(GPR_SLICE_START_PTR(md->value->slice), consumed_md->value,
- GPR_SLICE_LENGTH(md->value->slice)) == 0) {
+ if (memcmp(GRPC_SLICE_START_PTR(md->key->slice), consumed_md->key,
+ GRPC_SLICE_LENGTH(md->key->slice)) == 0 &&
+ memcmp(GRPC_SLICE_START_PTR(md->value->slice), consumed_md->value,
+ GRPC_SLICE_LENGTH(md->value->slice)) == 0) {
return NULL; /* Delete. */
}
}
@@ -134,14 +134,14 @@ static void on_md_processing_done(
grpc_metadata_array_destroy(&calld->md);
grpc_exec_ctx_sched(&exec_ctx, calld->on_done_recv, GRPC_ERROR_NONE, NULL);
} else {
- gpr_slice message;
+ grpc_slice message;
grpc_transport_stream_op *close_op = gpr_malloc(sizeof(*close_op));
memset(close_op, 0, sizeof(*close_op));
grpc_metadata_array_destroy(&calld->md);
error_details = error_details != NULL
? error_details
: "Authentication metadata processing failed.";
- message = gpr_slice_from_copied_string(error_details);
+ message = grpc_slice_from_copied_string(error_details);
calld->transport_op->send_initial_metadata = NULL;
if (calld->transport_op->send_message != NULL) {
grpc_byte_stream_destroy(&exec_ctx, calld->transport_op->send_message);
diff --git a/src/core/lib/security/util/b64.c b/src/core/lib/security/util/b64.c
index 9da42e4e73..4892e8e621 100644
--- a/src/core/lib/security/util/b64.c
+++ b/src/core/lib/security/util/b64.c
@@ -120,7 +120,7 @@ char *grpc_base64_encode(const void *vdata, size_t data_size, int url_safe,
return result;
}
-gpr_slice grpc_base64_decode(const char *b64, int url_safe) {
+grpc_slice grpc_base64_decode(const char *b64, int url_safe) {
return grpc_base64_decode_with_len(b64, strlen(b64), url_safe);
}
@@ -182,10 +182,10 @@ static int decode_group(const unsigned char *codes, size_t num_codes,
return 1;
}
-gpr_slice grpc_base64_decode_with_len(const char *b64, size_t b64_len,
- int url_safe) {
- gpr_slice result = gpr_slice_malloc(b64_len);
- unsigned char *current = GPR_SLICE_START_PTR(result);
+grpc_slice grpc_base64_decode_with_len(const char *b64, size_t b64_len,
+ int url_safe) {
+ grpc_slice result = grpc_slice_malloc(b64_len);
+ unsigned char *current = GRPC_SLICE_START_PTR(result);
size_t result_size = 0;
unsigned char codes[4];
size_t num_codes = 0;
@@ -224,10 +224,10 @@ gpr_slice grpc_base64_decode_with_len(const char *b64, size_t b64_len,
!decode_group(codes, num_codes, current, &result_size)) {
goto fail;
}
- GPR_SLICE_SET_LENGTH(result, result_size);
+ GRPC_SLICE_SET_LENGTH(result, result_size);
return result;
fail:
- gpr_slice_unref(result);
+ grpc_slice_unref(result);
return gpr_empty_slice();
}
diff --git a/src/core/lib/security/util/b64.h b/src/core/lib/security/util/b64.h
index 6908095287..6ea0b5365b 100644
--- a/src/core/lib/security/util/b64.h
+++ b/src/core/lib/security/util/b64.h
@@ -34,7 +34,7 @@
#ifndef GRPC_CORE_LIB_SECURITY_UTIL_B64_H
#define GRPC_CORE_LIB_SECURITY_UTIL_B64_H
-#include <grpc/support/slice.h>
+#include <grpc/slice.h>
/* Encodes data using base64. It is the caller's responsability to free
the returned char * using gpr_free. Returns NULL on NULL input. */
@@ -43,10 +43,10 @@ char *grpc_base64_encode(const void *data, size_t data_size, int url_safe,
/* Decodes data according to the base64 specification. Returns an empty
slice in case of failure. */
-gpr_slice grpc_base64_decode(const char *b64, int url_safe);
+grpc_slice grpc_base64_decode(const char *b64, int url_safe);
/* Same as above except that the length is provided by the caller. */
-gpr_slice grpc_base64_decode_with_len(const char *b64, size_t b64_len,
- int url_safe);
+grpc_slice grpc_base64_decode_with_len(const char *b64, size_t b64_len,
+ int url_safe);
#endif /* GRPC_CORE_LIB_SECURITY_UTIL_B64_H */
diff --git a/src/core/lib/support/percent_encoding.c b/src/core/lib/slice/percent_encoding.c
index 3c19f264f9..b9e35f1c71 100644
--- a/src/core/lib/support/percent_encoding.c
+++ b/src/core/lib/slice/percent_encoding.c
@@ -31,15 +31,15 @@
*
*/
-#include "src/core/lib/support/percent_encoding.h"
+#include "src/core/lib/slice/percent_encoding.h"
#include <grpc/support/log.h>
-const uint8_t gpr_url_percent_encoding_unreserved_bytes[256 / 8] = {
+const uint8_t grpc_url_percent_encoding_unreserved_bytes[256 / 8] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xff, 0x03, 0xfe, 0xff, 0xff,
0x87, 0xfe, 0xff, 0xff, 0x47, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
-const uint8_t gpr_compatible_percent_encoding_unreserved_bytes[256 / 8] = {
+const uint8_t grpc_compatible_percent_encoding_unreserved_bytes[256 / 8] = {
0x00, 0x00, 0x00, 0x00, 0xdf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
@@ -49,14 +49,14 @@ static bool is_unreserved_character(uint8_t c,
return ((unreserved_bytes[c / 8] >> (c % 8)) & 1) != 0;
}
-gpr_slice gpr_percent_encode_slice(gpr_slice slice,
- const uint8_t *unreserved_bytes) {
+grpc_slice grpc_percent_encode_slice(grpc_slice slice,
+ const uint8_t *unreserved_bytes) {
static const uint8_t hex[] = "0123456789ABCDEF";
// first pass: count the number of bytes needed to output this string
size_t output_length = 0;
- const uint8_t *slice_start = GPR_SLICE_START_PTR(slice);
- const uint8_t *slice_end = GPR_SLICE_END_PTR(slice);
+ const uint8_t *slice_start = GRPC_SLICE_START_PTR(slice);
+ const uint8_t *slice_end = GRPC_SLICE_END_PTR(slice);
const uint8_t *p;
bool any_reserved_bytes = false;
for (p = slice_start; p < slice_end; p++) {
@@ -66,11 +66,11 @@ gpr_slice gpr_percent_encode_slice(gpr_slice slice,
}
// no unreserved bytes: return the string unmodified
if (!any_reserved_bytes) {
- return gpr_slice_ref(slice);
+ return grpc_slice_ref(slice);
}
// second pass: actually encode
- gpr_slice out = gpr_slice_malloc(output_length);
- uint8_t *q = GPR_SLICE_START_PTR(out);
+ grpc_slice out = grpc_slice_malloc(output_length);
+ uint8_t *q = GRPC_SLICE_START_PTR(out);
for (p = slice_start; p < slice_end; p++) {
if (is_unreserved_character(*p, unreserved_bytes)) {
*q++ = *p;
@@ -80,7 +80,7 @@ gpr_slice gpr_percent_encode_slice(gpr_slice slice,
*q++ = hex[*p & 15];
}
}
- GPR_ASSERT(q == GPR_SLICE_END_PTR(out));
+ GPR_ASSERT(q == GRPC_SLICE_END_PTR(out));
return out;
}
@@ -97,11 +97,11 @@ static uint8_t dehex(uint8_t c) {
GPR_UNREACHABLE_CODE(return 255);
}
-bool gpr_strict_percent_decode_slice(gpr_slice slice_in,
- const uint8_t *unreserved_bytes,
- gpr_slice *slice_out) {
- const uint8_t *p = GPR_SLICE_START_PTR(slice_in);
- const uint8_t *in_end = GPR_SLICE_END_PTR(slice_in);
+bool grpc_strict_percent_decode_slice(grpc_slice slice_in,
+ const uint8_t *unreserved_bytes,
+ grpc_slice *slice_out) {
+ const uint8_t *p = GRPC_SLICE_START_PTR(slice_in);
+ const uint8_t *in_end = GRPC_SLICE_END_PTR(slice_in);
size_t out_length = 0;
bool any_percent_encoded_stuff = false;
while (p != in_end) {
@@ -119,12 +119,12 @@ bool gpr_strict_percent_decode_slice(gpr_slice slice_in,
}
}
if (!any_percent_encoded_stuff) {
- *slice_out = gpr_slice_ref(slice_in);
+ *slice_out = grpc_slice_ref(slice_in);
return true;
}
- p = GPR_SLICE_START_PTR(slice_in);
- *slice_out = gpr_slice_malloc(out_length);
- uint8_t *q = GPR_SLICE_START_PTR(*slice_out);
+ p = GRPC_SLICE_START_PTR(slice_in);
+ *slice_out = grpc_slice_malloc(out_length);
+ uint8_t *q = GRPC_SLICE_START_PTR(*slice_out);
while (p != in_end) {
if (*p == '%') {
*q++ = (uint8_t)(dehex(p[1]) << 4) | (dehex(p[2]));
@@ -133,13 +133,13 @@ bool gpr_strict_percent_decode_slice(gpr_slice slice_in,
*q++ = *p++;
}
}
- GPR_ASSERT(q == GPR_SLICE_END_PTR(*slice_out));
+ GPR_ASSERT(q == GRPC_SLICE_END_PTR(*slice_out));
return true;
}
-gpr_slice gpr_permissive_percent_decode_slice(gpr_slice slice_in) {
- const uint8_t *p = GPR_SLICE_START_PTR(slice_in);
- const uint8_t *in_end = GPR_SLICE_END_PTR(slice_in);
+grpc_slice grpc_permissive_percent_decode_slice(grpc_slice slice_in) {
+ const uint8_t *p = GRPC_SLICE_START_PTR(slice_in);
+ const uint8_t *in_end = GRPC_SLICE_END_PTR(slice_in);
size_t out_length = 0;
bool any_percent_encoded_stuff = false;
while (p != in_end) {
@@ -158,11 +158,11 @@ gpr_slice gpr_permissive_percent_decode_slice(gpr_slice slice_in) {
}
}
if (!any_percent_encoded_stuff) {
- return gpr_slice_ref(slice_in);
+ return grpc_slice_ref(slice_in);
}
- p = GPR_SLICE_START_PTR(slice_in);
- gpr_slice out = gpr_slice_malloc(out_length);
- uint8_t *q = GPR_SLICE_START_PTR(out);
+ p = GRPC_SLICE_START_PTR(slice_in);
+ grpc_slice out = grpc_slice_malloc(out_length);
+ uint8_t *q = GRPC_SLICE_START_PTR(out);
while (p != in_end) {
if (*p == '%') {
if (!valid_hex(p + 1, in_end) || !valid_hex(p + 2, in_end)) {
@@ -175,6 +175,6 @@ gpr_slice gpr_permissive_percent_decode_slice(gpr_slice slice_in) {
*q++ = *p++;
}
}
- GPR_ASSERT(q == GPR_SLICE_END_PTR(out));
+ GPR_ASSERT(q == GRPC_SLICE_END_PTR(out));
return out;
}
diff --git a/src/core/lib/support/percent_encoding.h b/src/core/lib/slice/percent_encoding.h
index 000bf14ede..189bdbe312 100644
--- a/src/core/lib/support/percent_encoding.h
+++ b/src/core/lib/slice/percent_encoding.h
@@ -31,8 +31,8 @@
*
*/
-#ifndef GRPC_CORE_LIB_SUPPORT_PERCENT_ENCODING_H
-#define GRPC_CORE_LIB_SUPPORT_PERCENT_ENCODING_H
+#ifndef GRPC_CORE_LIB_SLICE_PERCENT_ENCODING_H
+#define GRPC_CORE_LIB_SLICE_PERCENT_ENCODING_H
/* Percent encoding and decoding of slices.
Transforms arbitrary strings into safe-for-transmission strings by using
@@ -43,36 +43,36 @@
#include <stdbool.h>
-#include <grpc/support/slice.h>
+#include <grpc/slice.h>
/* URL percent encoding spec bitfield (usabel as 'unreserved_bytes' in
- gpr_percent_encode_slice, gpr_strict_percent_decode_slice).
+ grpc_percent_encode_slice, grpc_strict_percent_decode_slice).
Flags [A-Za-z0-9-_.~] as unreserved bytes for the percent encoding routines
*/
-extern const uint8_t gpr_url_percent_encoding_unreserved_bytes[256 / 8];
+extern const uint8_t grpc_url_percent_encoding_unreserved_bytes[256 / 8];
/* URL percent encoding spec bitfield (usabel as 'unreserved_bytes' in
- gpr_percent_encode_slice, gpr_strict_percent_decode_slice).
+ grpc_percent_encode_slice, grpc_strict_percent_decode_slice).
Flags ascii7 non-control characters excluding '%' as unreserved bytes for the
percent encoding routines */
-extern const uint8_t gpr_compatible_percent_encoding_unreserved_bytes[256 / 8];
+extern const uint8_t grpc_compatible_percent_encoding_unreserved_bytes[256 / 8];
/* Percent-encode a slice, returning the new slice (this cannot fail):
unreserved_bytes is a bitfield indicating which bytes are considered
unreserved and thus do not need percent encoding */
-gpr_slice gpr_percent_encode_slice(gpr_slice slice,
- const uint8_t *unreserved_bytes);
+grpc_slice grpc_percent_encode_slice(grpc_slice slice,
+ const uint8_t *unreserved_bytes);
/* Percent-decode a slice, strictly.
If the input is legal (contains no unreserved bytes, and legal % encodings),
returns true and sets *slice_out to the decoded slice.
If the input is not legal, returns false and leaves *slice_out untouched.
unreserved_bytes is a bitfield indicating which bytes are considered
unreserved and thus do not need percent encoding */
-bool gpr_strict_percent_decode_slice(gpr_slice slice_in,
- const uint8_t *unreserved_bytes,
- gpr_slice *slice_out);
+bool grpc_strict_percent_decode_slice(grpc_slice slice_in,
+ const uint8_t *unreserved_bytes,
+ grpc_slice *slice_out);
/* Percent-decode a slice, permissively.
If a % triplet can not be decoded, pass it through verbatim.
This cannot fail. */
-gpr_slice gpr_permissive_percent_decode_slice(gpr_slice slice_in);
+grpc_slice grpc_permissive_percent_decode_slice(grpc_slice slice_in);
-#endif /* GRPC_CORE_LIB_SUPPORT_PERCENT_ENCODING_H */
+#endif /* GRPC_CORE_LIB_SLICE_PERCENT_ENCODING_H */
diff --git a/src/core/lib/support/slice.c b/src/core/lib/slice/slice.c
index 8a2c0a9086..3dac18df61 100644
--- a/src/core/lib/support/slice.c
+++ b/src/core/lib/slice/slice.c
@@ -31,51 +31,51 @@
*
*/
+#include <grpc/slice.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/slice.h>
#include <string.h>
-gpr_slice gpr_empty_slice(void) {
- gpr_slice out;
+grpc_slice gpr_empty_slice(void) {
+ grpc_slice out;
out.refcount = 0;
out.data.inlined.length = 0;
return out;
}
-gpr_slice gpr_slice_ref(gpr_slice slice) {
+grpc_slice grpc_slice_ref(grpc_slice slice) {
if (slice.refcount) {
slice.refcount->ref(slice.refcount);
}
return slice;
}
-void gpr_slice_unref(gpr_slice slice) {
+void grpc_slice_unref(grpc_slice slice) {
if (slice.refcount) {
slice.refcount->unref(slice.refcount);
}
}
-/* gpr_slice_from_static_string support structure - a refcount that does
+/* grpc_slice_from_static_string support structure - a refcount that does
nothing */
static void noop_ref_or_unref(void *unused) {}
-static gpr_slice_refcount noop_refcount = {noop_ref_or_unref,
- noop_ref_or_unref};
+static grpc_slice_refcount noop_refcount = {noop_ref_or_unref,
+ noop_ref_or_unref};
-gpr_slice gpr_slice_from_static_string(const char *s) {
- gpr_slice slice;
+grpc_slice grpc_slice_from_static_string(const char *s) {
+ grpc_slice slice;
slice.refcount = &noop_refcount;
slice.data.refcounted.bytes = (uint8_t *)s;
slice.data.refcounted.length = strlen(s);
return slice;
}
-/* gpr_slice_new support structures - we create a refcount object extended
+/* grpc_slice_new support structures - we create a refcount object extended
with the user provided data pointer & destroy function */
typedef struct new_slice_refcount {
- gpr_slice_refcount rc;
+ grpc_slice_refcount rc;
gpr_refcount refs;
void (*user_destroy)(void *);
void *user_data;
@@ -94,10 +94,10 @@ static void new_slice_unref(void *p) {
}
}
-gpr_slice gpr_slice_new_with_user_data(void *p, size_t len,
- void (*destroy)(void *),
- void *user_data) {
- gpr_slice slice;
+grpc_slice grpc_slice_new_with_user_data(void *p, size_t len,
+ void (*destroy)(void *),
+ void *user_data) {
+ grpc_slice slice;
new_slice_refcount *rc = gpr_malloc(sizeof(new_slice_refcount));
gpr_ref_init(&rc->refs, 1);
rc->rc.ref = new_slice_ref;
@@ -111,15 +111,15 @@ gpr_slice gpr_slice_new_with_user_data(void *p, size_t len,
return slice;
}
-gpr_slice gpr_slice_new(void *p, size_t len, void (*destroy)(void *)) {
+grpc_slice grpc_slice_new(void *p, size_t len, void (*destroy)(void *)) {
/* Pass "p" to *destroy when the slice is no longer needed. */
- return gpr_slice_new_with_user_data(p, len, destroy, p);
+ return grpc_slice_new_with_user_data(p, len, destroy, p);
}
-/* gpr_slice_new_with_len support structures - we create a refcount object
+/* grpc_slice_new_with_len support structures - we create a refcount object
extended with the user provided data pointer & destroy function */
typedef struct new_with_len_slice_refcount {
- gpr_slice_refcount rc;
+ grpc_slice_refcount rc;
gpr_refcount refs;
void *user_data;
size_t user_length;
@@ -139,9 +139,9 @@ static void new_with_len_unref(void *p) {
}
}
-gpr_slice gpr_slice_new_with_len(void *p, size_t len,
- void (*destroy)(void *, size_t)) {
- gpr_slice slice;
+grpc_slice grpc_slice_new_with_len(void *p, size_t len,
+ void (*destroy)(void *, size_t)) {
+ grpc_slice slice;
new_with_len_slice_refcount *rc =
gpr_malloc(sizeof(new_with_len_slice_refcount));
gpr_ref_init(&rc->refs, 1);
@@ -157,18 +157,18 @@ gpr_slice gpr_slice_new_with_len(void *p, size_t len,
return slice;
}
-gpr_slice gpr_slice_from_copied_buffer(const char *source, size_t length) {
- gpr_slice slice = gpr_slice_malloc(length);
- memcpy(GPR_SLICE_START_PTR(slice), source, length);
+grpc_slice grpc_slice_from_copied_buffer(const char *source, size_t length) {
+ grpc_slice slice = grpc_slice_malloc(length);
+ memcpy(GRPC_SLICE_START_PTR(slice), source, length);
return slice;
}
-gpr_slice gpr_slice_from_copied_string(const char *source) {
- return gpr_slice_from_copied_buffer(source, strlen(source));
+grpc_slice grpc_slice_from_copied_string(const char *source) {
+ return grpc_slice_from_copied_buffer(source, strlen(source));
}
typedef struct {
- gpr_slice_refcount base;
+ grpc_slice_refcount base;
gpr_refcount refs;
} malloc_refcount;
@@ -184,8 +184,8 @@ static void malloc_unref(void *p) {
}
}
-gpr_slice gpr_slice_malloc(size_t length) {
- gpr_slice slice;
+grpc_slice grpc_slice_malloc(size_t length) {
+ grpc_slice slice;
if (length > sizeof(slice.data.inlined.bytes)) {
/* Memory layout used by the slice created here:
@@ -221,8 +221,8 @@ gpr_slice gpr_slice_malloc(size_t length) {
return slice;
}
-gpr_slice gpr_slice_sub_no_ref(gpr_slice source, size_t begin, size_t end) {
- gpr_slice subset;
+grpc_slice grpc_slice_sub_no_ref(grpc_slice source, size_t begin, size_t end) {
+ grpc_slice subset;
GPR_ASSERT(end >= begin);
@@ -246,24 +246,24 @@ gpr_slice gpr_slice_sub_no_ref(gpr_slice source, size_t begin, size_t end) {
return subset;
}
-gpr_slice gpr_slice_sub(gpr_slice source, size_t begin, size_t end) {
- gpr_slice subset;
+grpc_slice grpc_slice_sub(grpc_slice source, size_t begin, size_t end) {
+ grpc_slice subset;
if (end - begin <= sizeof(subset.data.inlined.bytes)) {
subset.refcount = NULL;
subset.data.inlined.length = (uint8_t)(end - begin);
- memcpy(subset.data.inlined.bytes, GPR_SLICE_START_PTR(source) + begin,
+ memcpy(subset.data.inlined.bytes, GRPC_SLICE_START_PTR(source) + begin,
end - begin);
} else {
- subset = gpr_slice_sub_no_ref(source, begin, end);
+ subset = grpc_slice_sub_no_ref(source, begin, end);
/* Bump the refcount */
subset.refcount->ref(subset.refcount);
}
return subset;
}
-gpr_slice gpr_slice_split_tail(gpr_slice *source, size_t split) {
- gpr_slice tail;
+grpc_slice grpc_slice_split_tail(grpc_slice *source, size_t split) {
+ grpc_slice tail;
if (source->refcount == NULL) {
/* inlined data, copy it out */
@@ -297,8 +297,8 @@ gpr_slice gpr_slice_split_tail(gpr_slice *source, size_t split) {
return tail;
}
-gpr_slice gpr_slice_split_head(gpr_slice *source, size_t split) {
- gpr_slice head;
+grpc_slice grpc_slice_split_head(grpc_slice *source, size_t split) {
+ grpc_slice head;
if (source->refcount == NULL) {
GPR_ASSERT(source->data.inlined.length >= split);
@@ -335,16 +335,16 @@ gpr_slice gpr_slice_split_head(gpr_slice *source, size_t split) {
return head;
}
-int gpr_slice_cmp(gpr_slice a, gpr_slice b) {
- int d = (int)(GPR_SLICE_LENGTH(a) - GPR_SLICE_LENGTH(b));
+int grpc_slice_cmp(grpc_slice a, grpc_slice b) {
+ int d = (int)(GRPC_SLICE_LENGTH(a) - GRPC_SLICE_LENGTH(b));
if (d != 0) return d;
- return memcmp(GPR_SLICE_START_PTR(a), GPR_SLICE_START_PTR(b),
- GPR_SLICE_LENGTH(a));
+ return memcmp(GRPC_SLICE_START_PTR(a), GRPC_SLICE_START_PTR(b),
+ GRPC_SLICE_LENGTH(a));
}
-int gpr_slice_str_cmp(gpr_slice a, const char *b) {
+int grpc_slice_str_cmp(grpc_slice a, const char *b) {
size_t b_length = strlen(b);
- int d = (int)(GPR_SLICE_LENGTH(a) - b_length);
+ int d = (int)(GRPC_SLICE_LENGTH(a) - b_length);
if (d != 0) return d;
- return memcmp(GPR_SLICE_START_PTR(a), b, b_length);
+ return memcmp(GRPC_SLICE_START_PTR(a), b, b_length);
}
diff --git a/src/core/lib/support/slice_buffer.c b/src/core/lib/slice/slice_buffer.c
index 66f111d767..990ef128bd 100644
--- a/src/core/lib/support/slice_buffer.c
+++ b/src/core/lib/slice/slice_buffer.c
@@ -31,8 +31,8 @@
*
*/
+#include <grpc/slice_buffer.h>
#include <grpc/support/port_platform.h>
-#include <grpc/support/slice_buffer.h>
#include <string.h>
@@ -43,35 +43,35 @@
/* grow a buffer; requires GRPC_SLICE_BUFFER_INLINE_ELEMENTS > 1 */
#define GROW(x) (3 * (x) / 2)
-static void maybe_embiggen(gpr_slice_buffer *sb) {
+static void maybe_embiggen(grpc_slice_buffer *sb) {
if (sb->count == sb->capacity) {
sb->capacity = GROW(sb->capacity);
GPR_ASSERT(sb->capacity > sb->count);
if (sb->slices == sb->inlined) {
- sb->slices = gpr_malloc(sb->capacity * sizeof(gpr_slice));
- memcpy(sb->slices, sb->inlined, sb->count * sizeof(gpr_slice));
+ sb->slices = gpr_malloc(sb->capacity * sizeof(grpc_slice));
+ memcpy(sb->slices, sb->inlined, sb->count * sizeof(grpc_slice));
} else {
- sb->slices = gpr_realloc(sb->slices, sb->capacity * sizeof(gpr_slice));
+ sb->slices = gpr_realloc(sb->slices, sb->capacity * sizeof(grpc_slice));
}
}
}
-void gpr_slice_buffer_init(gpr_slice_buffer *sb) {
+void grpc_slice_buffer_init(grpc_slice_buffer *sb) {
sb->count = 0;
sb->length = 0;
sb->capacity = GRPC_SLICE_BUFFER_INLINE_ELEMENTS;
sb->slices = sb->inlined;
}
-void gpr_slice_buffer_destroy(gpr_slice_buffer *sb) {
- gpr_slice_buffer_reset_and_unref(sb);
+void grpc_slice_buffer_destroy(grpc_slice_buffer *sb) {
+ grpc_slice_buffer_reset_and_unref(sb);
if (sb->slices != sb->inlined) {
gpr_free(sb->slices);
}
}
-uint8_t *gpr_slice_buffer_tiny_add(gpr_slice_buffer *sb, size_t n) {
- gpr_slice *back;
+uint8_t *grpc_slice_buffer_tiny_add(grpc_slice_buffer *sb, size_t n) {
+ grpc_slice *back;
uint8_t *out;
sb->length += n;
@@ -94,16 +94,16 @@ add_new:
return back->data.inlined.bytes;
}
-size_t gpr_slice_buffer_add_indexed(gpr_slice_buffer *sb, gpr_slice s) {
+size_t grpc_slice_buffer_add_indexed(grpc_slice_buffer *sb, grpc_slice s) {
size_t out = sb->count;
maybe_embiggen(sb);
sb->slices[out] = s;
- sb->length += GPR_SLICE_LENGTH(s);
+ sb->length += GRPC_SLICE_LENGTH(s);
sb->count = out + 1;
return out;
}
-void gpr_slice_buffer_add(gpr_slice_buffer *sb, gpr_slice s) {
+void grpc_slice_buffer_add(grpc_slice_buffer *sb, grpc_slice s) {
size_t n = sb->count;
/* if both the last slice in the slice buffer and the slice being added
are inlined (that is, that they carry their data inside the slice data
@@ -111,19 +111,20 @@ void gpr_slice_buffer_add(gpr_slice_buffer *sb, gpr_slice s) {
into the back slice, preventing many small slices being passed into
writes */
if (!s.refcount && n) {
- gpr_slice *back = &sb->slices[n - 1];
- if (!back->refcount && back->data.inlined.length < GPR_SLICE_INLINED_SIZE) {
+ grpc_slice *back = &sb->slices[n - 1];
+ if (!back->refcount &&
+ back->data.inlined.length < GRPC_SLICE_INLINED_SIZE) {
if (s.data.inlined.length + back->data.inlined.length <=
- GPR_SLICE_INLINED_SIZE) {
+ GRPC_SLICE_INLINED_SIZE) {
memcpy(back->data.inlined.bytes + back->data.inlined.length,
s.data.inlined.bytes, s.data.inlined.length);
back->data.inlined.length =
(uint8_t)(back->data.inlined.length + s.data.inlined.length);
} else {
- size_t cp1 = GPR_SLICE_INLINED_SIZE - back->data.inlined.length;
+ size_t cp1 = GRPC_SLICE_INLINED_SIZE - back->data.inlined.length;
memcpy(back->data.inlined.bytes + back->data.inlined.length,
s.data.inlined.bytes, cp1);
- back->data.inlined.length = GPR_SLICE_INLINED_SIZE;
+ back->data.inlined.length = GRPC_SLICE_INLINED_SIZE;
maybe_embiggen(sb);
back = &sb->slices[n];
sb->count = n + 1;
@@ -136,35 +137,35 @@ void gpr_slice_buffer_add(gpr_slice_buffer *sb, gpr_slice s) {
return; /* early out */
}
}
- gpr_slice_buffer_add_indexed(sb, s);
+ grpc_slice_buffer_add_indexed(sb, s);
}
-void gpr_slice_buffer_addn(gpr_slice_buffer *sb, gpr_slice *s, size_t n) {
+void grpc_slice_buffer_addn(grpc_slice_buffer *sb, grpc_slice *s, size_t n) {
size_t i;
for (i = 0; i < n; i++) {
- gpr_slice_buffer_add(sb, s[i]);
+ grpc_slice_buffer_add(sb, s[i]);
}
}
-void gpr_slice_buffer_pop(gpr_slice_buffer *sb) {
+void grpc_slice_buffer_pop(grpc_slice_buffer *sb) {
if (sb->count != 0) {
size_t count = --sb->count;
- sb->length -= GPR_SLICE_LENGTH(sb->slices[count]);
+ sb->length -= GRPC_SLICE_LENGTH(sb->slices[count]);
}
}
-void gpr_slice_buffer_reset_and_unref(gpr_slice_buffer *sb) {
+void grpc_slice_buffer_reset_and_unref(grpc_slice_buffer *sb) {
size_t i;
for (i = 0; i < sb->count; i++) {
- gpr_slice_unref(sb->slices[i]);
+ grpc_slice_unref(sb->slices[i]);
}
sb->count = 0;
sb->length = 0;
}
-void gpr_slice_buffer_swap(gpr_slice_buffer *a, gpr_slice_buffer *b) {
+void grpc_slice_buffer_swap(grpc_slice_buffer *a, grpc_slice_buffer *b) {
GPR_SWAP(size_t, a->count, b->count);
GPR_SWAP(size_t, a->capacity, b->capacity);
GPR_SWAP(size_t, a->length, b->length);
@@ -172,111 +173,112 @@ void gpr_slice_buffer_swap(gpr_slice_buffer *a, gpr_slice_buffer *b) {
if (a->slices == a->inlined) {
if (b->slices == b->inlined) {
/* swap contents of inlined buffer */
- gpr_slice temp[GRPC_SLICE_BUFFER_INLINE_ELEMENTS];
- memcpy(temp, a->slices, b->count * sizeof(gpr_slice));
- memcpy(a->slices, b->slices, a->count * sizeof(gpr_slice));
- memcpy(b->slices, temp, b->count * sizeof(gpr_slice));
+ grpc_slice temp[GRPC_SLICE_BUFFER_INLINE_ELEMENTS];
+ memcpy(temp, a->slices, b->count * sizeof(grpc_slice));
+ memcpy(a->slices, b->slices, a->count * sizeof(grpc_slice));
+ memcpy(b->slices, temp, b->count * sizeof(grpc_slice));
} else {
/* a is inlined, b is not - copy a inlined into b, fix pointers */
a->slices = b->slices;
b->slices = b->inlined;
- memcpy(b->slices, a->inlined, b->count * sizeof(gpr_slice));
+ memcpy(b->slices, a->inlined, b->count * sizeof(grpc_slice));
}
} else if (b->slices == b->inlined) {
/* b is inlined, a is not - copy b inlined int a, fix pointers */
b->slices = a->slices;
a->slices = a->inlined;
- memcpy(a->slices, b->inlined, a->count * sizeof(gpr_slice));
+ memcpy(a->slices, b->inlined, a->count * sizeof(grpc_slice));
} else {
/* no inlining: easy swap */
- GPR_SWAP(gpr_slice *, a->slices, b->slices);
+ GPR_SWAP(grpc_slice *, a->slices, b->slices);
}
}
-void gpr_slice_buffer_move_into(gpr_slice_buffer *src, gpr_slice_buffer *dst) {
+void grpc_slice_buffer_move_into(grpc_slice_buffer *src,
+ grpc_slice_buffer *dst) {
/* anything to move? */
if (src->count == 0) {
return;
}
/* anything in dst? */
if (dst->count == 0) {
- gpr_slice_buffer_swap(src, dst);
+ grpc_slice_buffer_swap(src, dst);
return;
}
/* both buffers have data - copy, and reset src */
- gpr_slice_buffer_addn(dst, src->slices, src->count);
+ grpc_slice_buffer_addn(dst, src->slices, src->count);
src->count = 0;
src->length = 0;
}
-void gpr_slice_buffer_move_first(gpr_slice_buffer *src, size_t n,
- gpr_slice_buffer *dst) {
+void grpc_slice_buffer_move_first(grpc_slice_buffer *src, size_t n,
+ grpc_slice_buffer *dst) {
size_t src_idx;
size_t output_len = dst->length + n;
size_t new_input_len = src->length - n;
GPR_ASSERT(src->length >= n);
if (src->length == n) {
- gpr_slice_buffer_move_into(src, dst);
+ grpc_slice_buffer_move_into(src, dst);
return;
}
src_idx = 0;
while (src_idx < src->capacity) {
- gpr_slice slice = src->slices[src_idx];
- size_t slice_len = GPR_SLICE_LENGTH(slice);
+ grpc_slice slice = src->slices[src_idx];
+ size_t slice_len = GRPC_SLICE_LENGTH(slice);
if (n > slice_len) {
- gpr_slice_buffer_add(dst, slice);
+ grpc_slice_buffer_add(dst, slice);
n -= slice_len;
src_idx++;
} else if (n == slice_len) {
- gpr_slice_buffer_add(dst, slice);
+ grpc_slice_buffer_add(dst, slice);
src_idx++;
break;
} else { /* n < slice_len */
- src->slices[src_idx] = gpr_slice_split_tail(&slice, n);
- GPR_ASSERT(GPR_SLICE_LENGTH(slice) == n);
- GPR_ASSERT(GPR_SLICE_LENGTH(src->slices[src_idx]) == slice_len - n);
- gpr_slice_buffer_add(dst, slice);
+ src->slices[src_idx] = grpc_slice_split_tail(&slice, n);
+ GPR_ASSERT(GRPC_SLICE_LENGTH(slice) == n);
+ GPR_ASSERT(GRPC_SLICE_LENGTH(src->slices[src_idx]) == slice_len - n);
+ grpc_slice_buffer_add(dst, slice);
break;
}
}
GPR_ASSERT(dst->length == output_len);
memmove(src->slices, src->slices + src_idx,
- sizeof(gpr_slice) * (src->count - src_idx));
+ sizeof(grpc_slice) * (src->count - src_idx));
src->count -= src_idx;
src->length = new_input_len;
GPR_ASSERT(src->count > 0);
}
-void gpr_slice_buffer_trim_end(gpr_slice_buffer *sb, size_t n,
- gpr_slice_buffer *garbage) {
+void grpc_slice_buffer_trim_end(grpc_slice_buffer *sb, size_t n,
+ grpc_slice_buffer *garbage) {
GPR_ASSERT(n <= sb->length);
sb->length -= n;
for (;;) {
size_t idx = sb->count - 1;
- gpr_slice slice = sb->slices[idx];
- size_t slice_len = GPR_SLICE_LENGTH(slice);
+ grpc_slice slice = sb->slices[idx];
+ size_t slice_len = GRPC_SLICE_LENGTH(slice);
if (slice_len > n) {
- sb->slices[idx] = gpr_slice_split_head(&slice, slice_len - n);
- gpr_slice_buffer_add_indexed(garbage, slice);
+ sb->slices[idx] = grpc_slice_split_head(&slice, slice_len - n);
+ grpc_slice_buffer_add_indexed(garbage, slice);
return;
} else if (slice_len == n) {
- gpr_slice_buffer_add_indexed(garbage, slice);
+ grpc_slice_buffer_add_indexed(garbage, slice);
sb->count = idx;
return;
} else {
- gpr_slice_buffer_add_indexed(garbage, slice);
+ grpc_slice_buffer_add_indexed(garbage, slice);
n -= slice_len;
sb->count = idx;
}
}
}
-gpr_slice gpr_slice_buffer_take_first(gpr_slice_buffer *sb) {
- gpr_slice slice;
+grpc_slice grpc_slice_buffer_take_first(grpc_slice_buffer *sb) {
+ grpc_slice slice;
GPR_ASSERT(sb->count > 0);
slice = sb->slices[0];
- memmove(&sb->slices[0], &sb->slices[1], (sb->count - 1) * sizeof(gpr_slice));
+ memmove(&sb->slices[0], &sb->slices[1], (sb->count - 1) * sizeof(grpc_slice));
sb->count--;
- sb->length -= GPR_SLICE_LENGTH(slice);
+ sb->length -= GRPC_SLICE_LENGTH(slice);
return slice;
}
diff --git a/src/core/lib/slice/slice_string_helpers.c b/src/core/lib/slice/slice_string_helpers.c
new file mode 100644
index 0000000000..4731762ece
--- /dev/null
+++ b/src/core/lib/slice/slice_string_helpers.c
@@ -0,0 +1,89 @@
+/*
+ *
+ * Copyright 2015, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include "src/core/lib/slice/slice_string_helpers.h"
+
+#include <string.h>
+
+#include <grpc/support/log.h>
+
+#include "src/core/lib/support/string.h"
+
+char *grpc_dump_slice(grpc_slice s, uint32_t flags) {
+ return gpr_dump((const char *)GRPC_SLICE_START_PTR(s), GRPC_SLICE_LENGTH(s),
+ flags);
+}
+
+/** Finds the initial (\a begin) and final (\a end) offsets of the next
+ * substring from \a str + \a read_offset until the next \a sep or the end of \a
+ * str.
+ *
+ * Returns 1 and updates \a begin and \a end. Returns 0 otherwise. */
+static int slice_find_separator_offset(const grpc_slice str, const char *sep,
+ const size_t read_offset, size_t *begin,
+ size_t *end) {
+ size_t i;
+ const uint8_t *str_ptr = GRPC_SLICE_START_PTR(str) + read_offset;
+ const size_t str_len = GRPC_SLICE_LENGTH(str) - read_offset;
+ const size_t sep_len = strlen(sep);
+ if (str_len < sep_len) {
+ return 0;
+ }
+
+ for (i = 0; i <= str_len - sep_len; i++) {
+ if (memcmp(str_ptr + i, sep, sep_len) == 0) {
+ *begin = read_offset;
+ *end = read_offset + i;
+ return 1;
+ }
+ }
+ return 0;
+}
+
+void grpc_slice_split(grpc_slice str, const char *sep, grpc_slice_buffer *dst) {
+ const size_t sep_len = strlen(sep);
+ size_t begin, end;
+
+ GPR_ASSERT(sep_len > 0);
+
+ if (slice_find_separator_offset(str, sep, 0, &begin, &end) != 0) {
+ do {
+ grpc_slice_buffer_add_indexed(dst, grpc_slice_sub(str, begin, end));
+ } while (slice_find_separator_offset(str, sep, end + sep_len, &begin,
+ &end) != 0);
+ grpc_slice_buffer_add_indexed(
+ dst, grpc_slice_sub(str, end + sep_len, GRPC_SLICE_LENGTH(str)));
+ } else { /* no sep found, add whole input */
+ grpc_slice_buffer_add_indexed(dst, grpc_slice_ref(str));
+ }
+}
diff --git a/src/core/lib/slice/slice_string_helpers.h b/src/core/lib/slice/slice_string_helpers.h
new file mode 100644
index 0000000000..151c720777
--- /dev/null
+++ b/src/core/lib/slice/slice_string_helpers.h
@@ -0,0 +1,58 @@
+/*
+ *
+ * Copyright 2015, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef GRPC_CORE_LIB_SLICE_SLICE_STRING_HELPERS_H
+#define GRPC_CORE_LIB_SLICE_SLICE_STRING_HELPERS_H
+
+#include <stddef.h>
+
+#include <grpc/slice.h>
+#include <grpc/slice_buffer.h>
+#include <grpc/support/port_platform.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Calls gpr_dump on a slice. */
+char *grpc_dump_slice(grpc_slice slice, uint32_t flags);
+
+/** Split \a str by the separator \a sep. Results are stored in \a dst, which
+ * should be a properly initialized instance. */
+void grpc_slice_split(grpc_slice str, const char *sep, grpc_slice_buffer *dst);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* GRPC_CORE_LIB_SLICE_SLICE_STRING_HELPERS_H */
diff --git a/src/core/lib/support/env.h b/src/core/lib/support/env.h
index ec3959bc6e..6ada5d9390 100644
--- a/src/core/lib/support/env.h
+++ b/src/core/lib/support/env.h
@@ -36,8 +36,6 @@
#include <stdio.h>
-#include <grpc/support/slice.h>
-
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/src/core/lib/support/string.c b/src/core/lib/support/string.c
index d17fb9da4b..dc243bf0bf 100644
--- a/src/core/lib/support/string.c
+++ b/src/core/lib/support/string.c
@@ -120,11 +120,6 @@ char *gpr_dump(const char *buf, size_t len, uint32_t flags) {
return out.data;
}
-char *gpr_dump_slice(gpr_slice s, uint32_t flags) {
- return gpr_dump((const char *)GPR_SLICE_START_PTR(s), GPR_SLICE_LENGTH(s),
- flags);
-}
-
int gpr_parse_bytes_to_uint32(const char *buf, size_t len, uint32_t *result) {
uint32_t out = 0;
uint32_t new;
@@ -239,50 +234,6 @@ char *gpr_strjoin_sep(const char **strs, size_t nstrs, const char *sep,
return out;
}
-/** Finds the initial (\a begin) and final (\a end) offsets of the next
- * substring from \a str + \a read_offset until the next \a sep or the end of \a
- * str.
- *
- * Returns 1 and updates \a begin and \a end. Returns 0 otherwise. */
-static int slice_find_separator_offset(const gpr_slice str, const char *sep,
- const size_t read_offset, size_t *begin,
- size_t *end) {
- size_t i;
- const uint8_t *str_ptr = GPR_SLICE_START_PTR(str) + read_offset;
- const size_t str_len = GPR_SLICE_LENGTH(str) - read_offset;
- const size_t sep_len = strlen(sep);
- if (str_len < sep_len) {
- return 0;
- }
-
- for (i = 0; i <= str_len - sep_len; i++) {
- if (memcmp(str_ptr + i, sep, sep_len) == 0) {
- *begin = read_offset;
- *end = read_offset + i;
- return 1;
- }
- }
- return 0;
-}
-
-void gpr_slice_split(gpr_slice str, const char *sep, gpr_slice_buffer *dst) {
- const size_t sep_len = strlen(sep);
- size_t begin, end;
-
- GPR_ASSERT(sep_len > 0);
-
- if (slice_find_separator_offset(str, sep, 0, &begin, &end) != 0) {
- do {
- gpr_slice_buffer_add_indexed(dst, gpr_slice_sub(str, begin, end));
- } while (slice_find_separator_offset(str, sep, end + sep_len, &begin,
- &end) != 0);
- gpr_slice_buffer_add_indexed(
- dst, gpr_slice_sub(str, end + sep_len, GPR_SLICE_LENGTH(str)));
- } else { /* no sep found, add whole input */
- gpr_slice_buffer_add_indexed(dst, gpr_slice_ref(str));
- }
-}
-
void gpr_strvec_init(gpr_strvec *sv) { memset(sv, 0, sizeof(*sv)); }
void gpr_strvec_destroy(gpr_strvec *sv) {
diff --git a/src/core/lib/support/string.h b/src/core/lib/support/string.h
index 9a94e9471c..13891d0b9e 100644
--- a/src/core/lib/support/string.h
+++ b/src/core/lib/support/string.h
@@ -36,9 +36,9 @@
#include <stddef.h>
+#include <grpc/slice.h>
+#include <grpc/slice_buffer.h>
#include <grpc/support/port_platform.h>
-#include <grpc/support/slice.h>
-#include <grpc/support/slice_buffer.h>
#ifdef __cplusplus
extern "C" {
@@ -54,9 +54,6 @@ extern "C" {
Result should be freed with gpr_free() */
char *gpr_dump(const char *buf, size_t len, uint32_t flags);
-/* Calls gpr_dump on a slice. */
-char *gpr_dump_slice(gpr_slice slice, uint32_t flags);
-
/* Parses an array of bytes into an integer (base 10). Returns 1 on success,
0 on failure. */
int gpr_parse_bytes_to_uint32(const char *data, size_t length,
@@ -98,10 +95,6 @@ char *gpr_strjoin(const char **strs, size_t nstrs, size_t *total_length);
char *gpr_strjoin_sep(const char **strs, size_t nstrs, const char *sep,
size_t *total_length);
-/** Split \a str by the separator \a sep. Results are stored in \a dst, which
- * should be a properly initialized instance. */
-void gpr_slice_split(gpr_slice str, const char *sep, gpr_slice_buffer *dst);
-
/* A vector of strings... for building up a final string one piece at a time */
typedef struct {
char **strs;
diff --git a/src/core/lib/support/tmpfile.h b/src/core/lib/support/tmpfile.h
index 059142ab0f..8952e5ec3d 100644
--- a/src/core/lib/support/tmpfile.h
+++ b/src/core/lib/support/tmpfile.h
@@ -36,7 +36,7 @@
#include <stdio.h>
-#include <grpc/support/slice.h>
+#include <grpc/slice.h>
#ifdef __cplusplus
extern "C" {
diff --git a/src/core/lib/surface/byte_buffer.c b/src/core/lib/surface/byte_buffer.c
index 054a6e6c58..d646591a65 100644
--- a/src/core/lib/surface/byte_buffer.c
+++ b/src/core/lib/surface/byte_buffer.c
@@ -35,22 +35,23 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-grpc_byte_buffer *grpc_raw_byte_buffer_create(gpr_slice *slices,
+grpc_byte_buffer *grpc_raw_byte_buffer_create(grpc_slice *slices,
size_t nslices) {
return grpc_raw_compressed_byte_buffer_create(slices, nslices,
GRPC_COMPRESS_NONE);
}
grpc_byte_buffer *grpc_raw_compressed_byte_buffer_create(
- gpr_slice *slices, size_t nslices, grpc_compression_algorithm compression) {
+ grpc_slice *slices, size_t nslices,
+ grpc_compression_algorithm compression) {
size_t i;
grpc_byte_buffer *bb = gpr_malloc(sizeof(grpc_byte_buffer));
bb->type = GRPC_BB_RAW;
bb->data.raw.compression = compression;
- gpr_slice_buffer_init(&bb->data.raw.slice_buffer);
+ grpc_slice_buffer_init(&bb->data.raw.slice_buffer);
for (i = 0; i < nslices; i++) {
- gpr_slice_ref(slices[i]);
- gpr_slice_buffer_add(&bb->data.raw.slice_buffer, slices[i]);
+ grpc_slice_ref(slices[i]);
+ grpc_slice_buffer_add(&bb->data.raw.slice_buffer, slices[i]);
}
return bb;
}
@@ -58,13 +59,13 @@ grpc_byte_buffer *grpc_raw_compressed_byte_buffer_create(
grpc_byte_buffer *grpc_raw_byte_buffer_from_reader(
grpc_byte_buffer_reader *reader) {
grpc_byte_buffer *bb = gpr_malloc(sizeof(grpc_byte_buffer));
- gpr_slice slice;
+ grpc_slice slice;
bb->type = GRPC_BB_RAW;
bb->data.raw.compression = GRPC_COMPRESS_NONE;
- gpr_slice_buffer_init(&bb->data.raw.slice_buffer);
+ grpc_slice_buffer_init(&bb->data.raw.slice_buffer);
while (grpc_byte_buffer_reader_next(reader, &slice)) {
- gpr_slice_buffer_add(&bb->data.raw.slice_buffer, slice);
+ grpc_slice_buffer_add(&bb->data.raw.slice_buffer, slice);
}
return bb;
}
@@ -83,7 +84,7 @@ void grpc_byte_buffer_destroy(grpc_byte_buffer *bb) {
if (!bb) return;
switch (bb->type) {
case GRPC_BB_RAW:
- gpr_slice_buffer_destroy(&bb->data.raw.slice_buffer);
+ grpc_slice_buffer_destroy(&bb->data.raw.slice_buffer);
break;
}
gpr_free(bb);
diff --git a/src/core/lib/surface/byte_buffer_reader.c b/src/core/lib/surface/byte_buffer_reader.c
index 310bacb2c9..0089959fbb 100644
--- a/src/core/lib/surface/byte_buffer_reader.c
+++ b/src/core/lib/surface/byte_buffer_reader.c
@@ -37,9 +37,9 @@
#include <grpc/byte_buffer.h>
#include <grpc/compression.h>
#include <grpc/grpc.h>
+#include <grpc/slice_buffer.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/slice_buffer.h>
#include "src/core/lib/compression/message_compress.h"
@@ -56,11 +56,11 @@ static int is_compressed(grpc_byte_buffer *buffer) {
int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader *reader,
grpc_byte_buffer *buffer) {
- gpr_slice_buffer decompressed_slices_buffer;
+ grpc_slice_buffer decompressed_slices_buffer;
reader->buffer_in = buffer;
switch (reader->buffer_in->type) {
case GRPC_BB_RAW:
- gpr_slice_buffer_init(&decompressed_slices_buffer);
+ grpc_slice_buffer_init(&decompressed_slices_buffer);
if (is_compressed(reader->buffer_in)) {
if (grpc_msg_decompress(reader->buffer_in->data.raw.compression,
&reader->buffer_in->data.raw.slice_buffer,
@@ -76,7 +76,7 @@ int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader *reader,
grpc_raw_byte_buffer_create(decompressed_slices_buffer.slices,
decompressed_slices_buffer.count);
}
- gpr_slice_buffer_destroy(&decompressed_slices_buffer);
+ grpc_slice_buffer_destroy(&decompressed_slices_buffer);
} else { /* not compressed, use the input buffer as output */
reader->buffer_out = reader->buffer_in;
}
@@ -98,13 +98,13 @@ void grpc_byte_buffer_reader_destroy(grpc_byte_buffer_reader *reader) {
}
int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader *reader,
- gpr_slice *slice) {
+ grpc_slice *slice) {
switch (reader->buffer_in->type) {
case GRPC_BB_RAW: {
- gpr_slice_buffer *slice_buffer;
+ grpc_slice_buffer *slice_buffer;
slice_buffer = &reader->buffer_out->data.raw.slice_buffer;
if (reader->current.index < slice_buffer->count) {
- *slice = gpr_slice_ref(slice_buffer->slices[reader->current.index]);
+ *slice = grpc_slice_ref(slice_buffer->slices[reader->current.index]);
reader->current.index += 1;
return 1;
}
@@ -114,18 +114,18 @@ int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader *reader,
return 0;
}
-gpr_slice grpc_byte_buffer_reader_readall(grpc_byte_buffer_reader *reader) {
- gpr_slice in_slice;
+grpc_slice grpc_byte_buffer_reader_readall(grpc_byte_buffer_reader *reader) {
+ grpc_slice in_slice;
size_t bytes_read = 0;
const size_t input_size = grpc_byte_buffer_length(reader->buffer_out);
- gpr_slice out_slice = gpr_slice_malloc(input_size);
- uint8_t *const outbuf = GPR_SLICE_START_PTR(out_slice); /* just an alias */
+ grpc_slice out_slice = grpc_slice_malloc(input_size);
+ uint8_t *const outbuf = GRPC_SLICE_START_PTR(out_slice); /* just an alias */
while (grpc_byte_buffer_reader_next(reader, &in_slice) != 0) {
- const size_t slice_length = GPR_SLICE_LENGTH(in_slice);
- memcpy(&(outbuf[bytes_read]), GPR_SLICE_START_PTR(in_slice), slice_length);
+ const size_t slice_length = GRPC_SLICE_LENGTH(in_slice);
+ memcpy(&(outbuf[bytes_read]), GRPC_SLICE_START_PTR(in_slice), slice_length);
bytes_read += slice_length;
- gpr_slice_unref(in_slice);
+ grpc_slice_unref(in_slice);
GPR_ASSERT(bytes_read <= input_size);
}
return out_slice;
diff --git a/src/core/lib/surface/call.c b/src/core/lib/surface/call.c
index e3b088f663..eafcba22fc 100644
--- a/src/core/lib/surface/call.c
+++ b/src/core/lib/surface/call.c
@@ -39,9 +39,9 @@
#include <grpc/compression.h>
#include <grpc/grpc.h>
+#include <grpc/slice.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/slice.h>
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
@@ -49,6 +49,7 @@
#include "src/core/lib/compression/algorithm_metadata.h"
#include "src/core/lib/iomgr/timer.h"
#include "src/core/lib/profiling/timers.h"
+#include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/lib/support/string.h"
#include "src/core/lib/surface/api_trace.h"
#include "src/core/lib/surface/call.h"
@@ -184,7 +185,7 @@ struct grpc_call {
grpc_slice_buffer_stream sending_stream;
grpc_byte_stream *receiving_stream;
grpc_byte_buffer **receiving_buffer;
- gpr_slice receiving_slice;
+ grpc_slice receiving_slice;
grpc_closure receiving_slice_ready;
grpc_closure receiving_stream_ready;
grpc_closure receiving_initial_metadata_ready;
@@ -493,8 +494,8 @@ static void destroy_encodings_accepted_by_peer(void *p) { return; }
static void set_encodings_accepted_by_peer(grpc_call *call, grpc_mdelem *mdel) {
size_t i;
grpc_compression_algorithm algorithm;
- gpr_slice_buffer accept_encoding_parts;
- gpr_slice accept_encoding_slice;
+ grpc_slice_buffer accept_encoding_parts;
+ grpc_slice accept_encoding_slice;
void *accepted_user_data;
accepted_user_data =
@@ -506,23 +507,23 @@ static void set_encodings_accepted_by_peer(grpc_call *call, grpc_mdelem *mdel) {
}
accept_encoding_slice = mdel->value->slice;
- gpr_slice_buffer_init(&accept_encoding_parts);
- gpr_slice_split(accept_encoding_slice, ",", &accept_encoding_parts);
+ grpc_slice_buffer_init(&accept_encoding_parts);
+ grpc_slice_split(accept_encoding_slice, ",", &accept_encoding_parts);
/* No need to zero call->encodings_accepted_by_peer: grpc_call_create already
* zeroes the whole grpc_call */
/* Always support no compression */
GPR_BITSET(&call->encodings_accepted_by_peer, GRPC_COMPRESS_NONE);
for (i = 0; i < accept_encoding_parts.count; i++) {
- const gpr_slice *accept_encoding_entry_slice =
+ const grpc_slice *accept_encoding_entry_slice =
&accept_encoding_parts.slices[i];
if (grpc_compression_algorithm_parse(
- (const char *)GPR_SLICE_START_PTR(*accept_encoding_entry_slice),
- GPR_SLICE_LENGTH(*accept_encoding_entry_slice), &algorithm)) {
+ (const char *)GRPC_SLICE_START_PTR(*accept_encoding_entry_slice),
+ GRPC_SLICE_LENGTH(*accept_encoding_entry_slice), &algorithm)) {
GPR_BITSET(&call->encodings_accepted_by_peer, algorithm);
} else {
char *accept_encoding_entry_str =
- gpr_dump_slice(*accept_encoding_entry_slice, GPR_DUMP_ASCII);
+ grpc_dump_slice(*accept_encoding_entry_slice, GPR_DUMP_ASCII);
gpr_log(GPR_ERROR,
"Invalid entry in accept encoding metadata: '%s'. Ignoring.",
accept_encoding_entry_str);
@@ -530,7 +531,7 @@ static void set_encodings_accepted_by_peer(grpc_call *call, grpc_mdelem *mdel) {
}
}
- gpr_slice_buffer_destroy(&accept_encoding_parts);
+ grpc_slice_buffer_destroy(&accept_encoding_parts);
grpc_mdelem_set_user_data(
mdel, destroy_encodings_accepted_by_peer,
@@ -551,14 +552,14 @@ static void get_final_details(grpc_call *call, char **out_details,
for (i = 0; i < STATUS_SOURCE_COUNT; i++) {
if (call->status[i].is_set) {
if (call->status[i].details) {
- gpr_slice details = call->status[i].details->slice;
- size_t len = GPR_SLICE_LENGTH(details);
+ grpc_slice details = call->status[i].details->slice;
+ size_t len = GRPC_SLICE_LENGTH(details);
if (len + 1 > *out_details_capacity) {
*out_details_capacity =
GPR_MAX(len + 1, *out_details_capacity * 3 / 2);
*out_details = gpr_realloc(*out_details, *out_details_capacity);
}
- memcpy(*out_details, GPR_SLICE_START_PTR(details), len);
+ memcpy(*out_details, GRPC_SLICE_START_PTR(details), len);
(*out_details)[len] = 0;
} else {
goto no_details;
@@ -900,7 +901,7 @@ static uint32_t decode_status(grpc_mdelem *md) {
status = ((uint32_t)(intptr_t)user_data) - STATUS_OFFSET;
} else {
if (!gpr_parse_bytes_to_uint32(grpc_mdstr_as_c_string(md->value),
- GPR_SLICE_LENGTH(md->value->slice),
+ GRPC_SLICE_LENGTH(md->value->slice),
&status)) {
status = GRPC_STATUS_UNKNOWN; /* could not parse status code */
}
@@ -953,7 +954,7 @@ static grpc_mdelem *publish_app_metadata(grpc_call *call, grpc_mdelem *elem,
mdusr = &dest->metadata[dest->count++];
mdusr->key = grpc_mdstr_as_c_string(elem->key);
mdusr->value = grpc_mdstr_as_c_string(elem->value);
- mdusr->value_length = GPR_SLICE_LENGTH(elem->value->slice);
+ mdusr->value_length = GRPC_SLICE_LENGTH(elem->value->slice);
GPR_TIMER_END("publish_app_metadata", 0);
return elem;
}
@@ -1085,8 +1086,8 @@ static void continue_receiving_slices(grpc_exec_ctx *exec_ctx,
if (grpc_byte_stream_next(exec_ctx, call->receiving_stream,
&call->receiving_slice, remaining,
&call->receiving_slice_ready)) {
- gpr_slice_buffer_add(&(*call->receiving_buffer)->data.raw.slice_buffer,
- call->receiving_slice);
+ grpc_slice_buffer_add(&(*call->receiving_buffer)->data.raw.slice_buffer,
+ call->receiving_slice);
} else {
return;
}
@@ -1099,8 +1100,8 @@ static void receiving_slice_ready(grpc_exec_ctx *exec_ctx, void *bctlp,
grpc_call *call = bctl->call;
if (error == GRPC_ERROR_NONE) {
- gpr_slice_buffer_add(&(*call->receiving_buffer)->data.raw.slice_buffer,
- call->receiving_slice);
+ grpc_slice_buffer_add(&(*call->receiving_buffer)->data.raw.slice_buffer,
+ call->receiving_slice);
continue_receiving_slices(exec_ctx, bctl);
} else {
if (grpc_trace_operation_failures) {
diff --git a/src/core/lib/surface/server.c b/src/core/lib/surface/server.c
index 3a90308058..798f582cad 100644
--- a/src/core/lib/surface/server.c
+++ b/src/core/lib/surface/server.c
@@ -264,13 +264,13 @@ static void channel_broadcaster_init(grpc_server *s, channel_broadcaster *cb) {
struct shutdown_cleanup_args {
grpc_closure closure;
- gpr_slice slice;
+ grpc_slice slice;
};
static void shutdown_cleanup(grpc_exec_ctx *exec_ctx, void *arg,
grpc_error *error) {
struct shutdown_cleanup_args *a = arg;
- gpr_slice_unref(a->slice);
+ grpc_slice_unref(a->slice);
gpr_free(a);
}
@@ -283,7 +283,7 @@ static void send_shutdown(grpc_exec_ctx *exec_ctx, grpc_channel *channel,
op->send_goaway = send_goaway;
op->set_accept_stream = true;
- sc->slice = gpr_slice_from_copied_string("Server shutdown");
+ sc->slice = grpc_slice_from_copied_string("Server shutdown");
op->goaway_message = &sc->slice;
op->goaway_status = GRPC_STATUS_OK;
op->disconnect_with_error = send_disconnect;
@@ -459,8 +459,8 @@ static void destroy_channel(grpc_exec_ctx *exec_ctx, channel_data *chand,
}
static void cpstr(char **dest, size_t *capacity, grpc_mdstr *value) {
- gpr_slice slice = value->slice;
- size_t len = GPR_SLICE_LENGTH(slice);
+ grpc_slice slice = value->slice;
+ size_t len = GRPC_SLICE_LENGTH(slice);
if (len + 1 > *capacity) {
*capacity = GPR_MAX(len + 1, *capacity * 2);
diff --git a/src/core/lib/transport/byte_stream.c b/src/core/lib/transport/byte_stream.c
index 2f6c75cb6a..2f1d7b7c60 100644
--- a/src/core/lib/transport/byte_stream.c
+++ b/src/core/lib/transport/byte_stream.c
@@ -38,7 +38,7 @@
#include <grpc/support/log.h>
int grpc_byte_stream_next(grpc_exec_ctx *exec_ctx,
- grpc_byte_stream *byte_stream, gpr_slice *slice,
+ grpc_byte_stream *byte_stream, grpc_slice *slice,
size_t max_size_hint, grpc_closure *on_complete) {
return byte_stream->next(exec_ctx, byte_stream, slice, max_size_hint,
on_complete);
@@ -53,11 +53,11 @@ void grpc_byte_stream_destroy(grpc_exec_ctx *exec_ctx,
static int slice_buffer_stream_next(grpc_exec_ctx *exec_ctx,
grpc_byte_stream *byte_stream,
- gpr_slice *slice, size_t max_size_hint,
+ grpc_slice *slice, size_t max_size_hint,
grpc_closure *on_complete) {
grpc_slice_buffer_stream *stream = (grpc_slice_buffer_stream *)byte_stream;
GPR_ASSERT(stream->cursor < stream->backing_buffer->count);
- *slice = gpr_slice_ref(stream->backing_buffer->slices[stream->cursor]);
+ *slice = grpc_slice_ref(stream->backing_buffer->slices[stream->cursor]);
stream->cursor++;
return 1;
}
@@ -66,7 +66,7 @@ static void slice_buffer_stream_destroy(grpc_exec_ctx *exec_ctx,
grpc_byte_stream *byte_stream) {}
void grpc_slice_buffer_stream_init(grpc_slice_buffer_stream *stream,
- gpr_slice_buffer *slice_buffer,
+ grpc_slice_buffer *slice_buffer,
uint32_t flags) {
GPR_ASSERT(slice_buffer->length <= UINT32_MAX);
stream->base.length = (uint32_t)slice_buffer->length;
diff --git a/src/core/lib/transport/byte_stream.h b/src/core/lib/transport/byte_stream.h
index e64dce6283..1fdd5b4d77 100644
--- a/src/core/lib/transport/byte_stream.h
+++ b/src/core/lib/transport/byte_stream.h
@@ -34,7 +34,7 @@
#ifndef GRPC_CORE_LIB_TRANSPORT_BYTE_STREAM_H
#define GRPC_CORE_LIB_TRANSPORT_BYTE_STREAM_H
-#include <grpc/support/slice_buffer.h>
+#include <grpc/slice_buffer.h>
#include "src/core/lib/iomgr/exec_ctx.h"
/** Internal bit flag for grpc_begin_message's \a flags signaling the use of
@@ -50,7 +50,7 @@ struct grpc_byte_stream {
uint32_t length;
uint32_t flags;
int (*next)(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream,
- gpr_slice *slice, size_t max_size_hint,
+ grpc_slice *slice, size_t max_size_hint,
grpc_closure *on_complete);
void (*destroy)(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream);
};
@@ -65,7 +65,7 @@ struct grpc_byte_stream {
* once a slice is returned into *slice, it is owned by the caller.
*/
int grpc_byte_stream_next(grpc_exec_ctx *exec_ctx,
- grpc_byte_stream *byte_stream, gpr_slice *slice,
+ grpc_byte_stream *byte_stream, grpc_slice *slice,
size_t max_size_hint, grpc_closure *on_complete);
void grpc_byte_stream_destroy(grpc_exec_ctx *exec_ctx,
@@ -74,12 +74,12 @@ void grpc_byte_stream_destroy(grpc_exec_ctx *exec_ctx,
/* grpc_byte_stream that wraps a slice buffer */
typedef struct grpc_slice_buffer_stream {
grpc_byte_stream base;
- gpr_slice_buffer *backing_buffer;
+ grpc_slice_buffer *backing_buffer;
size_t cursor;
} grpc_slice_buffer_stream;
void grpc_slice_buffer_stream_init(grpc_slice_buffer_stream *stream,
- gpr_slice_buffer *slice_buffer,
+ grpc_slice_buffer *slice_buffer,
uint32_t flags);
#endif /* GRPC_CORE_LIB_TRANSPORT_BYTE_STREAM_H */
diff --git a/src/core/lib/transport/metadata.c b/src/core/lib/transport/metadata.c
index f3c5321fe9..977b34ca86 100644
--- a/src/core/lib/transport/metadata.c
+++ b/src/core/lib/transport/metadata.c
@@ -51,7 +51,7 @@
#include "src/core/lib/support/string.h"
#include "src/core/lib/transport/static_metadata.h"
-gpr_slice (*grpc_chttp2_base64_encode_and_huffman_compress)(gpr_slice input);
+grpc_slice (*grpc_chttp2_base64_encode_and_huffman_compress)(grpc_slice input);
/* There are two kinds of mdelem and mdstr instances.
* Static instances are declared in static_metadata.{h,c} and
@@ -85,16 +85,16 @@ typedef void (*destroy_user_data_func)(void *user_data);
/* Shadow structure for grpc_mdstr for non-static values */
typedef struct internal_string {
/* must be byte compatible with grpc_mdstr */
- gpr_slice slice;
+ grpc_slice slice;
uint32_t hash;
/* private only data */
gpr_atm refcnt;
uint8_t has_base64_and_huffman_encoded;
- gpr_slice_refcount refcount;
+ grpc_slice_refcount refcount;
- gpr_slice base64_and_huffman;
+ grpc_slice base64_and_huffman;
gpr_atm size_in_decoder_table;
@@ -174,7 +174,7 @@ void grpc_mdctx_global_init(void) {
grpc_mdstr *elem = &grpc_static_mdstr_table[i];
const char *str = grpc_static_metadata_strings[i];
uint32_t hash = gpr_murmur_hash3(str, strlen(str), g_hash_seed);
- *(gpr_slice *)&elem->slice = gpr_slice_from_static_string(str);
+ *(grpc_slice *)&elem->slice = grpc_slice_from_static_string(str);
*(uint32_t *)&elem->hash = hash;
for (j = 0;; j++) {
size_t idx = (hash + j) % GPR_ARRAY_SIZE(g_static_strtab);
@@ -321,7 +321,7 @@ static void internal_destroy_string(strtab_shard *shard, internal_string *is) {
internal_string *cur;
GPR_TIMER_BEGIN("internal_destroy_string", 0);
if (is->has_base64_and_huffman_encoded) {
- gpr_slice_unref(is->base64_and_huffman);
+ grpc_slice_unref(is->base64_and_huffman);
}
for (prev_next = &shard->strs[TABLE_IDX(is->hash, LOG2_STRTAB_SHARD_COUNT,
shard->capacity)],
@@ -350,10 +350,10 @@ grpc_mdstr *grpc_mdstr_from_string(const char *str) {
return grpc_mdstr_from_buffer((const uint8_t *)str, strlen(str));
}
-grpc_mdstr *grpc_mdstr_from_slice(gpr_slice slice) {
- grpc_mdstr *result = grpc_mdstr_from_buffer(GPR_SLICE_START_PTR(slice),
- GPR_SLICE_LENGTH(slice));
- gpr_slice_unref(slice);
+grpc_mdstr *grpc_mdstr_from_slice(grpc_slice slice) {
+ grpc_mdstr *result = grpc_mdstr_from_buffer(GRPC_SLICE_START_PTR(slice),
+ GRPC_SLICE_LENGTH(slice));
+ grpc_slice_unref(slice);
return result;
}
@@ -373,9 +373,9 @@ grpc_mdstr *grpc_mdstr_from_buffer(const uint8_t *buf, size_t length) {
idx = (hash + i) % GPR_ARRAY_SIZE(g_static_strtab);
ss = g_static_strtab[idx];
if (ss == NULL) break;
- if (ss->hash == hash && GPR_SLICE_LENGTH(ss->slice) == length &&
+ if (ss->hash == hash && GRPC_SLICE_LENGTH(ss->slice) == length &&
(length == 0 ||
- 0 == memcmp(buf, GPR_SLICE_START_PTR(ss->slice), length))) {
+ 0 == memcmp(buf, GRPC_SLICE_START_PTR(ss->slice), length))) {
GPR_TIMER_END("grpc_mdstr_from_buffer", 0);
return ss;
}
@@ -386,8 +386,8 @@ grpc_mdstr *grpc_mdstr_from_buffer(const uint8_t *buf, size_t length) {
/* search for an existing string */
idx = TABLE_IDX(hash, LOG2_STRTAB_SHARD_COUNT, shard->capacity);
for (s = shard->strs[idx]; s; s = s->bucket_next) {
- if (s->hash == hash && GPR_SLICE_LENGTH(s->slice) == length &&
- 0 == memcmp(buf, GPR_SLICE_START_PTR(s->slice), length)) {
+ if (s->hash == hash && GRPC_SLICE_LENGTH(s->slice) == length &&
+ 0 == memcmp(buf, GRPC_SLICE_START_PTR(s->slice), length)) {
if (gpr_atm_full_fetch_add(&s->refcnt, 1) == 0) {
/* If we get here, we've added a ref to something that was about to
* die - drop it immediately.
@@ -404,7 +404,7 @@ grpc_mdstr *grpc_mdstr_from_buffer(const uint8_t *buf, size_t length) {
}
/* not found: create a new string */
- if (length + 1 < GPR_SLICE_INLINED_SIZE) {
+ if (length + 1 < GRPC_SLICE_INLINED_SIZE) {
/* string data goes directly into the slice */
s = gpr_malloc(sizeof(internal_string));
gpr_atm_rel_store(&s->refcnt, 1);
@@ -589,7 +589,7 @@ grpc_mdelem *grpc_mdelem_from_strings(const char *key, const char *value) {
grpc_mdstr_from_string(value));
}
-grpc_mdelem *grpc_mdelem_from_slices(gpr_slice key, gpr_slice value) {
+grpc_mdelem *grpc_mdelem_from_slices(grpc_slice key, grpc_slice value) {
return grpc_mdelem_from_metadata_strings(grpc_mdstr_from_slice(key),
grpc_mdstr_from_slice(value));
}
@@ -607,12 +607,12 @@ static size_t get_base64_encoded_size(size_t raw_length) {
}
size_t grpc_mdelem_get_size_in_hpack_table(grpc_mdelem *elem) {
- size_t overhead_and_key = 32 + GPR_SLICE_LENGTH(elem->key->slice);
- size_t value_len = GPR_SLICE_LENGTH(elem->value->slice);
+ size_t overhead_and_key = 32 + GRPC_SLICE_LENGTH(elem->key->slice);
+ size_t value_len = GRPC_SLICE_LENGTH(elem->value->slice);
if (is_mdstr_static(elem->value)) {
if (grpc_is_binary_header(
- (const char *)GPR_SLICE_START_PTR(elem->key->slice),
- GPR_SLICE_LENGTH(elem->key->slice))) {
+ (const char *)GRPC_SLICE_START_PTR(elem->key->slice),
+ GRPC_SLICE_LENGTH(elem->key->slice))) {
return overhead_and_key + get_base64_encoded_size(value_len);
} else {
return overhead_and_key + value_len;
@@ -622,8 +622,8 @@ size_t grpc_mdelem_get_size_in_hpack_table(grpc_mdelem *elem) {
gpr_atm current_size = gpr_atm_acq_load(&is->size_in_decoder_table);
if (current_size == SIZE_IN_DECODER_TABLE_NOT_SET) {
if (grpc_is_binary_header(
- (const char *)GPR_SLICE_START_PTR(elem->key->slice),
- GPR_SLICE_LENGTH(elem->key->slice))) {
+ (const char *)GRPC_SLICE_START_PTR(elem->key->slice),
+ GRPC_SLICE_LENGTH(elem->key->slice))) {
current_size = (gpr_atm)get_base64_encoded_size(value_len);
} else {
current_size = (gpr_atm)value_len;
@@ -679,7 +679,7 @@ void grpc_mdelem_unref(grpc_mdelem *gmd DEBUG_ARGS) {
}
const char *grpc_mdstr_as_c_string(const grpc_mdstr *s) {
- return (const char *)GPR_SLICE_START_PTR(s->slice);
+ return (const char *)GRPC_SLICE_START_PTR(s->slice);
}
size_t grpc_mdstr_length(const grpc_mdstr *s) { return GRPC_MDSTR_LENGTH(s); }
@@ -747,9 +747,9 @@ void grpc_mdelem_set_user_data(grpc_mdelem *md, void (*destroy_func)(void *),
gpr_mu_unlock(&im->mu_user_data);
}
-gpr_slice grpc_mdstr_as_base64_encoded_and_huffman_compressed(grpc_mdstr *gs) {
+grpc_slice grpc_mdstr_as_base64_encoded_and_huffman_compressed(grpc_mdstr *gs) {
internal_string *s = (internal_string *)gs;
- gpr_slice slice;
+ grpc_slice slice;
strtab_shard *shard =
&g_strtab_shard[SHARD_IDX(s->hash, LOG2_STRTAB_SHARD_COUNT)];
gpr_mu_lock(&shard->mu);
diff --git a/src/core/lib/transport/metadata.h b/src/core/lib/transport/metadata.h
index 71eff0acf2..8dcfbb98bb 100644
--- a/src/core/lib/transport/metadata.h
+++ b/src/core/lib/transport/metadata.h
@@ -34,7 +34,7 @@
#ifndef GRPC_CORE_LIB_TRANSPORT_METADATA_H
#define GRPC_CORE_LIB_TRANSPORT_METADATA_H
-#include <grpc/support/slice.h>
+#include <grpc/slice.h>
#include <grpc/support/useful.h>
#ifdef __cplusplus
@@ -77,7 +77,7 @@ typedef struct grpc_mdelem grpc_mdelem;
/* if changing this, make identical changes in internal_string in metadata.c */
struct grpc_mdstr {
- const gpr_slice slice;
+ const grpc_slice slice;
const uint32_t hash;
/* there is a private part to this in metadata.c */
};
@@ -96,12 +96,12 @@ void grpc_test_only_set_metadata_hash_seed(uint32_t seed);
clients may have handy */
grpc_mdstr *grpc_mdstr_from_string(const char *str);
/* Unrefs the slice. */
-grpc_mdstr *grpc_mdstr_from_slice(gpr_slice slice);
+grpc_mdstr *grpc_mdstr_from_slice(grpc_slice slice);
grpc_mdstr *grpc_mdstr_from_buffer(const uint8_t *str, size_t length);
/* Returns a borrowed slice from the mdstr with its contents base64 encoded
and huffman compressed */
-gpr_slice grpc_mdstr_as_base64_encoded_and_huffman_compressed(grpc_mdstr *str);
+grpc_slice grpc_mdstr_as_base64_encoded_and_huffman_compressed(grpc_mdstr *str);
/* Constructors for grpc_mdelem instances; take a variety of data types that
clients may have handy */
@@ -109,7 +109,7 @@ grpc_mdelem *grpc_mdelem_from_metadata_strings(grpc_mdstr *key,
grpc_mdstr *value);
grpc_mdelem *grpc_mdelem_from_strings(const char *key, const char *value);
/* Unrefs the slices. */
-grpc_mdelem *grpc_mdelem_from_slices(gpr_slice key, gpr_slice value);
+grpc_mdelem *grpc_mdelem_from_slices(grpc_slice key, grpc_slice value);
grpc_mdelem *grpc_mdelem_from_string_and_buffer(const char *key,
const uint8_t *value,
size_t value_length);
@@ -149,7 +149,7 @@ void grpc_mdelem_unref(grpc_mdelem *md);
Does not promise that the returned string has no embedded nulls however. */
const char *grpc_mdstr_as_c_string(const grpc_mdstr *s);
-#define GRPC_MDSTR_LENGTH(s) (GPR_SLICE_LENGTH(s->slice))
+#define GRPC_MDSTR_LENGTH(s) (GRPC_SLICE_LENGTH(s->slice))
/* We add 32 bytes of padding as per RFC-7540 section 6.5.2. */
#define GRPC_MDELEM_LENGTH(e) \
@@ -165,8 +165,8 @@ void grpc_mdctx_global_init(void);
void grpc_mdctx_global_shutdown(void);
/* Implementation provided by chttp2_transport */
-extern gpr_slice (*grpc_chttp2_base64_encode_and_huffman_compress)(
- gpr_slice input);
+extern grpc_slice (*grpc_chttp2_base64_encode_and_huffman_compress)(
+ grpc_slice input);
#ifdef __cplusplus
}
diff --git a/src/core/lib/transport/metadata_batch.h b/src/core/lib/transport/metadata_batch.h
index 0424b4db98..7a9ccb4bc8 100644
--- a/src/core/lib/transport/metadata_batch.h
+++ b/src/core/lib/transport/metadata_batch.h
@@ -37,8 +37,8 @@
#include <stdbool.h>
#include <grpc/grpc.h>
+#include <grpc/slice.h>
#include <grpc/support/port_platform.h>
-#include <grpc/support/slice.h>
#include <grpc/support/time.h>
#include "src/core/lib/transport/metadata.h"
diff --git a/src/core/lib/transport/transport.c b/src/core/lib/transport/transport.c
index 75aec7a5b4..866cd9ea87 100644
--- a/src/core/lib/transport/transport.c
+++ b/src/core/lib/transport/transport.c
@@ -40,6 +40,7 @@
#include <grpc/support/log.h>
#include <grpc/support/sync.h>
+#include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/lib/support/string.h"
#include "src/core/lib/transport/transport_impl.h"
@@ -207,21 +208,21 @@ void grpc_transport_stream_op_add_cancellation(grpc_transport_stream_op *op,
void grpc_transport_stream_op_add_cancellation_with_message(
grpc_transport_stream_op *op, grpc_status_code status,
- gpr_slice *optional_message) {
+ grpc_slice *optional_message) {
GPR_ASSERT(status != GRPC_STATUS_OK);
if (op->cancel_error != GRPC_ERROR_NONE) {
if (optional_message) {
- gpr_slice_unref(*optional_message);
+ grpc_slice_unref(*optional_message);
}
return;
}
grpc_error *error;
if (optional_message != NULL) {
- char *msg = gpr_dump_slice(*optional_message, GPR_DUMP_ASCII);
+ char *msg = grpc_dump_slice(*optional_message, GPR_DUMP_ASCII);
error = grpc_error_set_str(GRPC_ERROR_CREATE(msg),
GRPC_ERROR_STR_GRPC_MESSAGE, msg);
gpr_free(msg);
- gpr_slice_unref(*optional_message);
+ grpc_slice_unref(*optional_message);
} else {
error = GRPC_ERROR_CREATE("Call cancelled");
}
@@ -231,22 +232,22 @@ void grpc_transport_stream_op_add_cancellation_with_message(
void grpc_transport_stream_op_add_close(grpc_transport_stream_op *op,
grpc_status_code status,
- gpr_slice *optional_message) {
+ grpc_slice *optional_message) {
GPR_ASSERT(status != GRPC_STATUS_OK);
if (op->cancel_error != GRPC_ERROR_NONE ||
op->close_error != GRPC_ERROR_NONE) {
if (optional_message) {
- gpr_slice_unref(*optional_message);
+ grpc_slice_unref(*optional_message);
}
return;
}
grpc_error *error;
if (optional_message != NULL) {
- char *msg = gpr_dump_slice(*optional_message, GPR_DUMP_ASCII);
+ char *msg = grpc_dump_slice(*optional_message, GPR_DUMP_ASCII);
error = grpc_error_set_str(GRPC_ERROR_CREATE(msg),
GRPC_ERROR_STR_GRPC_MESSAGE, msg);
gpr_free(msg);
- gpr_slice_unref(*optional_message);
+ grpc_slice_unref(*optional_message);
} else {
error = GRPC_ERROR_CREATE("Call force closed");
}
diff --git a/src/core/lib/transport/transport.h b/src/core/lib/transport/transport.h
index 50253ebad1..8916b28b72 100644
--- a/src/core/lib/transport/transport.h
+++ b/src/core/lib/transport/transport.h
@@ -181,7 +181,7 @@ typedef struct grpc_transport_op {
bool send_goaway;
/** what should the goaway contain? */
grpc_status_code goaway_status;
- gpr_slice *goaway_message;
+ grpc_slice *goaway_message;
/** set the callback for accepting new streams;
this is a permanent callback, unlike the other one-shot closures.
If true, the callback is set to set_accept_stream_fn, with its
@@ -249,11 +249,11 @@ void grpc_transport_stream_op_add_cancellation(grpc_transport_stream_op *op,
void grpc_transport_stream_op_add_cancellation_with_message(
grpc_transport_stream_op *op, grpc_status_code status,
- gpr_slice *optional_message);
+ grpc_slice *optional_message);
void grpc_transport_stream_op_add_close(grpc_transport_stream_op *op,
grpc_status_code status,
- gpr_slice *optional_message);
+ grpc_slice *optional_message);
char *grpc_transport_stream_op_string(grpc_transport_stream_op *op);
char *grpc_transport_op_string(grpc_transport_op *op);
@@ -283,7 +283,7 @@ void grpc_transport_ping(grpc_transport *transport, grpc_closure *cb);
/* Advise peer of pending connection termination. */
void grpc_transport_goaway(grpc_transport *transport, grpc_status_code status,
- gpr_slice debug_data);
+ grpc_slice debug_data);
/* Close a transport. Aborts all open streams. */
void grpc_transport_close(grpc_transport *transport);
diff --git a/src/core/lib/transport/transport_op_string.c b/src/core/lib/transport/transport_op_string.c
index 533ec52077..58d6ad508e 100644
--- a/src/core/lib/transport/transport_op_string.c
+++ b/src/core/lib/transport/transport_op_string.c
@@ -40,6 +40,7 @@
#include <grpc/support/alloc.h>
#include <grpc/support/string_util.h>
#include <grpc/support/useful.h>
+#include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/lib/support/string.h"
#include "src/core/lib/transport/connectivity_state.h"
@@ -48,12 +49,12 @@
static void put_metadata(gpr_strvec *b, grpc_mdelem *md) {
gpr_strvec_add(b, gpr_strdup("key="));
- gpr_strvec_add(b,
- gpr_dump_slice(md->key->slice, GPR_DUMP_HEX | GPR_DUMP_ASCII));
+ gpr_strvec_add(
+ b, grpc_dump_slice(md->key->slice, GPR_DUMP_HEX | GPR_DUMP_ASCII));
gpr_strvec_add(b, gpr_strdup(" value="));
gpr_strvec_add(
- b, gpr_dump_slice(md->value->slice, GPR_DUMP_HEX | GPR_DUMP_ASCII));
+ b, grpc_dump_slice(md->value->slice, GPR_DUMP_HEX | GPR_DUMP_ASCII));
}
static void put_metadata_list(gpr_strvec *b, grpc_metadata_batch md) {
@@ -175,8 +176,8 @@ char *grpc_transport_op_string(grpc_transport_op *op) {
first = false;
char *msg = op->goaway_message == NULL
? "null"
- : gpr_dump_slice(*op->goaway_message,
- GPR_DUMP_ASCII | GPR_DUMP_HEX);
+ : grpc_dump_slice(*op->goaway_message,
+ GPR_DUMP_ASCII | GPR_DUMP_HEX);
gpr_asprintf(&tmp, "SEND_GOAWAY:status=%d:msg=%s", op->goaway_status, msg);
if (op->goaway_message != NULL) gpr_free(msg);
gpr_strvec_add(&b, tmp);
diff --git a/src/cpp/client/channel_cc.cc b/src/cpp/client/channel_cc.cc
index 847c8c7dc0..5f1d00d2b4 100644
--- a/src/cpp/client/channel_cc.cc
+++ b/src/cpp/client/channel_cc.cc
@@ -47,8 +47,8 @@
#include <grpc++/support/status.h>
#include <grpc++/support/time.h>
#include <grpc/grpc.h>
+#include <grpc/slice.h>
#include <grpc/support/log.h>
-#include <grpc/support/slice.h>
#include "src/core/lib/profiling/timers.h"
namespace grpc {
diff --git a/src/cpp/common/core_codegen.cc b/src/cpp/common/core_codegen.cc
index ce02202976..a07ad54376 100644
--- a/src/cpp/common/core_codegen.cc
+++ b/src/cpp/common/core_codegen.cc
@@ -39,11 +39,11 @@
#include <grpc/byte_buffer.h>
#include <grpc/byte_buffer_reader.h>
#include <grpc/grpc.h>
+#include <grpc/slice.h>
+#include <grpc/slice_buffer.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
-#include <grpc/support/slice.h>
-#include <grpc/support/slice_buffer.h>
#include <grpc/support/sync.h>
#include "src/core/lib/profiling/timers.h"
@@ -102,31 +102,34 @@ void CoreCodegen::grpc_byte_buffer_reader_destroy(
}
int CoreCodegen::grpc_byte_buffer_reader_next(grpc_byte_buffer_reader* reader,
- gpr_slice* slice) {
+ grpc_slice* slice) {
return ::grpc_byte_buffer_reader_next(reader, slice);
}
-grpc_byte_buffer* CoreCodegen::grpc_raw_byte_buffer_create(gpr_slice* slice,
+grpc_byte_buffer* CoreCodegen::grpc_raw_byte_buffer_create(grpc_slice* slice,
size_t nslices) {
return ::grpc_raw_byte_buffer_create(slice, nslices);
}
-gpr_slice CoreCodegen::gpr_slice_malloc(size_t length) {
- return ::gpr_slice_malloc(length);
+grpc_slice CoreCodegen::grpc_slice_malloc(size_t length) {
+ return ::grpc_slice_malloc(length);
}
-void CoreCodegen::gpr_slice_unref(gpr_slice slice) { ::gpr_slice_unref(slice); }
+void CoreCodegen::grpc_slice_unref(grpc_slice slice) {
+ ::grpc_slice_unref(slice);
+}
-gpr_slice CoreCodegen::gpr_slice_split_tail(gpr_slice* s, size_t split) {
- return ::gpr_slice_split_tail(s, split);
+grpc_slice CoreCodegen::grpc_slice_split_tail(grpc_slice* s, size_t split) {
+ return ::grpc_slice_split_tail(s, split);
}
-void CoreCodegen::gpr_slice_buffer_add(gpr_slice_buffer* sb, gpr_slice slice) {
- ::gpr_slice_buffer_add(sb, slice);
+void CoreCodegen::grpc_slice_buffer_add(grpc_slice_buffer* sb,
+ grpc_slice slice) {
+ ::grpc_slice_buffer_add(sb, slice);
}
-void CoreCodegen::gpr_slice_buffer_pop(gpr_slice_buffer* sb) {
- ::gpr_slice_buffer_pop(sb);
+void CoreCodegen::grpc_slice_buffer_pop(grpc_slice_buffer* sb) {
+ ::grpc_slice_buffer_pop(sb);
}
void CoreCodegen::grpc_metadata_array_init(grpc_metadata_array* array) {
diff --git a/src/cpp/util/byte_buffer_cc.cc b/src/cpp/util/byte_buffer_cc.cc
index 91ed66b766..cbe0aad26c 100644
--- a/src/cpp/util/byte_buffer_cc.cc
+++ b/src/cpp/util/byte_buffer_cc.cc
@@ -38,18 +38,18 @@ namespace grpc {
ByteBuffer::ByteBuffer(const Slice* slices, size_t nslices) {
// The following assertions check that the representation of a grpc::Slice is
- // identical to that of a gpr_slice: it has a gpr_slice field, and nothing
+ // identical to that of a grpc_slice: it has a grpc_slice field, and nothing
// else.
- static_assert(std::is_same<decltype(slices[0].slice_), gpr_slice>::value,
- "Slice must have same representation as gpr_slice");
- static_assert(sizeof(Slice) == sizeof(gpr_slice),
- "Slice must have same representation as gpr_slice");
+ static_assert(std::is_same<decltype(slices[0].slice_), grpc_slice>::value,
+ "Slice must have same representation as grpc_slice");
+ static_assert(sizeof(Slice) == sizeof(grpc_slice),
+ "Slice must have same representation as grpc_slice");
// The const_cast is legal if grpc_raw_byte_buffer_create() does no more
// than its advertised side effect of increasing the reference count of the
// slices it processes, and such an increase does not affect the semantics
// seen by the caller of this constructor.
buffer_ = grpc_raw_byte_buffer_create(
- reinterpret_cast<gpr_slice*>(const_cast<Slice*>(slices)), nslices);
+ reinterpret_cast<grpc_slice*>(const_cast<Slice*>(slices)), nslices);
}
ByteBuffer::~ByteBuffer() {
@@ -75,7 +75,7 @@ Status ByteBuffer::Dump(std::vector<Slice>* slices) const {
return Status(StatusCode::INTERNAL,
"Couldn't initialize byte buffer reader");
}
- gpr_slice s;
+ grpc_slice s;
while (grpc_byte_buffer_reader_next(&reader, &s)) {
slices->push_back(Slice(s, Slice::STEAL_REF));
}
diff --git a/src/cpp/util/slice_cc.cc b/src/cpp/util/slice_cc.cc
index 7e88423b6c..c05f1cf124 100644
--- a/src/cpp/util/slice_cc.cc
+++ b/src/cpp/util/slice_cc.cc
@@ -37,12 +37,12 @@ namespace grpc {
Slice::Slice() : slice_(gpr_empty_slice()) {}
-Slice::~Slice() { gpr_slice_unref(slice_); }
+Slice::~Slice() { grpc_slice_unref(slice_); }
-Slice::Slice(gpr_slice slice, AddRef) : slice_(gpr_slice_ref(slice)) {}
+Slice::Slice(grpc_slice slice, AddRef) : slice_(grpc_slice_ref(slice)) {}
-Slice::Slice(gpr_slice slice, StealRef) : slice_(slice) {}
+Slice::Slice(grpc_slice slice, StealRef) : slice_(slice) {}
-Slice::Slice(const Slice& other) : slice_(gpr_slice_ref(other.slice_)) {}
+Slice::Slice(const Slice& other) : slice_(grpc_slice_ref(other.slice_)) {}
} // namespace grpc
diff --git a/src/csharp/ext/grpc_csharp_ext.c b/src/csharp/ext/grpc_csharp_ext.c
index 9a5d7869d3..0bf5b0acf3 100644
--- a/src/csharp/ext/grpc_csharp_ext.c
+++ b/src/csharp/ext/grpc_csharp_ext.c
@@ -37,7 +37,7 @@
#include <grpc/support/port_platform.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/slice.h>
+#include <grpc/slice.h>
#include <grpc/support/string_util.h>
#include <grpc/support/thd.h>
#include <grpc/grpc.h>
@@ -59,9 +59,9 @@
#endif
grpc_byte_buffer *string_to_byte_buffer(const char *buffer, size_t len) {
- gpr_slice slice = gpr_slice_from_copied_buffer(buffer, len);
+ grpc_slice slice = grpc_slice_from_copied_buffer(buffer, len);
grpc_byte_buffer *bb = grpc_raw_byte_buffer_create(&slice, 1);
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
return bb;
}
@@ -282,18 +282,18 @@ GPR_EXPORT intptr_t GPR_CALLTYPE grpcsharp_batch_context_recv_message_length(
GPR_EXPORT void GPR_CALLTYPE grpcsharp_batch_context_recv_message_to_buffer(
const grpcsharp_batch_context *ctx, char *buffer, size_t buffer_len) {
grpc_byte_buffer_reader reader;
- gpr_slice slice;
+ grpc_slice slice;
size_t offset = 0;
GPR_ASSERT(grpc_byte_buffer_reader_init(&reader, ctx->recv_message));
while (grpc_byte_buffer_reader_next(&reader, &slice)) {
- size_t len = GPR_SLICE_LENGTH(slice);
+ size_t len = GRPC_SLICE_LENGTH(slice);
GPR_ASSERT(offset + len <= buffer_len);
- memcpy(buffer + offset, GPR_SLICE_START_PTR(slice),
- GPR_SLICE_LENGTH(slice));
+ memcpy(buffer + offset, GRPC_SLICE_START_PTR(slice),
+ GRPC_SLICE_LENGTH(slice));
offset += len;
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
}
grpc_byte_buffer_reader_destroy(&reader);
diff --git a/src/node/ext/byte_buffer.cc b/src/node/ext/byte_buffer.cc
index ad7d0ec8c8..017d7962c3 100644
--- a/src/node/ext/byte_buffer.cc
+++ b/src/node/ext/byte_buffer.cc
@@ -56,10 +56,10 @@ grpc_byte_buffer *BufferToByteBuffer(Local<Value> buffer) {
Nan::HandleScope scope;
int length = ::node::Buffer::Length(buffer);
char *data = ::node::Buffer::Data(buffer);
- gpr_slice slice = gpr_slice_malloc(length);
- memcpy(GPR_SLICE_START_PTR(slice), data, length);
+ grpc_slice slice = grpc_slice_malloc(length);
+ memcpy(GRPC_SLICE_START_PTR(slice), data, length);
grpc_byte_buffer *byte_buffer(grpc_raw_byte_buffer_create(&slice, 1));
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
return byte_buffer;
}
@@ -77,11 +77,11 @@ Local<Value> ByteBufferToBuffer(grpc_byte_buffer *buffer) {
Nan::ThrowError("Error initializing byte buffer reader.");
return scope.Escape(Nan::Undefined());
}
- gpr_slice slice = grpc_byte_buffer_reader_readall(&reader);
- size_t length = GPR_SLICE_LENGTH(slice);
+ grpc_slice slice = grpc_byte_buffer_reader_readall(&reader);
+ size_t length = GRPC_SLICE_LENGTH(slice);
char *result = new char[length];
- memcpy(result, GPR_SLICE_START_PTR(slice), length);
- gpr_slice_unref(slice);
+ memcpy(result, GRPC_SLICE_START_PTR(slice), length);
+ grpc_slice_unref(slice);
return scope.Escape(MakeFastBuffer(
Nan::NewBuffer(result, length, delete_buffer, NULL).ToLocalChecked()));
}
diff --git a/src/objective-c/GRPCClient/private/NSData+GRPC.m b/src/objective-c/GRPCClient/private/NSData+GRPC.m
index 98337799e9..6d2ad0a3bd 100644
--- a/src/objective-c/GRPCClient/private/NSData+GRPC.m
+++ b/src/objective-c/GRPCClient/private/NSData+GRPC.m
@@ -53,22 +53,22 @@ static void MallocAndCopyByteBufferToCharArray(grpc_byte_buffer *buffer,
}
// The slice contains uncompressed data even if compressed data was received
// because the reader takes care of automatically decompressing it
- gpr_slice slice = grpc_byte_buffer_reader_readall(&reader);
- size_t uncompressed_length = GPR_SLICE_LENGTH(slice);
+ grpc_slice slice = grpc_byte_buffer_reader_readall(&reader);
+ size_t uncompressed_length = GRPC_SLICE_LENGTH(slice);
char *result = malloc(uncompressed_length);
if (result) {
- memcpy(result, GPR_SLICE_START_PTR(slice), uncompressed_length);
+ memcpy(result, GRPC_SLICE_START_PTR(slice), uncompressed_length);
}
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
*array = result;
*length = uncompressed_length;
}
static grpc_byte_buffer *CopyCharArrayToNewByteBuffer(const char *array,
size_t length) {
- gpr_slice slice = gpr_slice_from_copied_buffer(array, length);
+ grpc_slice slice = grpc_slice_from_copied_buffer(array, length);
grpc_byte_buffer *buffer = grpc_raw_byte_buffer_create(&slice, 1);
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
return buffer;
}
@@ -97,9 +97,9 @@ static grpc_byte_buffer *CopyCharArrayToNewByteBuffer(const char *array,
// appending of byte arrays by not using internally a single contiguous memory
// block for representation.
// The following implementation is thus not optimal, sometimes requiring two
- // copies (one by self.bytes and another by gpr_slice_from_copied_buffer).
+ // copies (one by self.bytes and another by grpc_slice_from_copied_buffer).
// If it turns out to be an issue, we can use enumerateByteRangesUsingblock:
- // to create an array of gpr_slice objects to pass to
+ // to create an array of grpc_slice objects to pass to
// grpc_raw_byte_buffer_create.
// That would make it do exactly one copy, always.
return CopyCharArrayToNewByteBuffer((const char *)self.bytes,
diff --git a/src/php/ext/grpc/byte_buffer.c b/src/php/ext/grpc/byte_buffer.c
index 3be1429f13..b0269854e8 100644
--- a/src/php/ext/grpc/byte_buffer.c
+++ b/src/php/ext/grpc/byte_buffer.c
@@ -47,12 +47,12 @@
#include <grpc/grpc.h>
#include <grpc/byte_buffer_reader.h>
-#include <grpc/support/slice.h>
+#include <grpc/slice.h>
grpc_byte_buffer *string_to_byte_buffer(char *string, size_t length) {
- gpr_slice slice = gpr_slice_from_copied_buffer(string, length);
+ grpc_slice slice = grpc_slice_from_copied_buffer(string, length);
grpc_byte_buffer *buffer = grpc_raw_byte_buffer_create(&slice, 1);
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
return buffer;
}
@@ -66,11 +66,11 @@ void byte_buffer_to_string(grpc_byte_buffer *buffer, char **out_string,
return;
}
- gpr_slice slice = grpc_byte_buffer_reader_readall(&reader);
- size_t length = GPR_SLICE_LENGTH(slice);
+ grpc_slice slice = grpc_byte_buffer_reader_readall(&reader);
+ size_t length = GRPC_SLICE_LENGTH(slice);
char *string = ecalloc(length + 1, sizeof(char));
- memcpy(string, GPR_SLICE_START_PTR(slice), length);
- gpr_slice_unref(slice);
+ memcpy(string, GRPC_SLICE_START_PTR(slice), length);
+ grpc_slice_unref(slice);
*out_string = string;
*out_length = length;
diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi
index 9560fad137..ad766186bd 100644
--- a/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi
+++ b/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi
@@ -53,23 +53,23 @@ cdef extern from "grpc/byte_buffer_reader.h":
cdef extern from "grpc/grpc.h":
- ctypedef struct gpr_slice:
- # don't worry about writing out the members of gpr_slice; we never access
+ ctypedef struct grpc_slice:
+ # don't worry about writing out the members of grpc_slice; we never access
# them directly.
pass
- gpr_slice gpr_slice_ref(gpr_slice s) nogil
- void gpr_slice_unref(gpr_slice s) nogil
- gpr_slice gpr_slice_new(void *p, size_t len, void (*destroy)(void *)) nogil
- gpr_slice gpr_slice_new_with_len(
+ grpc_slice grpc_slice_ref(grpc_slice s) nogil
+ void grpc_slice_unref(grpc_slice s) nogil
+ grpc_slice grpc_slice_new(void *p, size_t len, void (*destroy)(void *)) nogil
+ grpc_slice grpc_slice_new_with_len(
void *p, size_t len, void (*destroy)(void *, size_t)) nogil
- gpr_slice gpr_slice_malloc(size_t length) nogil
- gpr_slice gpr_slice_from_copied_string(const char *source) nogil
- gpr_slice gpr_slice_from_copied_buffer(const char *source, size_t len) nogil
+ grpc_slice grpc_slice_malloc(size_t length) nogil
+ grpc_slice grpc_slice_from_copied_string(const char *source) nogil
+ grpc_slice grpc_slice_from_copied_buffer(const char *source, size_t len) nogil
# Declare functions for function-like macros (because Cython)...
- void *gpr_slice_start_ptr "GPR_SLICE_START_PTR" (gpr_slice s) nogil
- size_t gpr_slice_length "GPR_SLICE_LENGTH" (gpr_slice s) nogil
+ void *grpc_slice_start_ptr "GRPC_SLICE_START_PTR" (grpc_slice s) nogil
+ size_t grpc_slice_length "GRPC_SLICE_LENGTH" (grpc_slice s) nogil
ctypedef enum gpr_clock_type:
GPR_CLOCK_MONOTONIC
@@ -101,7 +101,7 @@ cdef extern from "grpc/grpc.h":
# We don't care about the internals.
pass
- grpc_byte_buffer *grpc_raw_byte_buffer_create(gpr_slice *slices,
+ grpc_byte_buffer *grpc_raw_byte_buffer_create(grpc_slice *slices,
size_t nslices) nogil
size_t grpc_byte_buffer_length(grpc_byte_buffer *bb) nogil
void grpc_byte_buffer_destroy(grpc_byte_buffer *byte_buffer) nogil
@@ -109,7 +109,7 @@ cdef extern from "grpc/grpc.h":
int grpc_byte_buffer_reader_init(grpc_byte_buffer_reader *reader,
grpc_byte_buffer *buffer) nogil
int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader *reader,
- gpr_slice *slice) nogil
+ grpc_slice *slice) nogil
void grpc_byte_buffer_reader_destroy(grpc_byte_buffer_reader *reader) nogil
ctypedef enum grpc_status_code:
diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi
index 8a4eef4d2e..cadfce6ee6 100644
--- a/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi
+++ b/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi
@@ -242,19 +242,19 @@ cdef class ByteBuffer:
return
cdef char *c_data = data
- cdef gpr_slice data_slice
+ cdef grpc_slice data_slice
cdef size_t data_length = len(data)
with nogil:
- data_slice = gpr_slice_from_copied_buffer(c_data, data_length)
+ data_slice = grpc_slice_from_copied_buffer(c_data, data_length)
with nogil:
self.c_byte_buffer = grpc_raw_byte_buffer_create(
&data_slice, 1)
with nogil:
- gpr_slice_unref(data_slice)
+ grpc_slice_unref(data_slice)
def bytes(self):
cdef grpc_byte_buffer_reader reader
- cdef gpr_slice data_slice
+ cdef grpc_slice data_slice
cdef size_t data_slice_length
cdef void *data_slice_pointer
cdef bint reader_status
@@ -267,11 +267,11 @@ cdef class ByteBuffer:
result = bytearray()
with nogil:
while grpc_byte_buffer_reader_next(&reader, &data_slice):
- data_slice_pointer = gpr_slice_start_ptr(data_slice)
- data_slice_length = gpr_slice_length(data_slice)
+ data_slice_pointer = grpc_slice_start_ptr(data_slice)
+ data_slice_length = grpc_slice_length(data_slice)
with gil:
result += (<char *>data_slice_pointer)[:data_slice_length]
- gpr_slice_unref(data_slice)
+ grpc_slice_unref(data_slice)
with nogil:
grpc_byte_buffer_reader_destroy(&reader)
return bytes(result)
diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py
index 8f4b3bc9b2..b0041871d4 100644
--- a/src/python/grpcio/grpc_core_dependencies.py
+++ b/src/python/grpcio/grpc_core_dependencies.py
@@ -52,9 +52,6 @@ CORE_SOURCE_FILES = [
'src/core/lib/support/log_windows.c',
'src/core/lib/support/mpscq.c',
'src/core/lib/support/murmur_hash.c',
- 'src/core/lib/support/percent_encoding.c',
- 'src/core/lib/support/slice.c',
- 'src/core/lib/support/slice_buffer.c',
'src/core/lib/support/stack_lockfree.c',
'src/core/lib/support/string.c',
'src/core/lib/support/string_posix.c',
@@ -157,6 +154,10 @@ CORE_SOURCE_FILES = [
'src/core/lib/json/json_reader.c',
'src/core/lib/json/json_string.c',
'src/core/lib/json/json_writer.c',
+ 'src/core/lib/slice/percent_encoding.c',
+ 'src/core/lib/slice/slice.c',
+ 'src/core/lib/slice/slice_buffer.c',
+ 'src/core/lib/slice/slice_string_helpers.c',
'src/core/lib/surface/alarm.c',
'src/core/lib/surface/api_trace.c',
'src/core/lib/surface/byte_buffer.c',
diff --git a/src/ruby/ext/grpc/rb_byte_buffer.c b/src/ruby/ext/grpc/rb_byte_buffer.c
index 61b7c30315..f97890e4a2 100644
--- a/src/ruby/ext/grpc/rb_byte_buffer.c
+++ b/src/ruby/ext/grpc/rb_byte_buffer.c
@@ -38,20 +38,20 @@
#include <grpc/grpc.h>
#include <grpc/byte_buffer_reader.h>
-#include <grpc/support/slice.h>
+#include <grpc/slice.h>
#include "rb_grpc.h"
grpc_byte_buffer* grpc_rb_s_to_byte_buffer(char *string, size_t length) {
- gpr_slice slice = gpr_slice_from_copied_buffer(string, length);
+ grpc_slice slice = grpc_slice_from_copied_buffer(string, length);
grpc_byte_buffer *buffer = grpc_raw_byte_buffer_create(&slice, 1);
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
return buffer;
}
VALUE grpc_rb_byte_buffer_to_s(grpc_byte_buffer *buffer) {
VALUE rb_string;
grpc_byte_buffer_reader reader;
- gpr_slice next;
+ grpc_slice next;
if (buffer == NULL) {
return Qnil;
}
@@ -61,9 +61,9 @@ VALUE grpc_rb_byte_buffer_to_s(grpc_byte_buffer *buffer) {
return Qnil;
}
while (grpc_byte_buffer_reader_next(&reader, &next) != 0) {
- rb_str_cat(rb_string, (const char *) GPR_SLICE_START_PTR(next),
- GPR_SLICE_LENGTH(next));
- gpr_slice_unref(next);
+ rb_str_cat(rb_string, (const char *) GRPC_SLICE_START_PTR(next),
+ GRPC_SLICE_LENGTH(next));
+ grpc_slice_unref(next);
}
return rb_string;
}
diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.c b/src/ruby/ext/grpc/rb_grpc_imports.generated.c
index fd73cc7970..f4546bf21f 100644
--- a/src/ruby/ext/grpc/rb_grpc_imports.generated.c
+++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.c
@@ -172,6 +172,35 @@ grpc_ssl_server_credentials_create_ex_type grpc_ssl_server_credentials_create_ex
grpc_server_add_secure_http2_port_type grpc_server_add_secure_http2_port_import;
grpc_call_set_credentials_type grpc_call_set_credentials_import;
grpc_server_credentials_set_auth_metadata_processor_type grpc_server_credentials_set_auth_metadata_processor_import;
+grpc_slice_ref_type grpc_slice_ref_import;
+grpc_slice_unref_type grpc_slice_unref_import;
+grpc_slice_new_type grpc_slice_new_import;
+grpc_slice_new_with_user_data_type grpc_slice_new_with_user_data_import;
+grpc_slice_new_with_len_type grpc_slice_new_with_len_import;
+grpc_slice_malloc_type grpc_slice_malloc_import;
+grpc_slice_from_copied_string_type grpc_slice_from_copied_string_import;
+grpc_slice_from_copied_buffer_type grpc_slice_from_copied_buffer_import;
+grpc_slice_from_static_string_type grpc_slice_from_static_string_import;
+grpc_slice_sub_type grpc_slice_sub_import;
+grpc_slice_sub_no_ref_type grpc_slice_sub_no_ref_import;
+grpc_slice_split_tail_type grpc_slice_split_tail_import;
+grpc_slice_split_head_type grpc_slice_split_head_import;
+gpr_empty_slice_type gpr_empty_slice_import;
+grpc_slice_cmp_type grpc_slice_cmp_import;
+grpc_slice_str_cmp_type grpc_slice_str_cmp_import;
+grpc_slice_buffer_init_type grpc_slice_buffer_init_import;
+grpc_slice_buffer_destroy_type grpc_slice_buffer_destroy_import;
+grpc_slice_buffer_add_type grpc_slice_buffer_add_import;
+grpc_slice_buffer_add_indexed_type grpc_slice_buffer_add_indexed_import;
+grpc_slice_buffer_addn_type grpc_slice_buffer_addn_import;
+grpc_slice_buffer_tiny_add_type grpc_slice_buffer_tiny_add_import;
+grpc_slice_buffer_pop_type grpc_slice_buffer_pop_import;
+grpc_slice_buffer_reset_and_unref_type grpc_slice_buffer_reset_and_unref_import;
+grpc_slice_buffer_swap_type grpc_slice_buffer_swap_import;
+grpc_slice_buffer_move_into_type grpc_slice_buffer_move_into_import;
+grpc_slice_buffer_trim_end_type grpc_slice_buffer_trim_end_import;
+grpc_slice_buffer_move_first_type grpc_slice_buffer_move_first_import;
+grpc_slice_buffer_take_first_type grpc_slice_buffer_take_first_import;
gpr_malloc_type gpr_malloc_import;
gpr_free_type gpr_free_import;
gpr_realloc_type gpr_realloc_import;
@@ -221,35 +250,6 @@ gpr_set_log_verbosity_type gpr_set_log_verbosity_import;
gpr_log_verbosity_init_type gpr_log_verbosity_init_import;
gpr_set_log_function_type gpr_set_log_function_import;
gpr_format_message_type gpr_format_message_import;
-gpr_slice_ref_type gpr_slice_ref_import;
-gpr_slice_unref_type gpr_slice_unref_import;
-gpr_slice_new_type gpr_slice_new_import;
-gpr_slice_new_with_user_data_type gpr_slice_new_with_user_data_import;
-gpr_slice_new_with_len_type gpr_slice_new_with_len_import;
-gpr_slice_malloc_type gpr_slice_malloc_import;
-gpr_slice_from_copied_string_type gpr_slice_from_copied_string_import;
-gpr_slice_from_copied_buffer_type gpr_slice_from_copied_buffer_import;
-gpr_slice_from_static_string_type gpr_slice_from_static_string_import;
-gpr_slice_sub_type gpr_slice_sub_import;
-gpr_slice_sub_no_ref_type gpr_slice_sub_no_ref_import;
-gpr_slice_split_tail_type gpr_slice_split_tail_import;
-gpr_slice_split_head_type gpr_slice_split_head_import;
-gpr_empty_slice_type gpr_empty_slice_import;
-gpr_slice_cmp_type gpr_slice_cmp_import;
-gpr_slice_str_cmp_type gpr_slice_str_cmp_import;
-gpr_slice_buffer_init_type gpr_slice_buffer_init_import;
-gpr_slice_buffer_destroy_type gpr_slice_buffer_destroy_import;
-gpr_slice_buffer_add_type gpr_slice_buffer_add_import;
-gpr_slice_buffer_add_indexed_type gpr_slice_buffer_add_indexed_import;
-gpr_slice_buffer_addn_type gpr_slice_buffer_addn_import;
-gpr_slice_buffer_tiny_add_type gpr_slice_buffer_tiny_add_import;
-gpr_slice_buffer_pop_type gpr_slice_buffer_pop_import;
-gpr_slice_buffer_reset_and_unref_type gpr_slice_buffer_reset_and_unref_import;
-gpr_slice_buffer_swap_type gpr_slice_buffer_swap_import;
-gpr_slice_buffer_move_into_type gpr_slice_buffer_move_into_import;
-gpr_slice_buffer_trim_end_type gpr_slice_buffer_trim_end_import;
-gpr_slice_buffer_move_first_type gpr_slice_buffer_move_first_import;
-gpr_slice_buffer_take_first_type gpr_slice_buffer_take_first_import;
gpr_strdup_type gpr_strdup_import;
gpr_asprintf_type gpr_asprintf_import;
gpr_subprocess_binary_extension_type gpr_subprocess_binary_extension_import;
@@ -446,6 +446,35 @@ void grpc_rb_load_imports(HMODULE library) {
grpc_server_add_secure_http2_port_import = (grpc_server_add_secure_http2_port_type) GetProcAddress(library, "grpc_server_add_secure_http2_port");
grpc_call_set_credentials_import = (grpc_call_set_credentials_type) GetProcAddress(library, "grpc_call_set_credentials");
grpc_server_credentials_set_auth_metadata_processor_import = (grpc_server_credentials_set_auth_metadata_processor_type) GetProcAddress(library, "grpc_server_credentials_set_auth_metadata_processor");
+ grpc_slice_ref_import = (grpc_slice_ref_type) GetProcAddress(library, "grpc_slice_ref");
+ grpc_slice_unref_import = (grpc_slice_unref_type) GetProcAddress(library, "grpc_slice_unref");
+ grpc_slice_new_import = (grpc_slice_new_type) GetProcAddress(library, "grpc_slice_new");
+ grpc_slice_new_with_user_data_import = (grpc_slice_new_with_user_data_type) GetProcAddress(library, "grpc_slice_new_with_user_data");
+ grpc_slice_new_with_len_import = (grpc_slice_new_with_len_type) GetProcAddress(library, "grpc_slice_new_with_len");
+ grpc_slice_malloc_import = (grpc_slice_malloc_type) GetProcAddress(library, "grpc_slice_malloc");
+ grpc_slice_from_copied_string_import = (grpc_slice_from_copied_string_type) GetProcAddress(library, "grpc_slice_from_copied_string");
+ grpc_slice_from_copied_buffer_import = (grpc_slice_from_copied_buffer_type) GetProcAddress(library, "grpc_slice_from_copied_buffer");
+ grpc_slice_from_static_string_import = (grpc_slice_from_static_string_type) GetProcAddress(library, "grpc_slice_from_static_string");
+ grpc_slice_sub_import = (grpc_slice_sub_type) GetProcAddress(library, "grpc_slice_sub");
+ grpc_slice_sub_no_ref_import = (grpc_slice_sub_no_ref_type) GetProcAddress(library, "grpc_slice_sub_no_ref");
+ grpc_slice_split_tail_import = (grpc_slice_split_tail_type) GetProcAddress(library, "grpc_slice_split_tail");
+ grpc_slice_split_head_import = (grpc_slice_split_head_type) GetProcAddress(library, "grpc_slice_split_head");
+ gpr_empty_slice_import = (gpr_empty_slice_type) GetProcAddress(library, "gpr_empty_slice");
+ grpc_slice_cmp_import = (grpc_slice_cmp_type) GetProcAddress(library, "grpc_slice_cmp");
+ grpc_slice_str_cmp_import = (grpc_slice_str_cmp_type) GetProcAddress(library, "grpc_slice_str_cmp");
+ grpc_slice_buffer_init_import = (grpc_slice_buffer_init_type) GetProcAddress(library, "grpc_slice_buffer_init");
+ grpc_slice_buffer_destroy_import = (grpc_slice_buffer_destroy_type) GetProcAddress(library, "grpc_slice_buffer_destroy");
+ grpc_slice_buffer_add_import = (grpc_slice_buffer_add_type) GetProcAddress(library, "grpc_slice_buffer_add");
+ grpc_slice_buffer_add_indexed_import = (grpc_slice_buffer_add_indexed_type) GetProcAddress(library, "grpc_slice_buffer_add_indexed");
+ grpc_slice_buffer_addn_import = (grpc_slice_buffer_addn_type) GetProcAddress(library, "grpc_slice_buffer_addn");
+ grpc_slice_buffer_tiny_add_import = (grpc_slice_buffer_tiny_add_type) GetProcAddress(library, "grpc_slice_buffer_tiny_add");
+ grpc_slice_buffer_pop_import = (grpc_slice_buffer_pop_type) GetProcAddress(library, "grpc_slice_buffer_pop");
+ grpc_slice_buffer_reset_and_unref_import = (grpc_slice_buffer_reset_and_unref_type) GetProcAddress(library, "grpc_slice_buffer_reset_and_unref");
+ grpc_slice_buffer_swap_import = (grpc_slice_buffer_swap_type) GetProcAddress(library, "grpc_slice_buffer_swap");
+ grpc_slice_buffer_move_into_import = (grpc_slice_buffer_move_into_type) GetProcAddress(library, "grpc_slice_buffer_move_into");
+ grpc_slice_buffer_trim_end_import = (grpc_slice_buffer_trim_end_type) GetProcAddress(library, "grpc_slice_buffer_trim_end");
+ grpc_slice_buffer_move_first_import = (grpc_slice_buffer_move_first_type) GetProcAddress(library, "grpc_slice_buffer_move_first");
+ grpc_slice_buffer_take_first_import = (grpc_slice_buffer_take_first_type) GetProcAddress(library, "grpc_slice_buffer_take_first");
gpr_malloc_import = (gpr_malloc_type) GetProcAddress(library, "gpr_malloc");
gpr_free_import = (gpr_free_type) GetProcAddress(library, "gpr_free");
gpr_realloc_import = (gpr_realloc_type) GetProcAddress(library, "gpr_realloc");
@@ -495,35 +524,6 @@ void grpc_rb_load_imports(HMODULE library) {
gpr_log_verbosity_init_import = (gpr_log_verbosity_init_type) GetProcAddress(library, "gpr_log_verbosity_init");
gpr_set_log_function_import = (gpr_set_log_function_type) GetProcAddress(library, "gpr_set_log_function");
gpr_format_message_import = (gpr_format_message_type) GetProcAddress(library, "gpr_format_message");
- gpr_slice_ref_import = (gpr_slice_ref_type) GetProcAddress(library, "gpr_slice_ref");
- gpr_slice_unref_import = (gpr_slice_unref_type) GetProcAddress(library, "gpr_slice_unref");
- gpr_slice_new_import = (gpr_slice_new_type) GetProcAddress(library, "gpr_slice_new");
- gpr_slice_new_with_user_data_import = (gpr_slice_new_with_user_data_type) GetProcAddress(library, "gpr_slice_new_with_user_data");
- gpr_slice_new_with_len_import = (gpr_slice_new_with_len_type) GetProcAddress(library, "gpr_slice_new_with_len");
- gpr_slice_malloc_import = (gpr_slice_malloc_type) GetProcAddress(library, "gpr_slice_malloc");
- gpr_slice_from_copied_string_import = (gpr_slice_from_copied_string_type) GetProcAddress(library, "gpr_slice_from_copied_string");
- gpr_slice_from_copied_buffer_import = (gpr_slice_from_copied_buffer_type) GetProcAddress(library, "gpr_slice_from_copied_buffer");
- gpr_slice_from_static_string_import = (gpr_slice_from_static_string_type) GetProcAddress(library, "gpr_slice_from_static_string");
- gpr_slice_sub_import = (gpr_slice_sub_type) GetProcAddress(library, "gpr_slice_sub");
- gpr_slice_sub_no_ref_import = (gpr_slice_sub_no_ref_type) GetProcAddress(library, "gpr_slice_sub_no_ref");
- gpr_slice_split_tail_import = (gpr_slice_split_tail_type) GetProcAddress(library, "gpr_slice_split_tail");
- gpr_slice_split_head_import = (gpr_slice_split_head_type) GetProcAddress(library, "gpr_slice_split_head");
- gpr_empty_slice_import = (gpr_empty_slice_type) GetProcAddress(library, "gpr_empty_slice");
- gpr_slice_cmp_import = (gpr_slice_cmp_type) GetProcAddress(library, "gpr_slice_cmp");
- gpr_slice_str_cmp_import = (gpr_slice_str_cmp_type) GetProcAddress(library, "gpr_slice_str_cmp");
- gpr_slice_buffer_init_import = (gpr_slice_buffer_init_type) GetProcAddress(library, "gpr_slice_buffer_init");
- gpr_slice_buffer_destroy_import = (gpr_slice_buffer_destroy_type) GetProcAddress(library, "gpr_slice_buffer_destroy");
- gpr_slice_buffer_add_import = (gpr_slice_buffer_add_type) GetProcAddress(library, "gpr_slice_buffer_add");
- gpr_slice_buffer_add_indexed_import = (gpr_slice_buffer_add_indexed_type) GetProcAddress(library, "gpr_slice_buffer_add_indexed");
- gpr_slice_buffer_addn_import = (gpr_slice_buffer_addn_type) GetProcAddress(library, "gpr_slice_buffer_addn");
- gpr_slice_buffer_tiny_add_import = (gpr_slice_buffer_tiny_add_type) GetProcAddress(library, "gpr_slice_buffer_tiny_add");
- gpr_slice_buffer_pop_import = (gpr_slice_buffer_pop_type) GetProcAddress(library, "gpr_slice_buffer_pop");
- gpr_slice_buffer_reset_and_unref_import = (gpr_slice_buffer_reset_and_unref_type) GetProcAddress(library, "gpr_slice_buffer_reset_and_unref");
- gpr_slice_buffer_swap_import = (gpr_slice_buffer_swap_type) GetProcAddress(library, "gpr_slice_buffer_swap");
- gpr_slice_buffer_move_into_import = (gpr_slice_buffer_move_into_type) GetProcAddress(library, "gpr_slice_buffer_move_into");
- gpr_slice_buffer_trim_end_import = (gpr_slice_buffer_trim_end_type) GetProcAddress(library, "gpr_slice_buffer_trim_end");
- gpr_slice_buffer_move_first_import = (gpr_slice_buffer_move_first_type) GetProcAddress(library, "gpr_slice_buffer_move_first");
- gpr_slice_buffer_take_first_import = (gpr_slice_buffer_take_first_type) GetProcAddress(library, "gpr_slice_buffer_take_first");
gpr_strdup_import = (gpr_strdup_type) GetProcAddress(library, "gpr_strdup");
gpr_asprintf_import = (gpr_asprintf_type) GetProcAddress(library, "gpr_asprintf");
gpr_subprocess_binary_extension_import = (gpr_subprocess_binary_extension_type) GetProcAddress(library, "gpr_subprocess_binary_extension");
diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.h b/src/ruby/ext/grpc/rb_grpc_imports.generated.h
index c2244150f2..f8467c4e7c 100644
--- a/src/ruby/ext/grpc/rb_grpc_imports.generated.h
+++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.h
@@ -46,6 +46,8 @@
#include <grpc/grpc.h>
#include <grpc/grpc_posix.h>
#include <grpc/grpc_security.h>
+#include <grpc/slice.h>
+#include <grpc/slice_buffer.h>
#include <grpc/support/alloc.h>
#include <grpc/support/avl.h>
#include <grpc/support/cmdline.h>
@@ -54,18 +56,16 @@
#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/log_windows.h>
-#include <grpc/support/slice.h>
-#include <grpc/support/slice_buffer.h>
#include <grpc/support/string_util.h>
#include <grpc/support/subprocess.h>
#include <grpc/support/sync.h>
#include <grpc/support/thd.h>
#include <grpc/support/time.h>
-typedef grpc_byte_buffer *(*grpc_raw_byte_buffer_create_type)(gpr_slice *slices, size_t nslices);
+typedef grpc_byte_buffer *(*grpc_raw_byte_buffer_create_type)(grpc_slice *slices, size_t nslices);
extern grpc_raw_byte_buffer_create_type grpc_raw_byte_buffer_create_import;
#define grpc_raw_byte_buffer_create grpc_raw_byte_buffer_create_import
-typedef grpc_byte_buffer *(*grpc_raw_compressed_byte_buffer_create_type)(gpr_slice *slices, size_t nslices, grpc_compression_algorithm compression);
+typedef grpc_byte_buffer *(*grpc_raw_compressed_byte_buffer_create_type)(grpc_slice *slices, size_t nslices, grpc_compression_algorithm compression);
extern grpc_raw_compressed_byte_buffer_create_type grpc_raw_compressed_byte_buffer_create_import;
#define grpc_raw_compressed_byte_buffer_create grpc_raw_compressed_byte_buffer_create_import
typedef grpc_byte_buffer *(*grpc_byte_buffer_copy_type)(grpc_byte_buffer *bb);
@@ -83,10 +83,10 @@ extern grpc_byte_buffer_reader_init_type grpc_byte_buffer_reader_init_import;
typedef void(*grpc_byte_buffer_reader_destroy_type)(grpc_byte_buffer_reader *reader);
extern grpc_byte_buffer_reader_destroy_type grpc_byte_buffer_reader_destroy_import;
#define grpc_byte_buffer_reader_destroy grpc_byte_buffer_reader_destroy_import
-typedef int(*grpc_byte_buffer_reader_next_type)(grpc_byte_buffer_reader *reader, gpr_slice *slice);
+typedef int(*grpc_byte_buffer_reader_next_type)(grpc_byte_buffer_reader *reader, grpc_slice *slice);
extern grpc_byte_buffer_reader_next_type grpc_byte_buffer_reader_next_import;
#define grpc_byte_buffer_reader_next grpc_byte_buffer_reader_next_import
-typedef gpr_slice(*grpc_byte_buffer_reader_readall_type)(grpc_byte_buffer_reader *reader);
+typedef grpc_slice(*grpc_byte_buffer_reader_readall_type)(grpc_byte_buffer_reader *reader);
extern grpc_byte_buffer_reader_readall_type grpc_byte_buffer_reader_readall_import;
#define grpc_byte_buffer_reader_readall grpc_byte_buffer_reader_readall_import
typedef grpc_byte_buffer *(*grpc_raw_byte_buffer_from_reader_type)(grpc_byte_buffer_reader *reader);
@@ -467,6 +467,93 @@ extern grpc_call_set_credentials_type grpc_call_set_credentials_import;
typedef void(*grpc_server_credentials_set_auth_metadata_processor_type)(grpc_server_credentials *creds, grpc_auth_metadata_processor processor);
extern grpc_server_credentials_set_auth_metadata_processor_type grpc_server_credentials_set_auth_metadata_processor_import;
#define grpc_server_credentials_set_auth_metadata_processor grpc_server_credentials_set_auth_metadata_processor_import
+typedef grpc_slice(*grpc_slice_ref_type)(grpc_slice s);
+extern grpc_slice_ref_type grpc_slice_ref_import;
+#define grpc_slice_ref grpc_slice_ref_import
+typedef void(*grpc_slice_unref_type)(grpc_slice s);
+extern grpc_slice_unref_type grpc_slice_unref_import;
+#define grpc_slice_unref grpc_slice_unref_import
+typedef grpc_slice(*grpc_slice_new_type)(void *p, size_t len, void (*destroy)(void *));
+extern grpc_slice_new_type grpc_slice_new_import;
+#define grpc_slice_new grpc_slice_new_import
+typedef grpc_slice(*grpc_slice_new_with_user_data_type)(void *p, size_t len, void (*destroy)(void *), void *user_data);
+extern grpc_slice_new_with_user_data_type grpc_slice_new_with_user_data_import;
+#define grpc_slice_new_with_user_data grpc_slice_new_with_user_data_import
+typedef grpc_slice(*grpc_slice_new_with_len_type)(void *p, size_t len, void (*destroy)(void *, size_t));
+extern grpc_slice_new_with_len_type grpc_slice_new_with_len_import;
+#define grpc_slice_new_with_len grpc_slice_new_with_len_import
+typedef grpc_slice(*grpc_slice_malloc_type)(size_t length);
+extern grpc_slice_malloc_type grpc_slice_malloc_import;
+#define grpc_slice_malloc grpc_slice_malloc_import
+typedef grpc_slice(*grpc_slice_from_copied_string_type)(const char *source);
+extern grpc_slice_from_copied_string_type grpc_slice_from_copied_string_import;
+#define grpc_slice_from_copied_string grpc_slice_from_copied_string_import
+typedef grpc_slice(*grpc_slice_from_copied_buffer_type)(const char *source, size_t len);
+extern grpc_slice_from_copied_buffer_type grpc_slice_from_copied_buffer_import;
+#define grpc_slice_from_copied_buffer grpc_slice_from_copied_buffer_import
+typedef grpc_slice(*grpc_slice_from_static_string_type)(const char *source);
+extern grpc_slice_from_static_string_type grpc_slice_from_static_string_import;
+#define grpc_slice_from_static_string grpc_slice_from_static_string_import
+typedef grpc_slice(*grpc_slice_sub_type)(grpc_slice s, size_t begin, size_t end);
+extern grpc_slice_sub_type grpc_slice_sub_import;
+#define grpc_slice_sub grpc_slice_sub_import
+typedef grpc_slice(*grpc_slice_sub_no_ref_type)(grpc_slice s, size_t begin, size_t end);
+extern grpc_slice_sub_no_ref_type grpc_slice_sub_no_ref_import;
+#define grpc_slice_sub_no_ref grpc_slice_sub_no_ref_import
+typedef grpc_slice(*grpc_slice_split_tail_type)(grpc_slice *s, size_t split);
+extern grpc_slice_split_tail_type grpc_slice_split_tail_import;
+#define grpc_slice_split_tail grpc_slice_split_tail_import
+typedef grpc_slice(*grpc_slice_split_head_type)(grpc_slice *s, size_t split);
+extern grpc_slice_split_head_type grpc_slice_split_head_import;
+#define grpc_slice_split_head grpc_slice_split_head_import
+typedef grpc_slice(*gpr_empty_slice_type)(void);
+extern gpr_empty_slice_type gpr_empty_slice_import;
+#define gpr_empty_slice gpr_empty_slice_import
+typedef int(*grpc_slice_cmp_type)(grpc_slice a, grpc_slice b);
+extern grpc_slice_cmp_type grpc_slice_cmp_import;
+#define grpc_slice_cmp grpc_slice_cmp_import
+typedef int(*grpc_slice_str_cmp_type)(grpc_slice a, const char *b);
+extern grpc_slice_str_cmp_type grpc_slice_str_cmp_import;
+#define grpc_slice_str_cmp grpc_slice_str_cmp_import
+typedef void(*grpc_slice_buffer_init_type)(grpc_slice_buffer *sb);
+extern grpc_slice_buffer_init_type grpc_slice_buffer_init_import;
+#define grpc_slice_buffer_init grpc_slice_buffer_init_import
+typedef void(*grpc_slice_buffer_destroy_type)(grpc_slice_buffer *sb);
+extern grpc_slice_buffer_destroy_type grpc_slice_buffer_destroy_import;
+#define grpc_slice_buffer_destroy grpc_slice_buffer_destroy_import
+typedef void(*grpc_slice_buffer_add_type)(grpc_slice_buffer *sb, grpc_slice slice);
+extern grpc_slice_buffer_add_type grpc_slice_buffer_add_import;
+#define grpc_slice_buffer_add grpc_slice_buffer_add_import
+typedef size_t(*grpc_slice_buffer_add_indexed_type)(grpc_slice_buffer *sb, grpc_slice slice);
+extern grpc_slice_buffer_add_indexed_type grpc_slice_buffer_add_indexed_import;
+#define grpc_slice_buffer_add_indexed grpc_slice_buffer_add_indexed_import
+typedef void(*grpc_slice_buffer_addn_type)(grpc_slice_buffer *sb, grpc_slice *slices, size_t n);
+extern grpc_slice_buffer_addn_type grpc_slice_buffer_addn_import;
+#define grpc_slice_buffer_addn grpc_slice_buffer_addn_import
+typedef uint8_t *(*grpc_slice_buffer_tiny_add_type)(grpc_slice_buffer *sb, size_t len);
+extern grpc_slice_buffer_tiny_add_type grpc_slice_buffer_tiny_add_import;
+#define grpc_slice_buffer_tiny_add grpc_slice_buffer_tiny_add_import
+typedef void(*grpc_slice_buffer_pop_type)(grpc_slice_buffer *sb);
+extern grpc_slice_buffer_pop_type grpc_slice_buffer_pop_import;
+#define grpc_slice_buffer_pop grpc_slice_buffer_pop_import
+typedef void(*grpc_slice_buffer_reset_and_unref_type)(grpc_slice_buffer *sb);
+extern grpc_slice_buffer_reset_and_unref_type grpc_slice_buffer_reset_and_unref_import;
+#define grpc_slice_buffer_reset_and_unref grpc_slice_buffer_reset_and_unref_import
+typedef void(*grpc_slice_buffer_swap_type)(grpc_slice_buffer *a, grpc_slice_buffer *b);
+extern grpc_slice_buffer_swap_type grpc_slice_buffer_swap_import;
+#define grpc_slice_buffer_swap grpc_slice_buffer_swap_import
+typedef void(*grpc_slice_buffer_move_into_type)(grpc_slice_buffer *src, grpc_slice_buffer *dst);
+extern grpc_slice_buffer_move_into_type grpc_slice_buffer_move_into_import;
+#define grpc_slice_buffer_move_into grpc_slice_buffer_move_into_import
+typedef void(*grpc_slice_buffer_trim_end_type)(grpc_slice_buffer *src, size_t n, grpc_slice_buffer *garbage);
+extern grpc_slice_buffer_trim_end_type grpc_slice_buffer_trim_end_import;
+#define grpc_slice_buffer_trim_end grpc_slice_buffer_trim_end_import
+typedef void(*grpc_slice_buffer_move_first_type)(grpc_slice_buffer *src, size_t n, grpc_slice_buffer *dst);
+extern grpc_slice_buffer_move_first_type grpc_slice_buffer_move_first_import;
+#define grpc_slice_buffer_move_first grpc_slice_buffer_move_first_import
+typedef grpc_slice(*grpc_slice_buffer_take_first_type)(grpc_slice_buffer *src);
+extern grpc_slice_buffer_take_first_type grpc_slice_buffer_take_first_import;
+#define grpc_slice_buffer_take_first grpc_slice_buffer_take_first_import
typedef void *(*gpr_malloc_type)(size_t size);
extern gpr_malloc_type gpr_malloc_import;
#define gpr_malloc gpr_malloc_import
@@ -614,93 +701,6 @@ extern gpr_set_log_function_type gpr_set_log_function_import;
typedef char *(*gpr_format_message_type)(int messageid);
extern gpr_format_message_type gpr_format_message_import;
#define gpr_format_message gpr_format_message_import
-typedef gpr_slice(*gpr_slice_ref_type)(gpr_slice s);
-extern gpr_slice_ref_type gpr_slice_ref_import;
-#define gpr_slice_ref gpr_slice_ref_import
-typedef void(*gpr_slice_unref_type)(gpr_slice s);
-extern gpr_slice_unref_type gpr_slice_unref_import;
-#define gpr_slice_unref gpr_slice_unref_import
-typedef gpr_slice(*gpr_slice_new_type)(void *p, size_t len, void (*destroy)(void *));
-extern gpr_slice_new_type gpr_slice_new_import;
-#define gpr_slice_new gpr_slice_new_import
-typedef gpr_slice(*gpr_slice_new_with_user_data_type)(void *p, size_t len, void (*destroy)(void *), void *user_data);
-extern gpr_slice_new_with_user_data_type gpr_slice_new_with_user_data_import;
-#define gpr_slice_new_with_user_data gpr_slice_new_with_user_data_import
-typedef gpr_slice(*gpr_slice_new_with_len_type)(void *p, size_t len, void (*destroy)(void *, size_t));
-extern gpr_slice_new_with_len_type gpr_slice_new_with_len_import;
-#define gpr_slice_new_with_len gpr_slice_new_with_len_import
-typedef gpr_slice(*gpr_slice_malloc_type)(size_t length);
-extern gpr_slice_malloc_type gpr_slice_malloc_import;
-#define gpr_slice_malloc gpr_slice_malloc_import
-typedef gpr_slice(*gpr_slice_from_copied_string_type)(const char *source);
-extern gpr_slice_from_copied_string_type gpr_slice_from_copied_string_import;
-#define gpr_slice_from_copied_string gpr_slice_from_copied_string_import
-typedef gpr_slice(*gpr_slice_from_copied_buffer_type)(const char *source, size_t len);
-extern gpr_slice_from_copied_buffer_type gpr_slice_from_copied_buffer_import;
-#define gpr_slice_from_copied_buffer gpr_slice_from_copied_buffer_import
-typedef gpr_slice(*gpr_slice_from_static_string_type)(const char *source);
-extern gpr_slice_from_static_string_type gpr_slice_from_static_string_import;
-#define gpr_slice_from_static_string gpr_slice_from_static_string_import
-typedef gpr_slice(*gpr_slice_sub_type)(gpr_slice s, size_t begin, size_t end);
-extern gpr_slice_sub_type gpr_slice_sub_import;
-#define gpr_slice_sub gpr_slice_sub_import
-typedef gpr_slice(*gpr_slice_sub_no_ref_type)(gpr_slice s, size_t begin, size_t end);
-extern gpr_slice_sub_no_ref_type gpr_slice_sub_no_ref_import;
-#define gpr_slice_sub_no_ref gpr_slice_sub_no_ref_import
-typedef gpr_slice(*gpr_slice_split_tail_type)(gpr_slice *s, size_t split);
-extern gpr_slice_split_tail_type gpr_slice_split_tail_import;
-#define gpr_slice_split_tail gpr_slice_split_tail_import
-typedef gpr_slice(*gpr_slice_split_head_type)(gpr_slice *s, size_t split);
-extern gpr_slice_split_head_type gpr_slice_split_head_import;
-#define gpr_slice_split_head gpr_slice_split_head_import
-typedef gpr_slice(*gpr_empty_slice_type)(void);
-extern gpr_empty_slice_type gpr_empty_slice_import;
-#define gpr_empty_slice gpr_empty_slice_import
-typedef int(*gpr_slice_cmp_type)(gpr_slice a, gpr_slice b);
-extern gpr_slice_cmp_type gpr_slice_cmp_import;
-#define gpr_slice_cmp gpr_slice_cmp_import
-typedef int(*gpr_slice_str_cmp_type)(gpr_slice a, const char *b);
-extern gpr_slice_str_cmp_type gpr_slice_str_cmp_import;
-#define gpr_slice_str_cmp gpr_slice_str_cmp_import
-typedef void(*gpr_slice_buffer_init_type)(gpr_slice_buffer *sb);
-extern gpr_slice_buffer_init_type gpr_slice_buffer_init_import;
-#define gpr_slice_buffer_init gpr_slice_buffer_init_import
-typedef void(*gpr_slice_buffer_destroy_type)(gpr_slice_buffer *sb);
-extern gpr_slice_buffer_destroy_type gpr_slice_buffer_destroy_import;
-#define gpr_slice_buffer_destroy gpr_slice_buffer_destroy_import
-typedef void(*gpr_slice_buffer_add_type)(gpr_slice_buffer *sb, gpr_slice slice);
-extern gpr_slice_buffer_add_type gpr_slice_buffer_add_import;
-#define gpr_slice_buffer_add gpr_slice_buffer_add_import
-typedef size_t(*gpr_slice_buffer_add_indexed_type)(gpr_slice_buffer *sb, gpr_slice slice);
-extern gpr_slice_buffer_add_indexed_type gpr_slice_buffer_add_indexed_import;
-#define gpr_slice_buffer_add_indexed gpr_slice_buffer_add_indexed_import
-typedef void(*gpr_slice_buffer_addn_type)(gpr_slice_buffer *sb, gpr_slice *slices, size_t n);
-extern gpr_slice_buffer_addn_type gpr_slice_buffer_addn_import;
-#define gpr_slice_buffer_addn gpr_slice_buffer_addn_import
-typedef uint8_t *(*gpr_slice_buffer_tiny_add_type)(gpr_slice_buffer *sb, size_t len);
-extern gpr_slice_buffer_tiny_add_type gpr_slice_buffer_tiny_add_import;
-#define gpr_slice_buffer_tiny_add gpr_slice_buffer_tiny_add_import
-typedef void(*gpr_slice_buffer_pop_type)(gpr_slice_buffer *sb);
-extern gpr_slice_buffer_pop_type gpr_slice_buffer_pop_import;
-#define gpr_slice_buffer_pop gpr_slice_buffer_pop_import
-typedef void(*gpr_slice_buffer_reset_and_unref_type)(gpr_slice_buffer *sb);
-extern gpr_slice_buffer_reset_and_unref_type gpr_slice_buffer_reset_and_unref_import;
-#define gpr_slice_buffer_reset_and_unref gpr_slice_buffer_reset_and_unref_import
-typedef void(*gpr_slice_buffer_swap_type)(gpr_slice_buffer *a, gpr_slice_buffer *b);
-extern gpr_slice_buffer_swap_type gpr_slice_buffer_swap_import;
-#define gpr_slice_buffer_swap gpr_slice_buffer_swap_import
-typedef void(*gpr_slice_buffer_move_into_type)(gpr_slice_buffer *src, gpr_slice_buffer *dst);
-extern gpr_slice_buffer_move_into_type gpr_slice_buffer_move_into_import;
-#define gpr_slice_buffer_move_into gpr_slice_buffer_move_into_import
-typedef void(*gpr_slice_buffer_trim_end_type)(gpr_slice_buffer *src, size_t n, gpr_slice_buffer *garbage);
-extern gpr_slice_buffer_trim_end_type gpr_slice_buffer_trim_end_import;
-#define gpr_slice_buffer_trim_end gpr_slice_buffer_trim_end_import
-typedef void(*gpr_slice_buffer_move_first_type)(gpr_slice_buffer *src, size_t n, gpr_slice_buffer *dst);
-extern gpr_slice_buffer_move_first_type gpr_slice_buffer_move_first_import;
-#define gpr_slice_buffer_move_first gpr_slice_buffer_move_first_import
-typedef gpr_slice(*gpr_slice_buffer_take_first_type)(gpr_slice_buffer *src);
-extern gpr_slice_buffer_take_first_type gpr_slice_buffer_take_first_import;
-#define gpr_slice_buffer_take_first gpr_slice_buffer_take_first_import
typedef char *(*gpr_strdup_type)(const char *src);
extern gpr_strdup_type gpr_strdup_import;
#define gpr_strdup gpr_strdup_import
diff --git a/test/core/bad_client/bad_client.c b/test/core/bad_client/bad_client.c
index a9638500b7..07fcd995d7 100644
--- a/test/core/bad_client/bad_client.c
+++ b/test/core/bad_client/bad_client.c
@@ -77,7 +77,7 @@ static void server_setup_transport(void *ts, grpc_transport *transport) {
typedef struct {
grpc_bad_client_client_stream_validator validator;
- gpr_slice_buffer incoming;
+ grpc_slice_buffer incoming;
gpr_event read_done;
} read_args;
@@ -96,9 +96,9 @@ void grpc_run_bad_client_test(
gpr_thd_id id;
char *hex;
grpc_transport *transport;
- gpr_slice slice =
- gpr_slice_from_copied_buffer(client_payload, client_payload_length);
- gpr_slice_buffer outgoing;
+ grpc_slice slice =
+ grpc_slice_from_copied_buffer(client_payload, client_payload_length);
+ grpc_slice_buffer outgoing;
grpc_closure done_write_closure;
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
@@ -146,8 +146,8 @@ void grpc_run_bad_client_test(
/* Start validator */
gpr_thd_new(&id, thd_func, &a, NULL);
- gpr_slice_buffer_init(&outgoing);
- gpr_slice_buffer_add(&outgoing, slice);
+ grpc_slice_buffer_init(&outgoing);
+ grpc_slice_buffer_add(&outgoing, slice);
grpc_closure_init(&done_write_closure, done_write, &a);
/* Write data */
@@ -172,7 +172,7 @@ void grpc_run_bad_client_test(
if (client_validator != NULL) {
read_args args;
args.validator = client_validator;
- gpr_slice_buffer_init(&args.incoming);
+ grpc_slice_buffer_init(&args.incoming);
gpr_event_init(&args.read_done);
grpc_closure read_done_closure;
grpc_closure_init(&read_done_closure, read_done, &args);
@@ -181,7 +181,7 @@ void grpc_run_bad_client_test(
grpc_exec_ctx_finish(&exec_ctx);
GPR_ASSERT(
gpr_event_wait(&args.read_done, GRPC_TIMEOUT_SECONDS_TO_DEADLINE(5)));
- gpr_slice_buffer_destroy(&args.incoming);
+ grpc_slice_buffer_destroy(&args.incoming);
}
// Shutdown.
grpc_endpoint_shutdown(&exec_ctx, sfd.client);
@@ -194,7 +194,7 @@ void grpc_run_bad_client_test(
.type == GRPC_OP_COMPLETE);
grpc_server_destroy(a.server);
grpc_completion_queue_destroy(a.cq);
- gpr_slice_buffer_destroy(&outgoing);
+ grpc_slice_buffer_destroy(&outgoing);
grpc_exec_ctx_finish(&exec_ctx);
grpc_shutdown();
diff --git a/test/core/bad_client/bad_client.h b/test/core/bad_client/bad_client.h
index c8b2a4122f..bbca418ef3 100644
--- a/test/core/bad_client/bad_client.h
+++ b/test/core/bad_client/bad_client.h
@@ -45,7 +45,7 @@ typedef void (*grpc_bad_client_server_side_validator)(grpc_server *server,
void *registered_method);
typedef void (*grpc_bad_client_client_stream_validator)(
- gpr_slice_buffer *incoming);
+ grpc_slice_buffer *incoming);
#define GRPC_BAD_CLIENT_DISCONNECT 1
diff --git a/test/core/bad_client/tests/large_metadata.c b/test/core/bad_client/tests/large_metadata.c
index b9c8093ef9..9c804e78c1 100644
--- a/test/core/bad_client/tests/large_metadata.c
+++ b/test/core/bad_client/tests/large_metadata.c
@@ -183,16 +183,16 @@ static void server_verifier_sends_too_much_metadata(grpc_server *server,
cq_verifier_destroy(cqv);
}
-static void client_validator(gpr_slice_buffer *incoming) {
+static void client_validator(grpc_slice_buffer *incoming) {
// Get last frame from incoming slice buffer.
- gpr_slice_buffer last_frame_buffer;
- gpr_slice_buffer_init(&last_frame_buffer);
- gpr_slice_buffer_trim_end(incoming, 13, &last_frame_buffer);
+ grpc_slice_buffer last_frame_buffer;
+ grpc_slice_buffer_init(&last_frame_buffer);
+ grpc_slice_buffer_trim_end(incoming, 13, &last_frame_buffer);
GPR_ASSERT(last_frame_buffer.count == 1);
- gpr_slice last_frame = last_frame_buffer.slices[0];
+ grpc_slice last_frame = last_frame_buffer.slices[0];
// Construct expected frame.
- gpr_slice expected = gpr_slice_malloc(13);
- uint8_t *p = GPR_SLICE_START_PTR(expected);
+ grpc_slice expected = grpc_slice_malloc(13);
+ uint8_t *p = GRPC_SLICE_START_PTR(expected);
// Length.
*p++ = 0;
*p++ = 0;
@@ -212,8 +212,8 @@ static void client_validator(gpr_slice_buffer *incoming) {
*p++ = 0;
*p++ = 11;
// Compare actual and expected.
- GPR_ASSERT(gpr_slice_cmp(last_frame, expected) == 0);
- gpr_slice_buffer_destroy(&last_frame_buffer);
+ GPR_ASSERT(grpc_slice_cmp(last_frame, expected) == 0);
+ grpc_slice_buffer_destroy(&last_frame_buffer);
}
int main(int argc, char **argv) {
diff --git a/test/core/bad_ssl/servers/cert.c b/test/core/bad_ssl/servers/cert.c
index 91dd9de81b..9aadf452e2 100644
--- a/test/core/bad_ssl/servers/cert.c
+++ b/test/core/bad_ssl/servers/cert.c
@@ -51,7 +51,7 @@ int main(int argc, char **argv) {
grpc_ssl_pem_key_cert_pair pem_key_cert_pair;
grpc_server_credentials *ssl_creds;
grpc_server *server;
- gpr_slice cert_slice, key_slice;
+ grpc_slice cert_slice, key_slice;
grpc_init();
@@ -61,8 +61,8 @@ int main(int argc, char **argv) {
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"load_file", grpc_load_file("src/core/lib/tsi/test_creds/badserver.key",
1, &key_slice)));
- pem_key_cert_pair.private_key = (const char *)GPR_SLICE_START_PTR(key_slice);
- pem_key_cert_pair.cert_chain = (const char *)GPR_SLICE_START_PTR(cert_slice);
+ pem_key_cert_pair.private_key = (const char *)GRPC_SLICE_START_PTR(key_slice);
+ pem_key_cert_pair.cert_chain = (const char *)GRPC_SLICE_START_PTR(cert_slice);
ssl_creds =
grpc_ssl_server_credentials_create(NULL, &pem_key_cert_pair, 1, 0, NULL);
@@ -70,8 +70,8 @@ int main(int argc, char **argv) {
GPR_ASSERT(grpc_server_add_secure_http2_port(server, addr, ssl_creds));
grpc_server_credentials_release(ssl_creds);
- gpr_slice_unref(cert_slice);
- gpr_slice_unref(key_slice);
+ grpc_slice_unref(cert_slice);
+ grpc_slice_unref(key_slice);
bad_ssl_run(server);
grpc_shutdown();
diff --git a/test/core/client_channel/set_initial_connect_string_test.c b/test/core/client_channel/set_initial_connect_string_test.c
index d93cad57b4..b16a3ebf45 100644
--- a/test/core/client_channel/set_initial_connect_string_test.c
+++ b/test/core/client_channel/set_initial_connect_string_test.c
@@ -40,15 +40,16 @@
#include <string.h>
#include <grpc/grpc.h>
+#include <grpc/slice.h>
#include <grpc/support/alloc.h>
#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
-#include <grpc/support/slice.h>
#include <grpc/support/thd.h>
#include "src/core/ext/client_channel/initial_connect_string.h"
#include "src/core/lib/iomgr/sockaddr.h"
#include "src/core/lib/security/credentials/fake/fake_credentials.h"
+#include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/lib/support/string.h"
#include "test/core/util/port.h"
#include "test/core/util/test_config.h"
@@ -61,8 +62,8 @@ struct rpc_state {
grpc_channel *channel;
grpc_call *call;
grpc_op op;
- gpr_slice_buffer incoming_buffer;
- gpr_slice_buffer temp_incoming_buffer;
+ grpc_slice_buffer incoming_buffer;
+ grpc_slice_buffer temp_incoming_buffer;
grpc_endpoint *tcp;
gpr_atm done_atm;
};
@@ -74,8 +75,8 @@ static grpc_closure on_read;
static void handle_read(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
GPR_ASSERT(error == GRPC_ERROR_NONE);
- gpr_slice_buffer_move_into(&state.temp_incoming_buffer,
- &state.incoming_buffer);
+ grpc_slice_buffer_move_into(&state.temp_incoming_buffer,
+ &state.incoming_buffer);
gpr_log(GPR_DEBUG, "got %" PRIuPTR " bytes, magic is %" PRIuPTR " bytes",
state.incoming_buffer.length, strlen(magic_connect_string));
if (state.incoming_buffer.length > strlen(magic_connect_string)) {
@@ -93,24 +94,24 @@ static void on_connect(grpc_exec_ctx *exec_ctx, void *arg, grpc_endpoint *tcp,
grpc_tcp_server_acceptor *acceptor) {
test_tcp_server *server = arg;
grpc_closure_init(&on_read, handle_read, NULL);
- gpr_slice_buffer_init(&state.incoming_buffer);
- gpr_slice_buffer_init(&state.temp_incoming_buffer);
+ grpc_slice_buffer_init(&state.incoming_buffer);
+ grpc_slice_buffer_init(&state.temp_incoming_buffer);
state.tcp = tcp;
grpc_endpoint_add_to_pollset(exec_ctx, tcp, server->pollset);
grpc_endpoint_read(exec_ctx, tcp, &state.temp_incoming_buffer, &on_read);
}
static void set_magic_initial_string(grpc_resolved_address **addr,
- gpr_slice *connect_string) {
+ grpc_slice *connect_string) {
GPR_ASSERT(addr);
GPR_ASSERT((*addr)->len);
- *connect_string = gpr_slice_from_copied_string(magic_connect_string);
+ *connect_string = grpc_slice_from_copied_string(magic_connect_string);
}
static void reset_addr_and_set_magic_string(grpc_resolved_address **addr,
- gpr_slice *connect_string) {
+ grpc_slice *connect_string) {
struct sockaddr_in target;
- *connect_string = gpr_slice_from_copied_string(magic_connect_string);
+ *connect_string = grpc_slice_from_copied_string(magic_connect_string);
gpr_free(*addr);
target.sin_family = AF_INET;
target.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
@@ -154,8 +155,8 @@ static void start_rpc(int use_creds, int target_port) {
static void cleanup_rpc(void) {
grpc_event ev;
- gpr_slice_buffer_destroy(&state.incoming_buffer);
- gpr_slice_buffer_destroy(&state.temp_incoming_buffer);
+ grpc_slice_buffer_destroy(&state.incoming_buffer);
+ grpc_slice_buffer_destroy(&state.temp_incoming_buffer);
grpc_channel_credentials_unref(state.creds);
grpc_call_destroy(state.call);
grpc_completion_queue_shutdown(state.cq);
@@ -200,13 +201,13 @@ static void poll_server_until_read_done(test_tcp_server *server,
gpr_thd_new(&id, actually_poll_server, pa, NULL);
}
-static void match_initial_magic_string(gpr_slice_buffer *buffer) {
+static void match_initial_magic_string(grpc_slice_buffer *buffer) {
size_t i, j, cmp_length;
size_t magic_length = strlen(magic_connect_string);
GPR_ASSERT(buffer->length >= magic_length);
for (i = 0, j = 0; i < state.incoming_buffer.count && j < magic_length; i++) {
char *dump =
- gpr_dump_slice(state.incoming_buffer.slices[i], GPR_DUMP_ASCII);
+ grpc_dump_slice(state.incoming_buffer.slices[i], GPR_DUMP_ASCII);
cmp_length = GPR_MIN(strlen(dump), magic_length - j);
GPR_ASSERT(strncmp(dump, magic_connect_string + j, cmp_length) == 0);
j += cmp_length;
diff --git a/test/core/compression/message_compress_test.c b/test/core/compression/message_compress_test.c
index 47ecf72e08..fc53cd9d36 100644
--- a/test/core/compression/message_compress_test.c
+++ b/test/core/compression/message_compress_test.c
@@ -52,16 +52,16 @@ typedef enum {
MAYBE_COMPRESSES
} compressability;
-static void assert_passthrough(gpr_slice value,
+static void assert_passthrough(grpc_slice value,
grpc_compression_algorithm algorithm,
grpc_slice_split_mode uncompressed_split_mode,
grpc_slice_split_mode compressed_split_mode,
compressability compress_result_check) {
- gpr_slice_buffer input;
- gpr_slice_buffer compressed_raw;
- gpr_slice_buffer compressed;
- gpr_slice_buffer output;
- gpr_slice final;
+ grpc_slice_buffer input;
+ grpc_slice_buffer compressed_raw;
+ grpc_slice_buffer compressed;
+ grpc_slice_buffer output;
+ grpc_slice final;
int was_compressed;
char *algorithm_name;
@@ -70,15 +70,15 @@ static void assert_passthrough(gpr_slice value,
GPR_INFO, "assert_passthrough: value_length=%" PRIuPTR
" value_hash=0x%08x "
"algorithm='%s' uncompressed_split='%s' compressed_split='%s'",
- GPR_SLICE_LENGTH(value),
- gpr_murmur_hash3(GPR_SLICE_START_PTR(value), GPR_SLICE_LENGTH(value), 0),
+ GRPC_SLICE_LENGTH(value), gpr_murmur_hash3(GRPC_SLICE_START_PTR(value),
+ GRPC_SLICE_LENGTH(value), 0),
algorithm_name, grpc_slice_split_mode_name(uncompressed_split_mode),
grpc_slice_split_mode_name(compressed_split_mode));
- gpr_slice_buffer_init(&input);
- gpr_slice_buffer_init(&compressed_raw);
- gpr_slice_buffer_init(&compressed);
- gpr_slice_buffer_init(&output);
+ grpc_slice_buffer_init(&input);
+ grpc_slice_buffer_init(&compressed_raw);
+ grpc_slice_buffer_init(&compressed);
+ grpc_slice_buffer_init(&output);
grpc_split_slices_to_buffer(uncompressed_split_mode, &value, 1, &input);
@@ -103,18 +103,18 @@ static void assert_passthrough(gpr_slice value,
was_compressed ? algorithm : GRPC_COMPRESS_NONE, &compressed, &output));
final = grpc_slice_merge(output.slices, output.count);
- GPR_ASSERT(0 == gpr_slice_cmp(value, final));
+ GPR_ASSERT(0 == grpc_slice_cmp(value, final));
- gpr_slice_buffer_destroy(&input);
- gpr_slice_buffer_destroy(&compressed);
- gpr_slice_buffer_destroy(&compressed_raw);
- gpr_slice_buffer_destroy(&output);
- gpr_slice_unref(final);
+ grpc_slice_buffer_destroy(&input);
+ grpc_slice_buffer_destroy(&compressed);
+ grpc_slice_buffer_destroy(&compressed_raw);
+ grpc_slice_buffer_destroy(&output);
+ grpc_slice_unref(final);
}
-static gpr_slice repeated(char c, size_t length) {
- gpr_slice out = gpr_slice_malloc(length);
- memset(GPR_SLICE_START_PTR(out), c, length);
+static grpc_slice repeated(char c, size_t length) {
+ grpc_slice out = grpc_slice_malloc(length);
+ memset(GRPC_SLICE_START_PTR(out), c, length);
return out;
}
@@ -134,10 +134,10 @@ static compressability get_compressability(
return MAYBE_COMPRESSES;
}
-static gpr_slice create_test_value(test_value id) {
+static grpc_slice create_test_value(test_value id) {
switch (id) {
case ONE_A:
- return gpr_slice_from_copied_string("a");
+ return grpc_slice_from_copied_string("a");
case ONE_KB_A:
return repeated('a', 1024);
case ONE_MB_A:
@@ -146,17 +146,17 @@ static gpr_slice create_test_value(test_value id) {
abort();
break;
}
- return gpr_slice_from_copied_string("bad value");
+ return grpc_slice_from_copied_string("bad value");
}
static void test_tiny_data_compress(void) {
- gpr_slice_buffer input;
- gpr_slice_buffer output;
+ grpc_slice_buffer input;
+ grpc_slice_buffer output;
grpc_compression_algorithm i;
- gpr_slice_buffer_init(&input);
- gpr_slice_buffer_init(&output);
- gpr_slice_buffer_add(&input, create_test_value(ONE_A));
+ grpc_slice_buffer_init(&input);
+ grpc_slice_buffer_init(&output);
+ grpc_slice_buffer_add(&input, create_test_value(ONE_A));
for (i = 0; i < GRPC_COMPRESS_ALGORITHMS_COUNT; i++) {
if (i == GRPC_COMPRESS_NONE) continue;
@@ -164,81 +164,81 @@ static void test_tiny_data_compress(void) {
GPR_ASSERT(1 == output.count);
}
- gpr_slice_buffer_destroy(&input);
- gpr_slice_buffer_destroy(&output);
+ grpc_slice_buffer_destroy(&input);
+ grpc_slice_buffer_destroy(&output);
}
static void test_bad_decompression_data_crc(void) {
- gpr_slice_buffer input;
- gpr_slice_buffer corrupted;
- gpr_slice_buffer output;
+ grpc_slice_buffer input;
+ grpc_slice_buffer corrupted;
+ grpc_slice_buffer output;
size_t idx;
const uint32_t bad = 0xdeadbeef;
- gpr_slice_buffer_init(&input);
- gpr_slice_buffer_init(&corrupted);
- gpr_slice_buffer_init(&output);
- gpr_slice_buffer_add(&input, create_test_value(ONE_MB_A));
+ grpc_slice_buffer_init(&input);
+ grpc_slice_buffer_init(&corrupted);
+ grpc_slice_buffer_init(&output);
+ grpc_slice_buffer_add(&input, create_test_value(ONE_MB_A));
/* compress it */
grpc_msg_compress(GRPC_COMPRESS_GZIP, &input, &corrupted);
/* corrupt the output by smashing the CRC */
GPR_ASSERT(corrupted.count > 1);
- GPR_ASSERT(GPR_SLICE_LENGTH(corrupted.slices[1]) > 8);
- idx = GPR_SLICE_LENGTH(corrupted.slices[1]) - 8;
- memcpy(GPR_SLICE_START_PTR(corrupted.slices[1]) + idx, &bad, 4);
+ GPR_ASSERT(GRPC_SLICE_LENGTH(corrupted.slices[1]) > 8);
+ idx = GRPC_SLICE_LENGTH(corrupted.slices[1]) - 8;
+ memcpy(GRPC_SLICE_START_PTR(corrupted.slices[1]) + idx, &bad, 4);
/* try (and fail) to decompress the corrupted compresed buffer */
GPR_ASSERT(0 == grpc_msg_decompress(GRPC_COMPRESS_GZIP, &corrupted, &output));
- gpr_slice_buffer_destroy(&input);
- gpr_slice_buffer_destroy(&corrupted);
- gpr_slice_buffer_destroy(&output);
+ grpc_slice_buffer_destroy(&input);
+ grpc_slice_buffer_destroy(&corrupted);
+ grpc_slice_buffer_destroy(&output);
}
static void test_bad_decompression_data_trailing_garbage(void) {
- gpr_slice_buffer input;
- gpr_slice_buffer output;
+ grpc_slice_buffer input;
+ grpc_slice_buffer output;
- gpr_slice_buffer_init(&input);
- gpr_slice_buffer_init(&output);
+ grpc_slice_buffer_init(&input);
+ grpc_slice_buffer_init(&output);
/* append 0x99 to the end of an otherwise valid stream */
- gpr_slice_buffer_add(
- &input, gpr_slice_from_copied_buffer(
+ grpc_slice_buffer_add(
+ &input, grpc_slice_from_copied_buffer(
"\x78\xda\x63\x60\x60\x60\x00\x00\x00\x04\x00\x01\x99", 13));
/* try (and fail) to decompress the invalid compresed buffer */
GPR_ASSERT(0 == grpc_msg_decompress(GRPC_COMPRESS_DEFLATE, &input, &output));
- gpr_slice_buffer_destroy(&input);
- gpr_slice_buffer_destroy(&output);
+ grpc_slice_buffer_destroy(&input);
+ grpc_slice_buffer_destroy(&output);
}
static void test_bad_decompression_data_stream(void) {
- gpr_slice_buffer input;
- gpr_slice_buffer output;
+ grpc_slice_buffer input;
+ grpc_slice_buffer output;
- gpr_slice_buffer_init(&input);
- gpr_slice_buffer_init(&output);
- gpr_slice_buffer_add(&input,
- gpr_slice_from_copied_buffer("\x78\xda\xff\xff", 4));
+ grpc_slice_buffer_init(&input);
+ grpc_slice_buffer_init(&output);
+ grpc_slice_buffer_add(&input,
+ grpc_slice_from_copied_buffer("\x78\xda\xff\xff", 4));
/* try (and fail) to decompress the invalid compresed buffer */
GPR_ASSERT(0 == grpc_msg_decompress(GRPC_COMPRESS_DEFLATE, &input, &output));
- gpr_slice_buffer_destroy(&input);
- gpr_slice_buffer_destroy(&output);
+ grpc_slice_buffer_destroy(&input);
+ grpc_slice_buffer_destroy(&output);
}
static void test_bad_compression_algorithm(void) {
- gpr_slice_buffer input;
- gpr_slice_buffer output;
+ grpc_slice_buffer input;
+ grpc_slice_buffer output;
int was_compressed;
- gpr_slice_buffer_init(&input);
- gpr_slice_buffer_init(&output);
- gpr_slice_buffer_add(&input,
- gpr_slice_from_copied_string("Never gonna give you up"));
+ grpc_slice_buffer_init(&input);
+ grpc_slice_buffer_init(&output);
+ grpc_slice_buffer_add(
+ &input, grpc_slice_from_copied_string("Never gonna give you up"));
was_compressed =
grpc_msg_compress(GRPC_COMPRESS_ALGORITHMS_COUNT, &input, &output);
GPR_ASSERT(0 == was_compressed);
@@ -247,20 +247,20 @@ static void test_bad_compression_algorithm(void) {
grpc_msg_compress(GRPC_COMPRESS_ALGORITHMS_COUNT + 123, &input, &output);
GPR_ASSERT(0 == was_compressed);
- gpr_slice_buffer_destroy(&input);
- gpr_slice_buffer_destroy(&output);
+ grpc_slice_buffer_destroy(&input);
+ grpc_slice_buffer_destroy(&output);
}
static void test_bad_decompression_algorithm(void) {
- gpr_slice_buffer input;
- gpr_slice_buffer output;
+ grpc_slice_buffer input;
+ grpc_slice_buffer output;
int was_decompressed;
- gpr_slice_buffer_init(&input);
- gpr_slice_buffer_init(&output);
- gpr_slice_buffer_add(&input,
- gpr_slice_from_copied_string(
- "I'm not really compressed but it doesn't matter"));
+ grpc_slice_buffer_init(&input);
+ grpc_slice_buffer_init(&output);
+ grpc_slice_buffer_add(&input,
+ grpc_slice_from_copied_string(
+ "I'm not really compressed but it doesn't matter"));
was_decompressed =
grpc_msg_decompress(GRPC_COMPRESS_ALGORITHMS_COUNT, &input, &output);
GPR_ASSERT(0 == was_decompressed);
@@ -269,8 +269,8 @@ static void test_bad_decompression_algorithm(void) {
&input, &output);
GPR_ASSERT(0 == was_decompressed);
- gpr_slice_buffer_destroy(&input);
- gpr_slice_buffer_destroy(&output);
+ grpc_slice_buffer_destroy(&input);
+ grpc_slice_buffer_destroy(&output);
}
int main(int argc, char **argv) {
@@ -288,9 +288,9 @@ int main(int argc, char **argv) {
for (j = 0; j < GPR_ARRAY_SIZE(uncompressed_split_modes); j++) {
for (k = 0; k < GPR_ARRAY_SIZE(compressed_split_modes); k++) {
for (m = 0; m < TEST_VALUE_COUNT; m++) {
- gpr_slice slice = create_test_value(m);
+ grpc_slice slice = create_test_value(m);
assert_passthrough(slice, i, j, k, get_compressability(m, i));
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
}
}
}
diff --git a/test/core/end2end/bad_server_response_test.c b/test/core/end2end/bad_server_response_test.c
index 9a3e1301f9..1c4a17fda8 100644
--- a/test/core/end2end/bad_server_response_test.c
+++ b/test/core/end2end/bad_server_response_test.c
@@ -40,13 +40,14 @@
#include <string.h>
#include <grpc/grpc.h>
+#include <grpc/slice.h>
#include <grpc/support/alloc.h>
#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
-#include <grpc/support/slice.h>
#include <grpc/support/thd.h>
-// #include "src/core/ext/transport/chttp2/transport/internal.h"
+#include "src/core/lib/iomgr/sockaddr.h"
+#include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/lib/support/string.h"
#include "test/core/end2end/cq_verifier.h"
#include "test/core/util/port.h"
@@ -88,8 +89,8 @@ struct rpc_state {
grpc_channel *channel;
grpc_call *call;
size_t incoming_data_length;
- gpr_slice_buffer temp_incoming_buffer;
- gpr_slice_buffer outgoing_buffer;
+ grpc_slice_buffer temp_incoming_buffer;
+ grpc_slice_buffer outgoing_buffer;
grpc_endpoint *tcp;
gpr_atm done_atm;
bool write_done;
@@ -111,11 +112,11 @@ static void done_write(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
}
static void handle_write(grpc_exec_ctx *exec_ctx) {
- gpr_slice slice = gpr_slice_from_copied_buffer(state.response_payload,
- state.response_payload_length);
+ grpc_slice slice = grpc_slice_from_copied_buffer(
+ state.response_payload, state.response_payload_length);
- gpr_slice_buffer_reset_and_unref(&state.outgoing_buffer);
- gpr_slice_buffer_add(&state.outgoing_buffer, slice);
+ grpc_slice_buffer_reset_and_unref(&state.outgoing_buffer);
+ grpc_slice_buffer_add(&state.outgoing_buffer, slice);
grpc_endpoint_write(exec_ctx, state.tcp, &state.outgoing_buffer, &on_write);
}
@@ -125,8 +126,8 @@ static void handle_read(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
size_t i;
for (i = 0; i < state.temp_incoming_buffer.count; i++) {
- char *dump = gpr_dump_slice(state.temp_incoming_buffer.slices[i],
- GPR_DUMP_HEX | GPR_DUMP_ASCII);
+ char *dump = grpc_dump_slice(state.temp_incoming_buffer.slices[i],
+ GPR_DUMP_HEX | GPR_DUMP_ASCII);
gpr_log(GPR_DEBUG, "Server received: %s", dump);
gpr_free(dump);
}
@@ -147,8 +148,8 @@ static void on_connect(grpc_exec_ctx *exec_ctx, void *arg, grpc_endpoint *tcp,
test_tcp_server *server = arg;
grpc_closure_init(&on_read, handle_read, NULL);
grpc_closure_init(&on_write, done_write, NULL);
- gpr_slice_buffer_init(&state.temp_incoming_buffer);
- gpr_slice_buffer_init(&state.outgoing_buffer);
+ grpc_slice_buffer_init(&state.temp_incoming_buffer);
+ grpc_slice_buffer_init(&state.outgoing_buffer);
state.tcp = tcp;
state.incoming_data_length = 0;
grpc_endpoint_add_to_pollset(exec_ctx, tcp, server->pollset);
@@ -227,8 +228,8 @@ static void start_rpc(int target_port, grpc_status_code expected_status,
static void cleanup_rpc(void) {
grpc_event ev;
- gpr_slice_buffer_destroy(&state.temp_incoming_buffer);
- gpr_slice_buffer_destroy(&state.outgoing_buffer);
+ grpc_slice_buffer_destroy(&state.temp_incoming_buffer);
+ grpc_slice_buffer_destroy(&state.outgoing_buffer);
grpc_call_destroy(state.call);
grpc_completion_queue_shutdown(state.cq);
do {
diff --git a/test/core/end2end/cq_verifier.c b/test/core/end2end/cq_verifier.c
index 3e7e3f22a2..57373970c4 100644
--- a/test/core/end2end/cq_verifier.c
+++ b/test/core/end2end/cq_verifier.c
@@ -105,44 +105,45 @@ int contains_metadata(grpc_metadata_array *array, const char *key,
return has_metadata(array->metadata, array->count, key, value);
}
-static gpr_slice merge_slices(gpr_slice *slices, size_t nslices) {
+static grpc_slice merge_slices(grpc_slice *slices, size_t nslices) {
size_t i;
size_t len = 0;
uint8_t *cursor;
- gpr_slice out;
+ grpc_slice out;
for (i = 0; i < nslices; i++) {
- len += GPR_SLICE_LENGTH(slices[i]);
+ len += GRPC_SLICE_LENGTH(slices[i]);
}
- out = gpr_slice_malloc(len);
- cursor = GPR_SLICE_START_PTR(out);
+ out = grpc_slice_malloc(len);
+ cursor = GRPC_SLICE_START_PTR(out);
for (i = 0; i < nslices; i++) {
- memcpy(cursor, GPR_SLICE_START_PTR(slices[i]), GPR_SLICE_LENGTH(slices[i]));
- cursor += GPR_SLICE_LENGTH(slices[i]);
+ memcpy(cursor, GRPC_SLICE_START_PTR(slices[i]),
+ GRPC_SLICE_LENGTH(slices[i]));
+ cursor += GRPC_SLICE_LENGTH(slices[i]);
}
return out;
}
-int raw_byte_buffer_eq_slice(grpc_byte_buffer *rbb, gpr_slice b) {
- gpr_slice a;
+int raw_byte_buffer_eq_slice(grpc_byte_buffer *rbb, grpc_slice b) {
+ grpc_slice a;
int ok;
if (!rbb) return 0;
a = merge_slices(rbb->data.raw.slice_buffer.slices,
rbb->data.raw.slice_buffer.count);
- ok = GPR_SLICE_LENGTH(a) == GPR_SLICE_LENGTH(b) &&
- 0 == memcmp(GPR_SLICE_START_PTR(a), GPR_SLICE_START_PTR(b),
- GPR_SLICE_LENGTH(a));
- gpr_slice_unref(a);
- gpr_slice_unref(b);
+ ok = GRPC_SLICE_LENGTH(a) == GRPC_SLICE_LENGTH(b) &&
+ 0 == memcmp(GRPC_SLICE_START_PTR(a), GRPC_SLICE_START_PTR(b),
+ GRPC_SLICE_LENGTH(a));
+ grpc_slice_unref(a);
+ grpc_slice_unref(b);
return ok;
}
-int byte_buffer_eq_slice(grpc_byte_buffer *bb, gpr_slice b) {
+int byte_buffer_eq_slice(grpc_byte_buffer *bb, grpc_slice b) {
grpc_byte_buffer_reader reader;
grpc_byte_buffer *rbb;
int res;
@@ -165,7 +166,7 @@ int byte_buffer_eq_string(grpc_byte_buffer *bb, const char *str) {
GPR_ASSERT(grpc_byte_buffer_reader_init(&reader, bb) &&
"Couldn't init byte buffer reader");
rbb = grpc_raw_byte_buffer_from_reader(&reader);
- res = raw_byte_buffer_eq_slice(rbb, gpr_slice_from_copied_string(str));
+ res = raw_byte_buffer_eq_slice(rbb, grpc_slice_from_copied_string(str));
grpc_byte_buffer_reader_destroy(&reader);
grpc_byte_buffer_destroy(rbb);
diff --git a/test/core/end2end/cq_verifier.h b/test/core/end2end/cq_verifier.h
index 47464fa319..b754de9bbe 100644
--- a/test/core/end2end/cq_verifier.h
+++ b/test/core/end2end/cq_verifier.h
@@ -67,7 +67,7 @@ void cq_expect_completion(cq_verifier *v, const char *file, int line, void *tag,
#define CQ_EXPECT_COMPLETION(v, tag, success) \
cq_expect_completion(v, __FILE__, __LINE__, tag, success)
-int byte_buffer_eq_slice(grpc_byte_buffer *bb, gpr_slice b);
+int byte_buffer_eq_slice(grpc_byte_buffer *bb, grpc_slice b);
int byte_buffer_eq_string(grpc_byte_buffer *byte_buffer, const char *string);
int contains_metadata(grpc_metadata_array *array, const char *key,
const char *value);
diff --git a/test/core/end2end/dualstack_socket_test.c b/test/core/end2end/dualstack_socket_test.c
index f427202a7b..11e8604f56 100644
--- a/test/core/end2end/dualstack_socket_test.c
+++ b/test/core/end2end/dualstack_socket_test.c
@@ -46,8 +46,8 @@
#include "src/core/lib/iomgr/resolve_address.h"
#include "src/core/lib/iomgr/socket_utils_posix.h"
+#include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/lib/support/string.h"
-
#include "test/core/end2end/cq_verifier.h"
#include "test/core/util/port.h"
#include "test/core/util/test_config.h"
@@ -125,17 +125,17 @@ void test_connect(const char *server_host, const char *client_host, int port,
if (client_host[0] == 'i') {
/* for ipv4:/ipv6: addresses, concatenate the port to each of the parts */
size_t i;
- gpr_slice uri_slice;
- gpr_slice_buffer uri_parts;
+ grpc_slice uri_slice;
+ grpc_slice_buffer uri_parts;
char **hosts_with_port;
uri_slice =
- gpr_slice_new((char *)client_host, strlen(client_host), do_nothing);
- gpr_slice_buffer_init(&uri_parts);
- gpr_slice_split(uri_slice, ",", &uri_parts);
+ grpc_slice_new((char *)client_host, strlen(client_host), do_nothing);
+ grpc_slice_buffer_init(&uri_parts);
+ grpc_slice_split(uri_slice, ",", &uri_parts);
hosts_with_port = gpr_malloc(sizeof(char *) * uri_parts.count);
for (i = 0; i < uri_parts.count; i++) {
- char *uri_part_str = gpr_dump_slice(uri_parts.slices[i], GPR_DUMP_ASCII);
+ char *uri_part_str = grpc_dump_slice(uri_parts.slices[i], GPR_DUMP_ASCII);
gpr_asprintf(&hosts_with_port[i], "%s:%d", uri_part_str, port);
gpr_free(uri_part_str);
}
@@ -145,8 +145,8 @@ void test_connect(const char *server_host, const char *client_host, int port,
gpr_free(hosts_with_port[i]);
}
gpr_free(hosts_with_port);
- gpr_slice_buffer_destroy(&uri_parts);
- gpr_slice_unref(uri_slice);
+ grpc_slice_buffer_destroy(&uri_parts);
+ grpc_slice_unref(uri_slice);
} else {
gpr_join_host_port(&client_hostport, client_host, port);
}
diff --git a/test/core/end2end/fake_resolver.c b/test/core/end2end/fake_resolver.c
index 51fa8ec2d5..865b55de4d 100644
--- a/test/core/end2end/fake_resolver.c
+++ b/test/core/end2end/fake_resolver.c
@@ -48,6 +48,7 @@
#include "src/core/lib/channel/channel_args.h"
#include "src/core/lib/iomgr/resolve_address.h"
#include "src/core/lib/iomgr/unix_sockets_posix.h"
+#include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/lib/support/string.h"
//
@@ -152,17 +153,17 @@ static grpc_resolver* fake_resolver_create(grpc_resolver_factory* factory,
const bool lb_enabled =
lb_enabled_qpart != NULL && strcmp("0", lb_enabled_qpart) != 0;
// Construct addresses.
- gpr_slice path_slice =
- gpr_slice_new(args->uri->path, strlen(args->uri->path), do_nothing);
- gpr_slice_buffer path_parts;
- gpr_slice_buffer_init(&path_parts);
- gpr_slice_split(path_slice, ",", &path_parts);
+ grpc_slice path_slice =
+ grpc_slice_new(args->uri->path, strlen(args->uri->path), do_nothing);
+ grpc_slice_buffer path_parts;
+ grpc_slice_buffer_init(&path_parts);
+ grpc_slice_split(path_slice, ",", &path_parts);
grpc_lb_addresses* addresses =
grpc_lb_addresses_create(path_parts.count, NULL /* user_data_vtable */);
bool errors_found = false;
for (size_t i = 0; i < addresses->num_addresses; i++) {
grpc_uri ith_uri = *args->uri;
- char* part_str = gpr_dump_slice(path_parts.slices[i], GPR_DUMP_ASCII);
+ char* part_str = grpc_dump_slice(path_parts.slices[i], GPR_DUMP_ASCII);
ith_uri.path = part_str;
if (!parse_ipv4(&ith_uri, &addresses->addresses[i].address)) {
errors_found = true;
@@ -171,8 +172,8 @@ static grpc_resolver* fake_resolver_create(grpc_resolver_factory* factory,
addresses->addresses[i].is_balancer = lb_enabled;
if (errors_found) break;
}
- gpr_slice_buffer_destroy(&path_parts);
- gpr_slice_unref(path_slice);
+ grpc_slice_buffer_destroy(&path_parts);
+ grpc_slice_unref(path_slice);
if (errors_found) {
grpc_lb_addresses_destroy(addresses);
return NULL;
diff --git a/test/core/end2end/fixtures/http_proxy.c b/test/core/end2end/fixtures/http_proxy.c
index 630f47ef0e..57fc4a38f8 100644
--- a/test/core/end2end/fixtures/http_proxy.c
+++ b/test/core/end2end/fixtures/http_proxy.c
@@ -37,11 +37,11 @@
#include <string.h>
+#include <grpc/slice_buffer.h>
#include <grpc/support/alloc.h>
#include <grpc/support/atm.h>
#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
-#include <grpc/support/slice_buffer.h>
#include <grpc/support/string_util.h>
#include <grpc/support/sync.h>
#include <grpc/support/thd.h>
@@ -91,12 +91,12 @@ typedef struct proxy_connection {
grpc_closure on_server_read_done;
grpc_closure on_server_write_done;
- gpr_slice_buffer client_read_buffer;
- gpr_slice_buffer client_deferred_write_buffer;
- gpr_slice_buffer client_write_buffer;
- gpr_slice_buffer server_read_buffer;
- gpr_slice_buffer server_deferred_write_buffer;
- gpr_slice_buffer server_write_buffer;
+ grpc_slice_buffer client_read_buffer;
+ grpc_slice_buffer client_deferred_write_buffer;
+ grpc_slice_buffer client_write_buffer;
+ grpc_slice_buffer server_read_buffer;
+ grpc_slice_buffer server_deferred_write_buffer;
+ grpc_slice_buffer server_write_buffer;
grpc_http_parser http_parser;
grpc_http_request http_request;
@@ -110,12 +110,12 @@ static void proxy_connection_unref(grpc_exec_ctx* exec_ctx,
if (conn->server_endpoint != NULL)
grpc_endpoint_destroy(exec_ctx, conn->server_endpoint);
grpc_pollset_set_destroy(conn->pollset_set);
- gpr_slice_buffer_destroy(&conn->client_read_buffer);
- gpr_slice_buffer_destroy(&conn->client_deferred_write_buffer);
- gpr_slice_buffer_destroy(&conn->client_write_buffer);
- gpr_slice_buffer_destroy(&conn->server_read_buffer);
- gpr_slice_buffer_destroy(&conn->server_deferred_write_buffer);
- gpr_slice_buffer_destroy(&conn->server_write_buffer);
+ grpc_slice_buffer_destroy(&conn->client_read_buffer);
+ grpc_slice_buffer_destroy(&conn->client_deferred_write_buffer);
+ grpc_slice_buffer_destroy(&conn->client_write_buffer);
+ grpc_slice_buffer_destroy(&conn->server_read_buffer);
+ grpc_slice_buffer_destroy(&conn->server_deferred_write_buffer);
+ grpc_slice_buffer_destroy(&conn->server_write_buffer);
grpc_http_parser_destroy(&conn->http_parser);
grpc_http_request_destroy(&conn->http_request);
gpr_free(conn);
@@ -146,12 +146,12 @@ static void on_client_write_done(grpc_exec_ctx* exec_ctx, void* arg,
return;
}
// Clear write buffer (the data we just wrote).
- gpr_slice_buffer_reset_and_unref(&conn->client_write_buffer);
+ grpc_slice_buffer_reset_and_unref(&conn->client_write_buffer);
// If more data was read from the server since we started this write,
// write that data now.
if (conn->client_deferred_write_buffer.length > 0) {
- gpr_slice_buffer_move_into(&conn->client_deferred_write_buffer,
- &conn->client_write_buffer);
+ grpc_slice_buffer_move_into(&conn->client_deferred_write_buffer,
+ &conn->client_write_buffer);
grpc_endpoint_write(exec_ctx, conn->client_endpoint,
&conn->client_write_buffer,
&conn->on_client_write_done);
@@ -171,12 +171,12 @@ static void on_server_write_done(grpc_exec_ctx* exec_ctx, void* arg,
return;
}
// Clear write buffer (the data we just wrote).
- gpr_slice_buffer_reset_and_unref(&conn->server_write_buffer);
+ grpc_slice_buffer_reset_and_unref(&conn->server_write_buffer);
// If more data was read from the client since we started this write,
// write that data now.
if (conn->server_deferred_write_buffer.length > 0) {
- gpr_slice_buffer_move_into(&conn->server_deferred_write_buffer,
- &conn->server_write_buffer);
+ grpc_slice_buffer_move_into(&conn->server_deferred_write_buffer,
+ &conn->server_write_buffer);
grpc_endpoint_write(exec_ctx, conn->server_endpoint,
&conn->server_write_buffer,
&conn->on_server_write_done);
@@ -203,11 +203,11 @@ static void on_client_read_done(grpc_exec_ctx* exec_ctx, void* arg,
//
// Otherwise, move the read data into the write buffer and write it.
if (conn->server_write_buffer.length > 0) {
- gpr_slice_buffer_move_into(&conn->client_read_buffer,
- &conn->server_deferred_write_buffer);
+ grpc_slice_buffer_move_into(&conn->client_read_buffer,
+ &conn->server_deferred_write_buffer);
} else {
- gpr_slice_buffer_move_into(&conn->client_read_buffer,
- &conn->server_write_buffer);
+ grpc_slice_buffer_move_into(&conn->client_read_buffer,
+ &conn->server_write_buffer);
gpr_ref(&conn->refcount);
grpc_endpoint_write(exec_ctx, conn->server_endpoint,
&conn->server_write_buffer,
@@ -235,11 +235,11 @@ static void on_server_read_done(grpc_exec_ctx* exec_ctx, void* arg,
//
// Otherwise, move the read data into the write buffer and write it.
if (conn->client_write_buffer.length > 0) {
- gpr_slice_buffer_move_into(&conn->server_read_buffer,
- &conn->client_deferred_write_buffer);
+ grpc_slice_buffer_move_into(&conn->server_read_buffer,
+ &conn->client_deferred_write_buffer);
} else {
- gpr_slice_buffer_move_into(&conn->server_read_buffer,
- &conn->client_write_buffer);
+ grpc_slice_buffer_move_into(&conn->server_read_buffer,
+ &conn->client_write_buffer);
gpr_ref(&conn->refcount);
grpc_endpoint_write(exec_ctx, conn->client_endpoint,
&conn->client_write_buffer,
@@ -260,7 +260,7 @@ static void on_write_response_done(grpc_exec_ctx* exec_ctx, void* arg,
return;
}
// Clear write buffer.
- gpr_slice_buffer_reset_and_unref(&conn->client_write_buffer);
+ grpc_slice_buffer_reset_and_unref(&conn->client_write_buffer);
// Start reading from both client and server. One of the read
// requests inherits our ref to conn, but we need to take a new ref
// for the other one.
@@ -289,9 +289,9 @@ static void on_server_connect_done(grpc_exec_ctx* exec_ctx, void* arg,
// We've established a connection, so send back a 200 response code to
// the client.
// The write callback inherits our reference to conn.
- gpr_slice slice =
- gpr_slice_from_copied_string("HTTP/1.0 200 connected\r\n\r\n");
- gpr_slice_buffer_add(&conn->client_write_buffer, slice);
+ grpc_slice slice =
+ grpc_slice_from_copied_string("HTTP/1.0 200 connected\r\n\r\n");
+ grpc_slice_buffer_add(&conn->client_write_buffer, slice);
grpc_endpoint_write(exec_ctx, conn->client_endpoint,
&conn->client_write_buffer,
&conn->on_write_response_done);
@@ -313,7 +313,7 @@ static void on_read_request_done(grpc_exec_ctx* exec_ctx, void* arg,
}
// Read request and feed it to the parser.
for (size_t i = 0; i < conn->client_read_buffer.count; ++i) {
- if (GPR_SLICE_LENGTH(conn->client_read_buffer.slices[i]) > 0) {
+ if (GRPC_SLICE_LENGTH(conn->client_read_buffer.slices[i]) > 0) {
error = grpc_http_parser_parse(&conn->http_parser,
conn->client_read_buffer.slices[i], NULL);
if (error != GRPC_ERROR_NONE) {
@@ -324,7 +324,7 @@ static void on_read_request_done(grpc_exec_ctx* exec_ctx, void* arg,
}
}
}
- gpr_slice_buffer_reset_and_unref(&conn->client_read_buffer);
+ grpc_slice_buffer_reset_and_unref(&conn->client_read_buffer);
// If we're not done reading the request, read more data.
if (conn->http_parser.state != GRPC_HTTP_BODY) {
grpc_endpoint_read(exec_ctx, conn->client_endpoint,
@@ -384,12 +384,12 @@ static void on_accept(grpc_exec_ctx* exec_ctx, void* arg,
grpc_closure_init(&conn->on_client_write_done, on_client_write_done, conn);
grpc_closure_init(&conn->on_server_read_done, on_server_read_done, conn);
grpc_closure_init(&conn->on_server_write_done, on_server_write_done, conn);
- gpr_slice_buffer_init(&conn->client_read_buffer);
- gpr_slice_buffer_init(&conn->client_deferred_write_buffer);
- gpr_slice_buffer_init(&conn->client_write_buffer);
- gpr_slice_buffer_init(&conn->server_read_buffer);
- gpr_slice_buffer_init(&conn->server_deferred_write_buffer);
- gpr_slice_buffer_init(&conn->server_write_buffer);
+ grpc_slice_buffer_init(&conn->client_read_buffer);
+ grpc_slice_buffer_init(&conn->client_deferred_write_buffer);
+ grpc_slice_buffer_init(&conn->client_write_buffer);
+ grpc_slice_buffer_init(&conn->server_read_buffer);
+ grpc_slice_buffer_init(&conn->server_deferred_write_buffer);
+ grpc_slice_buffer_init(&conn->server_write_buffer);
grpc_http_parser_init(&conn->http_parser, GRPC_HTTP_REQUEST,
&conn->http_request);
grpc_endpoint_read(exec_ctx, conn->client_endpoint, &conn->client_read_buffer,
diff --git a/test/core/end2end/fuzzers/api_fuzzer.c b/test/core/end2end/fuzzers/api_fuzzer.c
index d1f41fdf9a..19ac6ced14 100644
--- a/test/core/end2end/fuzzers/api_fuzzer.c
+++ b/test/core/end2end/fuzzers/api_fuzzer.c
@@ -154,10 +154,10 @@ static uint32_t read_uint32(input_stream *inp) {
}
static grpc_byte_buffer *read_message(input_stream *inp) {
- gpr_slice slice = gpr_slice_malloc(read_uint22(inp));
- memset(GPR_SLICE_START_PTR(slice), 0, GPR_SLICE_LENGTH(slice));
+ grpc_slice slice = grpc_slice_malloc(read_uint22(inp));
+ memset(GRPC_SLICE_START_PTR(slice), 0, GRPC_SLICE_LENGTH(slice));
grpc_byte_buffer *out = grpc_raw_byte_buffer_create(&slice, 1);
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
return out;
}
diff --git a/test/core/end2end/fuzzers/client_fuzzer.c b/test/core/end2end/fuzzers/client_fuzzer.c
index d104fe55e5..c5260cd287 100644
--- a/test/core/end2end/fuzzers/client_fuzzer.c
+++ b/test/core/end2end/fuzzers/client_fuzzer.c
@@ -44,7 +44,7 @@
bool squelch = true;
bool leak_check = true;
-static void discard_write(gpr_slice slice) {}
+static void discard_write(grpc_slice slice) {}
static void *tag(int n) { return (void *)(uintptr_t)n; }
@@ -121,7 +121,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
grpc_mock_endpoint_put_read(
&exec_ctx, mock_endpoint,
- gpr_slice_from_copied_buffer((const char *)data, size));
+ grpc_slice_from_copied_buffer((const char *)data, size));
grpc_event ev;
while (1) {
diff --git a/test/core/end2end/fuzzers/server_fuzzer.c b/test/core/end2end/fuzzers/server_fuzzer.c
index ae4c8e658d..164022ec79 100644
--- a/test/core/end2end/fuzzers/server_fuzzer.c
+++ b/test/core/end2end/fuzzers/server_fuzzer.c
@@ -41,7 +41,7 @@
bool squelch = true;
bool leak_check = true;
-static void discard_write(gpr_slice slice) {}
+static void discard_write(grpc_slice slice) {}
static void *tag(int n) { return (void *)(uintptr_t)n; }
static int detag(void *p) { return (int)(uintptr_t)p; }
@@ -63,7 +63,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
grpc_resource_quota_internal_unref(&exec_ctx, resource_quota);
grpc_mock_endpoint_put_read(
&exec_ctx, mock_endpoint,
- gpr_slice_from_copied_buffer((const char *)data, size));
+ grpc_slice_from_copied_buffer((const char *)data, size));
grpc_server *server = grpc_server_create(NULL, NULL);
grpc_completion_queue *cq = grpc_completion_queue_create(NULL);
diff --git a/test/core/end2end/invalid_call_argument_test.c b/test/core/end2end/invalid_call_argument_test.c
index 2b9904a244..765b6ad1be 100644
--- a/test/core/end2end/invalid_call_argument_test.c
+++ b/test/core/end2end/invalid_call_argument_test.c
@@ -251,7 +251,8 @@ static void test_send_messages_at_the_same_time() {
gpr_log(GPR_INFO, "test_send_messages_at_the_same_time");
grpc_op *op;
- gpr_slice request_payload_slice = gpr_slice_from_copied_string("hello world");
+ grpc_slice request_payload_slice =
+ grpc_slice_from_copied_string("hello world");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
prepare_test(1);
diff --git a/test/core/end2end/tests/binary_metadata.c b/test/core/end2end/tests/binary_metadata.c
index f1ebbbb66f..a13613a472 100644
--- a/test/core/end2end/tests/binary_metadata.c
+++ b/test/core/end2end/tests/binary_metadata.c
@@ -100,8 +100,10 @@ static void test_request_response_with_metadata_and_payload(
grpc_end2end_test_config config) {
grpc_call *c;
grpc_call *s;
- gpr_slice request_payload_slice = gpr_slice_from_copied_string("hello world");
- gpr_slice response_payload_slice = gpr_slice_from_copied_string("hello you");
+ grpc_slice request_payload_slice =
+ grpc_slice_from_copied_string("hello world");
+ grpc_slice response_payload_slice =
+ grpc_slice_from_copied_string("hello you");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
grpc_byte_buffer *response_payload =
diff --git a/test/core/end2end/tests/call_creds.c b/test/core/end2end/tests/call_creds.c
index 8bde79c400..606938fff6 100644
--- a/test/core/end2end/tests/call_creds.c
+++ b/test/core/end2end/tests/call_creds.c
@@ -135,8 +135,10 @@ static void request_response_with_payload_and_call_creds(
override_mode mode) {
grpc_call *c;
grpc_call *s;
- gpr_slice request_payload_slice = gpr_slice_from_copied_string("hello world");
- gpr_slice response_payload_slice = gpr_slice_from_copied_string("hello you");
+ grpc_slice request_payload_slice =
+ grpc_slice_from_copied_string("hello world");
+ grpc_slice response_payload_slice =
+ grpc_slice_from_copied_string("hello you");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
grpc_byte_buffer *response_payload =
@@ -392,7 +394,8 @@ static void test_request_with_server_rejecting_client_creds(
char *details = NULL;
size_t details_capacity = 0;
grpc_byte_buffer *response_payload_recv = NULL;
- gpr_slice request_payload_slice = gpr_slice_from_copied_string("hello world");
+ grpc_slice request_payload_slice =
+ grpc_slice_from_copied_string("hello world");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
grpc_call_credentials *creds;
diff --git a/test/core/end2end/tests/cancel_after_accept.c b/test/core/end2end/tests/cancel_after_accept.c
index fd03432ff5..428a2d1c3c 100644
--- a/test/core/end2end/tests/cancel_after_accept.c
+++ b/test/core/end2end/tests/cancel_after_accept.c
@@ -122,8 +122,10 @@ static void test_cancel_after_accept(grpc_end2end_test_config config,
size_t details_capacity = 0;
grpc_byte_buffer *request_payload_recv = NULL;
grpc_byte_buffer *response_payload_recv = NULL;
- gpr_slice request_payload_slice = gpr_slice_from_copied_string("hello world");
- gpr_slice response_payload_slice = gpr_slice_from_copied_string("hello you");
+ grpc_slice request_payload_slice =
+ grpc_slice_from_copied_string("hello world");
+ grpc_slice response_payload_slice =
+ grpc_slice_from_copied_string("hello you");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
grpc_byte_buffer *response_payload =
diff --git a/test/core/end2end/tests/cancel_after_client_done.c b/test/core/end2end/tests/cancel_after_client_done.c
index 26de66eba7..7742f9d179 100644
--- a/test/core/end2end/tests/cancel_after_client_done.c
+++ b/test/core/end2end/tests/cancel_after_client_done.c
@@ -117,8 +117,10 @@ static void test_cancel_after_accept_and_writes_closed(
size_t details_capacity = 0;
grpc_byte_buffer *request_payload_recv = NULL;
grpc_byte_buffer *response_payload_recv = NULL;
- gpr_slice request_payload_slice = gpr_slice_from_copied_string("hello world");
- gpr_slice response_payload_slice = gpr_slice_from_copied_string("hello you");
+ grpc_slice request_payload_slice =
+ grpc_slice_from_copied_string("hello world");
+ grpc_slice response_payload_slice =
+ grpc_slice_from_copied_string("hello you");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
grpc_byte_buffer *response_payload =
diff --git a/test/core/end2end/tests/cancel_after_invoke.c b/test/core/end2end/tests/cancel_after_invoke.c
index afbfb02a39..c3c5418f20 100644
--- a/test/core/end2end/tests/cancel_after_invoke.c
+++ b/test/core/end2end/tests/cancel_after_invoke.c
@@ -116,7 +116,8 @@ static void test_cancel_after_invoke(grpc_end2end_test_config config,
char *details = NULL;
size_t details_capacity = 0;
grpc_byte_buffer *response_payload_recv = NULL;
- gpr_slice request_payload_slice = gpr_slice_from_copied_string("hello world");
+ grpc_slice request_payload_slice =
+ grpc_slice_from_copied_string("hello world");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
diff --git a/test/core/end2end/tests/cancel_before_invoke.c b/test/core/end2end/tests/cancel_before_invoke.c
index d0eeed8ab8..d4842829c0 100644
--- a/test/core/end2end/tests/cancel_before_invoke.c
+++ b/test/core/end2end/tests/cancel_before_invoke.c
@@ -114,7 +114,8 @@ static void test_cancel_before_invoke(grpc_end2end_test_config config,
char *details = NULL;
size_t details_capacity = 0;
grpc_byte_buffer *response_payload_recv = NULL;
- gpr_slice request_payload_slice = gpr_slice_from_copied_string("hello world");
+ grpc_slice request_payload_slice =
+ grpc_slice_from_copied_string("hello world");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
diff --git a/test/core/end2end/tests/compressed_payload.c b/test/core/end2end/tests/compressed_payload.c
index 166e8efe37..81fc7091f8 100644
--- a/test/core/end2end/tests/compressed_payload.c
+++ b/test/core/end2end/tests/compressed_payload.c
@@ -110,7 +110,7 @@ static void request_for_disabled_algorithm(
grpc_status_code expected_error, grpc_metadata *client_metadata) {
grpc_call *c;
grpc_call *s;
- gpr_slice request_payload_slice;
+ grpc_slice request_payload_slice;
grpc_byte_buffer *request_payload;
gpr_timespec deadline = five_seconds_time();
grpc_channel_args *client_args;
@@ -133,7 +133,7 @@ static void request_for_disabled_algorithm(
memset(str, 'x', 1023);
str[1023] = '\0';
- request_payload_slice = gpr_slice_from_copied_string(str);
+ request_payload_slice = grpc_slice_from_copied_string(str);
request_payload = grpc_raw_byte_buffer_create(&request_payload_slice, 1);
client_args = grpc_channel_args_set_compression_algorithm(
@@ -258,7 +258,7 @@ static void request_for_disabled_algorithm(
cq_verifier_destroy(cqv);
- gpr_slice_unref(request_payload_slice);
+ grpc_slice_unref(request_payload_slice);
grpc_byte_buffer_destroy(request_payload);
grpc_byte_buffer_destroy(request_payload_recv);
@@ -280,7 +280,7 @@ static void request_with_payload_template(
grpc_compression_level server_compression_level) {
grpc_call *c;
grpc_call *s;
- gpr_slice request_payload_slice;
+ grpc_slice request_payload_slice;
grpc_byte_buffer *request_payload;
gpr_timespec deadline = five_seconds_time();
grpc_channel_args *client_args;
@@ -310,8 +310,9 @@ static void request_with_payload_template(
memset(response_str, 'y', 1023);
response_str[1023] = '\0';
- request_payload_slice = gpr_slice_from_copied_string(request_str);
- gpr_slice response_payload_slice = gpr_slice_from_copied_string(response_str);
+ request_payload_slice = grpc_slice_from_copied_string(request_str);
+ grpc_slice response_payload_slice =
+ grpc_slice_from_copied_string(response_str);
client_args = grpc_channel_args_set_compression_algorithm(
NULL, default_client_channel_compression_algorithm);
@@ -463,8 +464,8 @@ static void request_with_payload_template(
grpc_byte_buffer_destroy(response_payload_recv);
}
- gpr_slice_unref(request_payload_slice);
- gpr_slice_unref(response_payload_slice);
+ grpc_slice_unref(request_payload_slice);
+ grpc_slice_unref(response_payload_slice);
memset(ops, 0, sizeof(ops));
op = ops;
diff --git a/test/core/end2end/tests/filter_call_init_fails.c b/test/core/end2end/tests/filter_call_init_fails.c
index 84d95b20b8..b5668ea3d5 100644
--- a/test/core/end2end/tests/filter_call_init_fails.c
+++ b/test/core/end2end/tests/filter_call_init_fails.c
@@ -108,7 +108,8 @@ static void end_test(grpc_end2end_test_fixture *f) {
static void test_request(grpc_end2end_test_config config) {
grpc_call *c;
grpc_call *s;
- gpr_slice request_payload_slice = gpr_slice_from_copied_string("hello world");
+ grpc_slice request_payload_slice =
+ grpc_slice_from_copied_string("hello world");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
gpr_timespec deadline = five_seconds_time();
diff --git a/test/core/end2end/tests/filter_causes_close.c b/test/core/end2end/tests/filter_causes_close.c
index 51e56d74a3..70b33fae19 100644
--- a/test/core/end2end/tests/filter_causes_close.c
+++ b/test/core/end2end/tests/filter_causes_close.c
@@ -104,7 +104,8 @@ static void end_test(grpc_end2end_test_fixture *f) {
static void test_request(grpc_end2end_test_config config) {
grpc_call *c;
grpc_call *s;
- gpr_slice request_payload_slice = gpr_slice_from_copied_string("hello world");
+ grpc_slice request_payload_slice =
+ grpc_slice_from_copied_string("hello world");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
gpr_timespec deadline = five_seconds_time();
@@ -209,8 +210,8 @@ static void recv_im_ready(grpc_exec_ctx *exec_ctx, void *arg,
call_data *calld = elem->call_data;
if (error == GRPC_ERROR_NONE) {
// close the stream with an error.
- gpr_slice message =
- gpr_slice_from_copied_string("Failure that's not preventable.");
+ grpc_slice message =
+ grpc_slice_from_copied_string("Failure that's not preventable.");
grpc_transport_stream_op *op = grpc_make_transport_stream_op(NULL);
grpc_transport_stream_op_add_close(op, GRPC_STATUS_PERMISSION_DENIED,
&message);
diff --git a/test/core/end2end/tests/invoke_large_request.c b/test/core/end2end/tests/invoke_large_request.c
index edb655fea5..24abfa2ea0 100644
--- a/test/core/end2end/tests/invoke_large_request.c
+++ b/test/core/end2end/tests/invoke_large_request.c
@@ -94,9 +94,9 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_destroy(f->cq);
}
-static gpr_slice large_slice(void) {
- gpr_slice slice = gpr_slice_malloc(1000000);
- memset(GPR_SLICE_START_PTR(slice), 'x', GPR_SLICE_LENGTH(slice));
+static grpc_slice large_slice(void) {
+ grpc_slice slice = grpc_slice_malloc(1000000);
+ memset(GRPC_SLICE_START_PTR(slice), 'x', GRPC_SLICE_LENGTH(slice));
return slice;
}
@@ -120,8 +120,8 @@ static void test_invoke_large_request(grpc_end2end_test_config config,
begin_test(config, name, &channel_args, &channel_args);
gpr_free(name);
- gpr_slice request_payload_slice = large_slice();
- gpr_slice response_payload_slice = large_slice();
+ grpc_slice request_payload_slice = large_slice();
+ grpc_slice response_payload_slice = large_slice();
grpc_call *c;
grpc_call *s;
grpc_byte_buffer *request_payload =
@@ -265,8 +265,8 @@ static void test_invoke_large_request(grpc_end2end_test_config config,
grpc_byte_buffer_destroy(response_payload);
grpc_byte_buffer_destroy(request_payload_recv);
grpc_byte_buffer_destroy(response_payload_recv);
- gpr_slice_unref(request_payload_slice);
- gpr_slice_unref(response_payload_slice);
+ grpc_slice_unref(request_payload_slice);
+ grpc_slice_unref(response_payload_slice);
end_test(&f);
config.tear_down_data(&f);
diff --git a/test/core/end2end/tests/large_metadata.c b/test/core/end2end/tests/large_metadata.c
index 499c56413b..69b4b24b06 100644
--- a/test/core/end2end/tests/large_metadata.c
+++ b/test/core/end2end/tests/large_metadata.c
@@ -99,7 +99,8 @@ static void end_test(grpc_end2end_test_fixture *f) {
static void test_request_with_large_metadata(grpc_end2end_test_config config) {
grpc_call *c;
grpc_call *s;
- gpr_slice request_payload_slice = gpr_slice_from_copied_string("hello world");
+ grpc_slice request_payload_slice =
+ grpc_slice_from_copied_string("hello world");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
gpr_timespec deadline = five_seconds_time();
diff --git a/test/core/end2end/tests/load_reporting_hook.c b/test/core/end2end/tests/load_reporting_hook.c
index ca4e2709a9..5b75f26bd2 100644
--- a/test/core/end2end/tests/load_reporting_hook.c
+++ b/test/core/end2end/tests/load_reporting_hook.c
@@ -125,8 +125,9 @@ static void request_response_with_payload(
grpc_end2end_test_config config, grpc_end2end_test_fixture f,
const char *method_name, const char *request_msg, const char *response_msg,
grpc_metadata *initial_lr_metadata, grpc_metadata *trailing_lr_metadata) {
- gpr_slice request_payload_slice = gpr_slice_from_static_string(request_msg);
- gpr_slice response_payload_slice = gpr_slice_from_static_string(response_msg);
+ grpc_slice request_payload_slice = grpc_slice_from_static_string(request_msg);
+ grpc_slice response_payload_slice =
+ grpc_slice_from_static_string(response_msg);
grpc_call *c;
grpc_call *s;
grpc_byte_buffer *request_payload =
diff --git a/test/core/end2end/tests/max_message_length.c b/test/core/end2end/tests/max_message_length.c
index b416627bfd..0ddd7bed15 100644
--- a/test/core/end2end/tests/max_message_length.c
+++ b/test/core/end2end/tests/max_message_length.c
@@ -118,7 +118,8 @@ static void test_max_message_length_on_request(grpc_end2end_test_config config,
cq_verifier *cqv;
grpc_op ops[6];
grpc_op *op;
- gpr_slice request_payload_slice = gpr_slice_from_copied_string("hello world");
+ grpc_slice request_payload_slice =
+ grpc_slice_from_copied_string("hello world");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
grpc_byte_buffer *recv_payload = NULL;
@@ -291,8 +292,8 @@ static void test_max_message_length_on_response(grpc_end2end_test_config config,
cq_verifier *cqv;
grpc_op ops[6];
grpc_op *op;
- gpr_slice response_payload_slice =
- gpr_slice_from_copied_string("hello world");
+ grpc_slice response_payload_slice =
+ grpc_slice_from_copied_string("hello world");
grpc_byte_buffer *response_payload =
grpc_raw_byte_buffer_create(&response_payload_slice, 1);
grpc_byte_buffer *recv_payload = NULL;
diff --git a/test/core/end2end/tests/network_status_change.c b/test/core/end2end/tests/network_status_change.c
index 96e909e463..2ebda2ccb8 100644
--- a/test/core/end2end/tests/network_status_change.c
+++ b/test/core/end2end/tests/network_status_change.c
@@ -102,7 +102,8 @@ static void end_test(grpc_end2end_test_fixture *f) {
static void test_invoke_network_status_change(grpc_end2end_test_config config) {
grpc_call *c;
grpc_call *s;
- gpr_slice request_payload_slice = gpr_slice_from_copied_string("hello world");
+ grpc_slice request_payload_slice =
+ grpc_slice_from_copied_string("hello world");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
gpr_timespec deadline = five_seconds_time();
diff --git a/test/core/end2end/tests/payload.c b/test/core/end2end/tests/payload.c
index 17cea48f03..db2e5c83de 100644
--- a/test/core/end2end/tests/payload.c
+++ b/test/core/end2end/tests/payload.c
@@ -95,8 +95,9 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_destroy(f->cq);
}
-/* Creates and returns a gpr_slice containing random alphanumeric characters. */
-static gpr_slice generate_random_slice() {
+/* Creates and returns a grpc_slice containing random alphanumeric characters.
+ */
+static grpc_slice generate_random_slice() {
size_t i;
static const char chars[] = "abcdefghijklmnopqrstuvwxyz1234567890";
char *output;
@@ -106,7 +107,7 @@ static gpr_slice generate_random_slice() {
output[i] = chars[rand() % (int)(sizeof(chars) - 1)];
}
output[output_size - 1] = '\0';
- gpr_slice out = gpr_slice_from_copied_string(output);
+ grpc_slice out = grpc_slice_from_copied_string(output);
gpr_free(output);
return out;
}
@@ -116,8 +117,8 @@ static void request_response_with_payload(grpc_end2end_test_config config,
/* Create large request and response bodies. These are big enough to require
* multiple round trips to deliver to the peer, and their exact contents of
* will be verified on completion. */
- gpr_slice request_payload_slice = generate_random_slice();
- gpr_slice response_payload_slice = generate_random_slice();
+ grpc_slice request_payload_slice = generate_random_slice();
+ grpc_slice response_payload_slice = generate_random_slice();
grpc_call *c;
grpc_call *s;
diff --git a/test/core/end2end/tests/ping_pong_streaming.c b/test/core/end2end/tests/ping_pong_streaming.c
index 52f0d70a44..0a1566e9c2 100644
--- a/test/core/end2end/tests/ping_pong_streaming.c
+++ b/test/core/end2end/tests/ping_pong_streaming.c
@@ -120,8 +120,10 @@ static void test_pingpong_streaming(grpc_end2end_test_config config,
grpc_byte_buffer *response_payload;
grpc_byte_buffer *response_payload_recv;
int i;
- gpr_slice request_payload_slice = gpr_slice_from_copied_string("hello world");
- gpr_slice response_payload_slice = gpr_slice_from_copied_string("hello you");
+ grpc_slice request_payload_slice =
+ grpc_slice_from_copied_string("hello world");
+ grpc_slice response_payload_slice =
+ grpc_slice_from_copied_string("hello you");
c = grpc_channel_create_call(
f.client, NULL, GRPC_PROPAGATE_DEFAULTS, f.cq, "/foo",
@@ -229,8 +231,8 @@ static void test_pingpong_streaming(grpc_end2end_test_config config,
grpc_byte_buffer_destroy(response_payload_recv);
}
- gpr_slice_unref(request_payload_slice);
- gpr_slice_unref(response_payload_slice);
+ grpc_slice_unref(request_payload_slice);
+ grpc_slice_unref(response_payload_slice);
memset(ops, 0, sizeof(ops));
op = ops;
diff --git a/test/core/end2end/tests/request_with_flags.c b/test/core/end2end/tests/request_with_flags.c
index f96ef6aa94..9c18e155f3 100644
--- a/test/core/end2end/tests/request_with_flags.c
+++ b/test/core/end2end/tests/request_with_flags.c
@@ -100,7 +100,8 @@ static void test_invoke_request_with_flags(
grpc_end2end_test_config config, uint32_t *flags_for_op,
grpc_call_error call_start_batch_expected_result) {
grpc_call *c;
- gpr_slice request_payload_slice = gpr_slice_from_copied_string("hello world");
+ grpc_slice request_payload_slice =
+ grpc_slice_from_copied_string("hello world");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
gpr_timespec deadline = five_seconds_time();
diff --git a/test/core/end2end/tests/request_with_payload.c b/test/core/end2end/tests/request_with_payload.c
index 359f4e9fd2..c84e3ac5b5 100644
--- a/test/core/end2end/tests/request_with_payload.c
+++ b/test/core/end2end/tests/request_with_payload.c
@@ -99,7 +99,8 @@ static void end_test(grpc_end2end_test_fixture *f) {
static void test_invoke_request_with_payload(grpc_end2end_test_config config) {
grpc_call *c;
grpc_call *s;
- gpr_slice request_payload_slice = gpr_slice_from_copied_string("hello world");
+ grpc_slice request_payload_slice =
+ grpc_slice_from_copied_string("hello world");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
gpr_timespec deadline = five_seconds_time();
diff --git a/test/core/end2end/tests/resource_quota_server.c b/test/core/end2end/tests/resource_quota_server.c
index 35f200b75f..7ec33e97a3 100644
--- a/test/core/end2end/tests/resource_quota_server.c
+++ b/test/core/end2end/tests/resource_quota_server.c
@@ -95,8 +95,9 @@ static void end_test(grpc_end2end_test_fixture *f) {
grpc_completion_queue_destroy(f->cq);
}
-/* Creates and returns a gpr_slice containing random alphanumeric characters. */
-static gpr_slice generate_random_slice() {
+/* Creates and returns a grpc_slice containing random alphanumeric characters.
+ */
+static grpc_slice generate_random_slice() {
size_t i;
static const char chars[] = "abcdefghijklmnopqrstuvwxyz1234567890";
char *output;
@@ -106,7 +107,7 @@ static gpr_slice generate_random_slice() {
output[i] = chars[rand() % (int)(sizeof(chars) - 1)];
}
output[output_size - 1] = '\0';
- gpr_slice out = gpr_slice_from_copied_string(output);
+ grpc_slice out = grpc_slice_from_copied_string(output);
gpr_free(output);
return out;
}
@@ -135,7 +136,7 @@ void resource_quota_server(grpc_end2end_test_config config) {
/* Create large request and response bodies. These are big enough to require
* multiple round trips to deliver to the peer, and their exact contents of
* will be verified on completion. */
- gpr_slice request_payload_slice = generate_random_slice();
+ grpc_slice request_payload_slice = generate_random_slice();
grpc_call **client_calls = malloc(sizeof(grpc_call *) * NUM_CALLS);
grpc_call **server_calls = malloc(sizeof(grpc_call *) * NUM_CALLS);
@@ -358,7 +359,7 @@ void resource_quota_server(grpc_end2end_test_config config) {
GPR_ASSERT(cancelled_calls_on_server >= 0.9 * cancelled_calls_on_client);
grpc_byte_buffer_destroy(request_payload);
- gpr_slice_unref(request_payload_slice);
+ grpc_slice_unref(request_payload_slice);
grpc_resource_quota_unref(resource_quota);
free(client_calls);
diff --git a/test/core/end2end/tests/simple_cacheable_request.c b/test/core/end2end/tests/simple_cacheable_request.c
index 9f6a6a08a0..2c229b08fe 100644
--- a/test/core/end2end/tests/simple_cacheable_request.c
+++ b/test/core/end2end/tests/simple_cacheable_request.c
@@ -102,8 +102,10 @@ static void test_cacheable_request_response_with_metadata_and_payload(
grpc_end2end_test_config config) {
grpc_call *c;
grpc_call *s;
- gpr_slice request_payload_slice = gpr_slice_from_copied_string("hello world");
- gpr_slice response_payload_slice = gpr_slice_from_copied_string("hello you");
+ grpc_slice request_payload_slice =
+ grpc_slice_from_copied_string("hello world");
+ grpc_slice response_payload_slice =
+ grpc_slice_from_copied_string("hello you");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
grpc_byte_buffer *response_payload =
diff --git a/test/core/end2end/tests/simple_metadata.c b/test/core/end2end/tests/simple_metadata.c
index 7b8adb1f32..5490cc2b75 100644
--- a/test/core/end2end/tests/simple_metadata.c
+++ b/test/core/end2end/tests/simple_metadata.c
@@ -100,8 +100,10 @@ static void test_request_response_with_metadata_and_payload(
grpc_end2end_test_config config) {
grpc_call *c;
grpc_call *s;
- gpr_slice request_payload_slice = gpr_slice_from_copied_string("hello world");
- gpr_slice response_payload_slice = gpr_slice_from_copied_string("hello you");
+ grpc_slice request_payload_slice =
+ grpc_slice_from_copied_string("hello world");
+ grpc_slice response_payload_slice =
+ grpc_slice_from_copied_string("hello you");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
grpc_byte_buffer *response_payload =
diff --git a/test/core/end2end/tests/streaming_error_response.c b/test/core/end2end/tests/streaming_error_response.c
index 7b5315d667..583bc9268f 100644
--- a/test/core/end2end/tests/streaming_error_response.c
+++ b/test/core/end2end/tests/streaming_error_response.c
@@ -101,10 +101,10 @@ static void end_test(grpc_end2end_test_fixture *f) {
static void test(grpc_end2end_test_config config, bool request_status_early) {
grpc_call *c;
grpc_call *s;
- gpr_slice response_payload1_slice = gpr_slice_from_copied_string("hello");
+ grpc_slice response_payload1_slice = grpc_slice_from_copied_string("hello");
grpc_byte_buffer *response_payload1 =
grpc_raw_byte_buffer_create(&response_payload1_slice, 1);
- gpr_slice response_payload2_slice = gpr_slice_from_copied_string("world");
+ grpc_slice response_payload2_slice = grpc_slice_from_copied_string("world");
grpc_byte_buffer *response_payload2 =
grpc_raw_byte_buffer_create(&response_payload2_slice, 1);
gpr_timespec deadline = five_seconds_time();
diff --git a/test/core/end2end/tests/trailing_metadata.c b/test/core/end2end/tests/trailing_metadata.c
index 87e29a934f..9fd4fbc052 100644
--- a/test/core/end2end/tests/trailing_metadata.c
+++ b/test/core/end2end/tests/trailing_metadata.c
@@ -100,8 +100,10 @@ static void test_request_response_with_metadata_and_payload(
grpc_end2end_test_config config) {
grpc_call *c;
grpc_call *s;
- gpr_slice request_payload_slice = gpr_slice_from_copied_string("hello world");
- gpr_slice response_payload_slice = gpr_slice_from_copied_string("hello you");
+ grpc_slice request_payload_slice =
+ grpc_slice_from_copied_string("hello world");
+ grpc_slice response_payload_slice =
+ grpc_slice_from_copied_string("hello you");
grpc_byte_buffer *request_payload =
grpc_raw_byte_buffer_create(&request_payload_slice, 1);
grpc_byte_buffer *response_payload =
diff --git a/test/core/fling/client.c b/test/core/fling/client.c
index bcc195a92f..e717b7f7fe 100644
--- a/test/core/fling/client.c
+++ b/test/core/fling/client.c
@@ -155,7 +155,7 @@ static const scenario scenarios[] = {
};
int main(int argc, char **argv) {
- gpr_slice slice = gpr_slice_from_copied_string("x");
+ grpc_slice slice = grpc_slice_from_copied_string("x");
double start, stop;
unsigned i;
@@ -241,7 +241,7 @@ int main(int argc, char **argv) {
} while (event.type != GRPC_QUEUE_SHUTDOWN);
grpc_completion_queue_destroy(cq);
grpc_byte_buffer_destroy(the_buffer);
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
gpr_log(GPR_INFO, "latency (50/95/99/99.9): %f/%f/%f/%f",
gpr_histogram_percentile(histogram, 50),
diff --git a/test/core/handshake/client_ssl.c b/test/core/handshake/client_ssl.c
index ee90f0b0bc..44efe4dbac 100644
--- a/test/core/handshake/client_ssl.c
+++ b/test/core/handshake/client_ssl.c
@@ -231,16 +231,16 @@ static bool client_ssl_test(char *server_alpn_preferred) {
// Load key pair and establish client SSL credentials.
grpc_ssl_pem_key_cert_pair pem_key_cert_pair;
- gpr_slice ca_slice, cert_slice, key_slice;
+ grpc_slice ca_slice, cert_slice, key_slice;
GPR_ASSERT(GRPC_LOG_IF_ERROR("load_file",
grpc_load_file(SSL_CA_PATH, 1, &ca_slice)));
GPR_ASSERT(GRPC_LOG_IF_ERROR("load_file",
grpc_load_file(SSL_CERT_PATH, 1, &cert_slice)));
GPR_ASSERT(GRPC_LOG_IF_ERROR("load_file",
grpc_load_file(SSL_KEY_PATH, 1, &key_slice)));
- const char *ca_cert = (const char *)GPR_SLICE_START_PTR(ca_slice);
- pem_key_cert_pair.private_key = (const char *)GPR_SLICE_START_PTR(key_slice);
- pem_key_cert_pair.cert_chain = (const char *)GPR_SLICE_START_PTR(cert_slice);
+ const char *ca_cert = (const char *)GRPC_SLICE_START_PTR(ca_slice);
+ pem_key_cert_pair.private_key = (const char *)GRPC_SLICE_START_PTR(key_slice);
+ pem_key_cert_pair.cert_chain = (const char *)GRPC_SLICE_START_PTR(cert_slice);
grpc_channel_credentials *ssl_creds =
grpc_ssl_credentials_create(ca_cert, &pem_key_cert_pair, NULL);
@@ -286,9 +286,9 @@ static bool client_ssl_test(char *server_alpn_preferred) {
grpc_channel_destroy(channel);
grpc_channel_credentials_release(ssl_creds);
- gpr_slice_unref(cert_slice);
- gpr_slice_unref(key_slice);
- gpr_slice_unref(ca_slice);
+ grpc_slice_unref(cert_slice);
+ grpc_slice_unref(key_slice);
+ grpc_slice_unref(ca_slice);
gpr_thd_join(thdid);
diff --git a/test/core/handshake/server_ssl.c b/test/core/handshake/server_ssl.c
index 3e89f8e265..f39b0040a6 100644
--- a/test/core/handshake/server_ssl.c
+++ b/test/core/handshake/server_ssl.c
@@ -84,16 +84,16 @@ static void server_thread(void *arg) {
// Load key pair and establish server SSL credentials.
grpc_ssl_pem_key_cert_pair pem_key_cert_pair;
- gpr_slice ca_slice, cert_slice, key_slice;
+ grpc_slice ca_slice, cert_slice, key_slice;
GPR_ASSERT(GRPC_LOG_IF_ERROR("load_file",
grpc_load_file(SSL_CA_PATH, 1, &ca_slice)));
GPR_ASSERT(GRPC_LOG_IF_ERROR("load_file",
grpc_load_file(SSL_CERT_PATH, 1, &cert_slice)));
GPR_ASSERT(GRPC_LOG_IF_ERROR("load_file",
grpc_load_file(SSL_KEY_PATH, 1, &key_slice)));
- const char *ca_cert = (const char *)GPR_SLICE_START_PTR(ca_slice);
- pem_key_cert_pair.private_key = (const char *)GPR_SLICE_START_PTR(key_slice);
- pem_key_cert_pair.cert_chain = (const char *)GPR_SLICE_START_PTR(cert_slice);
+ const char *ca_cert = (const char *)GRPC_SLICE_START_PTR(ca_slice);
+ pem_key_cert_pair.private_key = (const char *)GRPC_SLICE_START_PTR(key_slice);
+ pem_key_cert_pair.cert_chain = (const char *)GRPC_SLICE_START_PTR(cert_slice);
grpc_server_credentials *ssl_creds = grpc_ssl_server_credentials_create(
ca_cert, &pem_key_cert_pair, 1, 0, NULL);
@@ -129,9 +129,9 @@ static void server_thread(void *arg) {
grpc_server_destroy(server);
grpc_completion_queue_destroy(cq);
grpc_server_credentials_release(ssl_creds);
- gpr_slice_unref(cert_slice);
- gpr_slice_unref(key_slice);
- gpr_slice_unref(ca_slice);
+ grpc_slice_unref(cert_slice);
+ grpc_slice_unref(key_slice);
+ grpc_slice_unref(ca_slice);
}
// This test launches a gRPC server on a separate thread and then establishes a
diff --git a/test/core/http/format_request_test.c b/test/core/http/format_request_test.c
index 0d21e1200b..290990c906 100644
--- a/test/core/http/format_request_test.c
+++ b/test/core/http/format_request_test.c
@@ -41,7 +41,7 @@
static void test_format_get_request(void) {
grpc_http_header hdr = {"x-yz", "abc"};
grpc_httpcli_request req;
- gpr_slice slice;
+ grpc_slice slice;
memset(&req, 0, sizeof(req));
req.host = "example.com";
@@ -51,22 +51,22 @@ static void test_format_get_request(void) {
slice = grpc_httpcli_format_get_request(&req);
- GPR_ASSERT(0 == gpr_slice_str_cmp(slice,
- "GET /index.html HTTP/1.0\r\n"
- "Host: example.com\r\n"
- "Connection: close\r\n"
- "User-Agent: " GRPC_HTTPCLI_USER_AGENT
- "\r\n"
- "x-yz: abc\r\n"
- "\r\n"));
+ GPR_ASSERT(0 == grpc_slice_str_cmp(slice,
+ "GET /index.html HTTP/1.0\r\n"
+ "Host: example.com\r\n"
+ "Connection: close\r\n"
+ "User-Agent: " GRPC_HTTPCLI_USER_AGENT
+ "\r\n"
+ "x-yz: abc\r\n"
+ "\r\n"));
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
}
static void test_format_post_request(void) {
grpc_http_header hdr = {"x-yz", "abc"};
grpc_httpcli_request req;
- gpr_slice slice;
+ grpc_slice slice;
char body_bytes[] = "fake body";
size_t body_len = 9;
@@ -78,25 +78,25 @@ static void test_format_post_request(void) {
slice = grpc_httpcli_format_post_request(&req, body_bytes, body_len);
- GPR_ASSERT(0 == gpr_slice_str_cmp(slice,
- "POST /index.html HTTP/1.0\r\n"
- "Host: example.com\r\n"
- "Connection: close\r\n"
- "User-Agent: " GRPC_HTTPCLI_USER_AGENT
- "\r\n"
- "x-yz: abc\r\n"
- "Content-Type: text/plain\r\n"
- "Content-Length: 9\r\n"
- "\r\n"
- "fake body"));
-
- gpr_slice_unref(slice);
+ GPR_ASSERT(0 == grpc_slice_str_cmp(slice,
+ "POST /index.html HTTP/1.0\r\n"
+ "Host: example.com\r\n"
+ "Connection: close\r\n"
+ "User-Agent: " GRPC_HTTPCLI_USER_AGENT
+ "\r\n"
+ "x-yz: abc\r\n"
+ "Content-Type: text/plain\r\n"
+ "Content-Length: 9\r\n"
+ "\r\n"
+ "fake body"));
+
+ grpc_slice_unref(slice);
}
static void test_format_post_request_no_body(void) {
grpc_http_header hdr = {"x-yz", "abc"};
grpc_httpcli_request req;
- gpr_slice slice;
+ grpc_slice slice;
memset(&req, 0, sizeof(req));
req.host = "example.com";
@@ -106,22 +106,22 @@ static void test_format_post_request_no_body(void) {
slice = grpc_httpcli_format_post_request(&req, NULL, 0);
- GPR_ASSERT(0 == gpr_slice_str_cmp(slice,
- "POST /index.html HTTP/1.0\r\n"
- "Host: example.com\r\n"
- "Connection: close\r\n"
- "User-Agent: " GRPC_HTTPCLI_USER_AGENT
- "\r\n"
- "x-yz: abc\r\n"
- "\r\n"));
+ GPR_ASSERT(0 == grpc_slice_str_cmp(slice,
+ "POST /index.html HTTP/1.0\r\n"
+ "Host: example.com\r\n"
+ "Connection: close\r\n"
+ "User-Agent: " GRPC_HTTPCLI_USER_AGENT
+ "\r\n"
+ "x-yz: abc\r\n"
+ "\r\n"));
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
}
static void test_format_post_request_content_type_override(void) {
grpc_http_header hdrs[2];
grpc_httpcli_request req;
- gpr_slice slice;
+ grpc_slice slice;
char body_bytes[] = "fake%20body";
size_t body_len = 11;
@@ -137,7 +137,7 @@ static void test_format_post_request_content_type_override(void) {
slice = grpc_httpcli_format_post_request(&req, body_bytes, body_len);
- GPR_ASSERT(0 == gpr_slice_str_cmp(
+ GPR_ASSERT(0 == grpc_slice_str_cmp(
slice,
"POST /index.html HTTP/1.0\r\n"
"Host: example.com\r\n"
@@ -149,7 +149,7 @@ static void test_format_post_request_content_type_override(void) {
"\r\n"
"fake%20body"));
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
}
int main(int argc, char **argv) {
diff --git a/test/core/http/parser_test.c b/test/core/http/parser_test.c
index 2fc354d9ee..4f1445d3f1 100644
--- a/test/core/http/parser_test.c
+++ b/test/core/http/parser_test.c
@@ -48,23 +48,23 @@ static void test_request_succeeds(grpc_slice_split_mode split_mode,
grpc_http_version expect_version,
char *expect_path, char *expect_body, ...) {
grpc_http_parser parser;
- gpr_slice input_slice = gpr_slice_from_copied_string(request_text);
+ grpc_slice input_slice = grpc_slice_from_copied_string(request_text);
size_t num_slices;
size_t i;
- gpr_slice *slices;
+ grpc_slice *slices;
va_list args;
grpc_http_request request;
memset(&request, 0, sizeof(request));
grpc_split_slices(split_mode, &input_slice, 1, &slices, &num_slices);
- gpr_slice_unref(input_slice);
+ grpc_slice_unref(input_slice);
grpc_http_parser_init(&parser, GRPC_HTTP_REQUEST, &request);
for (i = 0; i < num_slices; i++) {
GPR_ASSERT(grpc_http_parser_parse(&parser, slices[i], NULL) ==
GRPC_ERROR_NONE);
- gpr_slice_unref(slices[i]);
+ grpc_slice_unref(slices[i]);
}
GPR_ASSERT(grpc_http_parser_eof(&parser) == GRPC_ERROR_NONE);
@@ -105,23 +105,23 @@ static void test_request_succeeds(grpc_slice_split_mode split_mode,
static void test_succeeds(grpc_slice_split_mode split_mode, char *response_text,
int expect_status, char *expect_body, ...) {
grpc_http_parser parser;
- gpr_slice input_slice = gpr_slice_from_copied_string(response_text);
+ grpc_slice input_slice = grpc_slice_from_copied_string(response_text);
size_t num_slices;
size_t i;
- gpr_slice *slices;
+ grpc_slice *slices;
va_list args;
grpc_http_response response;
memset(&response, 0, sizeof(response));
grpc_split_slices(split_mode, &input_slice, 1, &slices, &num_slices);
- gpr_slice_unref(input_slice);
+ grpc_slice_unref(input_slice);
grpc_http_parser_init(&parser, GRPC_HTTP_RESPONSE, &response);
for (i = 0; i < num_slices; i++) {
GPR_ASSERT(grpc_http_parser_parse(&parser, slices[i], NULL) ==
GRPC_ERROR_NONE);
- gpr_slice_unref(slices[i]);
+ grpc_slice_unref(slices[i]);
}
GPR_ASSERT(grpc_http_parser_eof(&parser) == GRPC_ERROR_NONE);
@@ -158,16 +158,16 @@ static void test_succeeds(grpc_slice_split_mode split_mode, char *response_text,
static void test_fails(grpc_slice_split_mode split_mode, char *response_text) {
grpc_http_parser parser;
- gpr_slice input_slice = gpr_slice_from_copied_string(response_text);
+ grpc_slice input_slice = grpc_slice_from_copied_string(response_text);
size_t num_slices;
size_t i;
- gpr_slice *slices;
+ grpc_slice *slices;
grpc_error *error = GRPC_ERROR_NONE;
grpc_http_response response;
memset(&response, 0, sizeof(response));
grpc_split_slices(split_mode, &input_slice, 1, &slices, &num_slices);
- gpr_slice_unref(input_slice);
+ grpc_slice_unref(input_slice);
grpc_http_parser_init(&parser, GRPC_HTTP_RESPONSE, &response);
@@ -175,7 +175,7 @@ static void test_fails(grpc_slice_split_mode split_mode, char *response_text) {
if (GRPC_ERROR_NONE == error) {
error = grpc_http_parser_parse(&parser, slices[i], NULL);
}
- gpr_slice_unref(slices[i]);
+ grpc_slice_unref(slices[i]);
}
if (GRPC_ERROR_NONE == error) {
error = grpc_http_parser_eof(&parser);
@@ -191,16 +191,16 @@ static void test_fails(grpc_slice_split_mode split_mode, char *response_text) {
static void test_request_fails(grpc_slice_split_mode split_mode,
char *request_text) {
grpc_http_parser parser;
- gpr_slice input_slice = gpr_slice_from_copied_string(request_text);
+ grpc_slice input_slice = grpc_slice_from_copied_string(request_text);
size_t num_slices;
size_t i;
- gpr_slice *slices;
+ grpc_slice *slices;
grpc_error *error = GRPC_ERROR_NONE;
grpc_http_request request;
memset(&request, 0, sizeof(request));
grpc_split_slices(split_mode, &input_slice, 1, &slices, &num_slices);
- gpr_slice_unref(input_slice);
+ grpc_slice_unref(input_slice);
grpc_http_parser_init(&parser, GRPC_HTTP_REQUEST, &request);
@@ -208,7 +208,7 @@ static void test_request_fails(grpc_slice_split_mode split_mode,
if (error == GRPC_ERROR_NONE) {
error = grpc_http_parser_parse(&parser, slices[i], NULL);
}
- gpr_slice_unref(slices[i]);
+ grpc_slice_unref(slices[i]);
}
if (error == GRPC_ERROR_NONE) {
error = grpc_http_parser_eof(&parser);
diff --git a/test/core/http/request_fuzzer.c b/test/core/http/request_fuzzer.c
index bb6cb92c0c..98e2c9680d 100644
--- a/test/core/http/request_fuzzer.c
+++ b/test/core/http/request_fuzzer.c
@@ -47,10 +47,10 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
grpc_http_request request;
memset(&request, 0, sizeof(request));
grpc_http_parser_init(&parser, GRPC_HTTP_REQUEST, &request);
- gpr_slice slice = gpr_slice_from_copied_buffer((const char *)data, size);
+ grpc_slice slice = grpc_slice_from_copied_buffer((const char *)data, size);
GRPC_ERROR_UNREF(grpc_http_parser_parse(&parser, slice, NULL));
GRPC_ERROR_UNREF(grpc_http_parser_eof(&parser));
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
grpc_http_parser_destroy(&parser);
grpc_http_request_destroy(&request);
return 0;
diff --git a/test/core/http/response_fuzzer.c b/test/core/http/response_fuzzer.c
index 4393840484..fff04117b2 100644
--- a/test/core/http/response_fuzzer.c
+++ b/test/core/http/response_fuzzer.c
@@ -46,10 +46,10 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
grpc_http_response response;
memset(&response, 0, sizeof(response));
grpc_http_parser_init(&parser, GRPC_HTTP_RESPONSE, &response);
- gpr_slice slice = gpr_slice_from_copied_buffer((const char *)data, size);
+ grpc_slice slice = grpc_slice_from_copied_buffer((const char *)data, size);
GRPC_ERROR_UNREF(grpc_http_parser_parse(&parser, slice, NULL));
GRPC_ERROR_UNREF(grpc_http_parser_eof(&parser));
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
grpc_http_parser_destroy(&parser);
grpc_http_response_destroy(&response);
return 0;
diff --git a/test/core/internal_api_canaries/transport.c b/test/core/internal_api_canaries/transport.c
index 0617865412..2989f59535 100644
--- a/test/core/internal_api_canaries/transport.c
+++ b/test/core/internal_api_canaries/transport.c
@@ -69,7 +69,7 @@ static void test_code(void) {
grpc_transport_perform_op(&transport, NULL, NULL);
grpc_transport_ping(&transport, NULL);
grpc_transport_goaway(&transport, GRPC_STATUS_UNAVAILABLE,
- gpr_slice_malloc(0));
+ grpc_slice_malloc(0));
grpc_transport_close(&transport);
grpc_transport_destroy(&transport, NULL);
GPR_ASSERT("xyz" == grpc_transport_get_peer(&transport, NULL));
diff --git a/test/core/iomgr/endpoint_tests.c b/test/core/iomgr/endpoint_tests.c
index b79c22e42a..8186ea7e85 100644
--- a/test/core/iomgr/endpoint_tests.c
+++ b/test/core/iomgr/endpoint_tests.c
@@ -36,9 +36,9 @@
#include <stdbool.h>
#include <sys/types.h>
+#include <grpc/slice.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/slice.h>
#include <grpc/support/time.h>
#include <grpc/support/useful.h>
#include "test/core/util/test_config.h"
@@ -62,18 +62,18 @@
static gpr_mu *g_mu;
static grpc_pollset *g_pollset;
-size_t count_slices(gpr_slice *slices, size_t nslices, int *current_data) {
+size_t count_slices(grpc_slice *slices, size_t nslices, int *current_data) {
size_t num_bytes = 0;
size_t i;
size_t j;
unsigned char *buf;
for (i = 0; i < nslices; ++i) {
- buf = GPR_SLICE_START_PTR(slices[i]);
- for (j = 0; j < GPR_SLICE_LENGTH(slices[i]); ++j) {
+ buf = GRPC_SLICE_START_PTR(slices[i]);
+ for (j = 0; j < GRPC_SLICE_LENGTH(slices[i]); ++j) {
GPR_ASSERT(buf[j] == *current_data);
*current_data = (*current_data + 1) % 256;
}
- num_bytes += GPR_SLICE_LENGTH(slices[i]);
+ num_bytes += GRPC_SLICE_LENGTH(slices[i]);
}
return num_bytes;
}
@@ -87,10 +87,10 @@ static grpc_endpoint_test_fixture begin_test(grpc_endpoint_test_config config,
static void end_test(grpc_endpoint_test_config config) { config.clean_up(); }
-static gpr_slice *allocate_blocks(size_t num_bytes, size_t slice_size,
- size_t *num_blocks, uint8_t *current_data) {
+static grpc_slice *allocate_blocks(size_t num_bytes, size_t slice_size,
+ size_t *num_blocks, uint8_t *current_data) {
size_t nslices = num_bytes / slice_size + (num_bytes % slice_size ? 1 : 0);
- gpr_slice *slices = gpr_malloc(sizeof(gpr_slice) * nslices);
+ grpc_slice *slices = gpr_malloc(sizeof(grpc_slice) * nslices);
size_t num_bytes_left = num_bytes;
size_t i;
size_t j;
@@ -98,11 +98,11 @@ static gpr_slice *allocate_blocks(size_t num_bytes, size_t slice_size,
*num_blocks = nslices;
for (i = 0; i < nslices; ++i) {
- slices[i] = gpr_slice_malloc(slice_size > num_bytes_left ? num_bytes_left
- : slice_size);
- num_bytes_left -= GPR_SLICE_LENGTH(slices[i]);
- buf = GPR_SLICE_START_PTR(slices[i]);
- for (j = 0; j < GPR_SLICE_LENGTH(slices[i]); ++j) {
+ slices[i] = grpc_slice_malloc(slice_size > num_bytes_left ? num_bytes_left
+ : slice_size);
+ num_bytes_left -= GRPC_SLICE_LENGTH(slices[i]);
+ buf = GRPC_SLICE_START_PTR(slices[i]);
+ for (j = 0; j < GRPC_SLICE_LENGTH(slices[i]); ++j) {
buf[j] = *current_data;
(*current_data)++;
}
@@ -122,8 +122,8 @@ struct read_and_write_test_state {
uint8_t current_write_data;
int read_done;
int write_done;
- gpr_slice_buffer incoming;
- gpr_slice_buffer outgoing;
+ grpc_slice_buffer incoming;
+ grpc_slice_buffer outgoing;
grpc_closure done_read;
grpc_closure done_write;
};
@@ -149,7 +149,7 @@ static void read_and_write_test_read_handler(grpc_exec_ctx *exec_ctx,
static void read_and_write_test_write_handler(grpc_exec_ctx *exec_ctx,
void *data, grpc_error *error) {
struct read_and_write_test_state *state = data;
- gpr_slice *slices = NULL;
+ grpc_slice *slices = NULL;
size_t nslices;
if (error == GRPC_ERROR_NONE) {
@@ -161,8 +161,8 @@ static void read_and_write_test_write_handler(grpc_exec_ctx *exec_ctx,
if (state->current_write_size != 0) {
slices = allocate_blocks(state->current_write_size, 8192, &nslices,
&state->current_write_data);
- gpr_slice_buffer_reset_and_unref(&state->outgoing);
- gpr_slice_buffer_addn(&state->outgoing, slices, nslices);
+ grpc_slice_buffer_reset_and_unref(&state->outgoing);
+ grpc_slice_buffer_addn(&state->outgoing, slices, nslices);
grpc_endpoint_write(exec_ctx, state->write_ep, &state->outgoing,
&state->done_write);
gpr_free(slices);
@@ -214,8 +214,8 @@ static void read_and_write_test(grpc_endpoint_test_config config,
grpc_closure_init(&state.done_read, read_and_write_test_read_handler, &state);
grpc_closure_init(&state.done_write, read_and_write_test_write_handler,
&state);
- gpr_slice_buffer_init(&state.outgoing);
- gpr_slice_buffer_init(&state.incoming);
+ grpc_slice_buffer_init(&state.outgoing);
+ grpc_slice_buffer_init(&state.incoming);
/* Get started by pretending an initial write completed */
/* NOTE: Sets up initial conditions so we can have the same write handler
@@ -249,8 +249,8 @@ static void read_and_write_test(grpc_endpoint_test_config config,
grpc_exec_ctx_flush(&exec_ctx);
end_test(config);
- gpr_slice_buffer_destroy(&state.outgoing);
- gpr_slice_buffer_destroy(&state.incoming);
+ grpc_slice_buffer_destroy(&state.outgoing);
+ grpc_slice_buffer_destroy(&state.incoming);
grpc_endpoint_destroy(&exec_ctx, state.read_ep);
grpc_endpoint_destroy(&exec_ctx, state.write_ep);
grpc_exec_ctx_finish(&exec_ctx);
@@ -284,8 +284,8 @@ static void multiple_shutdown_test(grpc_endpoint_test_config config) {
begin_test(config, "multiple_shutdown_test", 128);
int fail_count = 0;
- gpr_slice_buffer slice_buffer;
- gpr_slice_buffer_init(&slice_buffer);
+ grpc_slice_buffer slice_buffer;
+ grpc_slice_buffer_init(&slice_buffer);
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
grpc_endpoint_add_to_pollset(&exec_ctx, f.client_ep, g_pollset);
@@ -297,14 +297,14 @@ static void multiple_shutdown_test(grpc_endpoint_test_config config) {
grpc_endpoint_read(&exec_ctx, f.client_ep, &slice_buffer,
grpc_closure_create(inc_on_failure, &fail_count));
wait_for_fail_count(&exec_ctx, &fail_count, 2);
- gpr_slice_buffer_add(&slice_buffer, gpr_slice_from_copied_string("a"));
+ grpc_slice_buffer_add(&slice_buffer, grpc_slice_from_copied_string("a"));
grpc_endpoint_write(&exec_ctx, f.client_ep, &slice_buffer,
grpc_closure_create(inc_on_failure, &fail_count));
wait_for_fail_count(&exec_ctx, &fail_count, 3);
grpc_endpoint_shutdown(&exec_ctx, f.client_ep);
wait_for_fail_count(&exec_ctx, &fail_count, 3);
- gpr_slice_buffer_destroy(&slice_buffer);
+ grpc_slice_buffer_destroy(&slice_buffer);
grpc_endpoint_destroy(&exec_ctx, f.client_ep);
grpc_endpoint_destroy(&exec_ctx, f.server_ep);
diff --git a/test/core/iomgr/load_file_test.c b/test/core/iomgr/load_file_test.c
index f70295a81c..8714e1f368 100644
--- a/test/core/iomgr/load_file_test.c
+++ b/test/core/iomgr/load_file_test.c
@@ -34,9 +34,9 @@
#include <stdio.h>
#include <string.h>
+#include <grpc/slice.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/slice.h>
#include "src/core/lib/iomgr/load_file.h"
#include "src/core/lib/support/string.h"
@@ -49,8 +49,8 @@ static const char prefix[] = "file_test";
static void test_load_empty_file(void) {
FILE *tmp = NULL;
- gpr_slice slice;
- gpr_slice slice_with_null_term;
+ grpc_slice slice;
+ grpc_slice slice_with_null_term;
grpc_error *error;
char *tmp_name;
@@ -63,22 +63,22 @@ static void test_load_empty_file(void) {
error = grpc_load_file(tmp_name, 0, &slice);
GPR_ASSERT(error == GRPC_ERROR_NONE);
- GPR_ASSERT(GPR_SLICE_LENGTH(slice) == 0);
+ GPR_ASSERT(GRPC_SLICE_LENGTH(slice) == 0);
error = grpc_load_file(tmp_name, 1, &slice_with_null_term);
GPR_ASSERT(error == GRPC_ERROR_NONE);
- GPR_ASSERT(GPR_SLICE_LENGTH(slice_with_null_term) == 1);
- GPR_ASSERT(GPR_SLICE_START_PTR(slice_with_null_term)[0] == 0);
+ GPR_ASSERT(GRPC_SLICE_LENGTH(slice_with_null_term) == 1);
+ GPR_ASSERT(GRPC_SLICE_START_PTR(slice_with_null_term)[0] == 0);
remove(tmp_name);
gpr_free(tmp_name);
- gpr_slice_unref(slice);
- gpr_slice_unref(slice_with_null_term);
+ grpc_slice_unref(slice);
+ grpc_slice_unref(slice_with_null_term);
}
static void test_load_failure(void) {
FILE *tmp = NULL;
- gpr_slice slice;
+ grpc_slice slice;
grpc_error *error;
char *tmp_name;
@@ -93,15 +93,15 @@ static void test_load_failure(void) {
error = grpc_load_file(tmp_name, 0, &slice);
GPR_ASSERT(error != GRPC_ERROR_NONE);
GRPC_ERROR_UNREF(error);
- GPR_ASSERT(GPR_SLICE_LENGTH(slice) == 0);
+ GPR_ASSERT(GRPC_SLICE_LENGTH(slice) == 0);
gpr_free(tmp_name);
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
}
static void test_load_small_file(void) {
FILE *tmp = NULL;
- gpr_slice slice;
- gpr_slice slice_with_null_term;
+ grpc_slice slice;
+ grpc_slice slice_with_null_term;
grpc_error *error;
char *tmp_name;
const char *blah = "blah";
@@ -116,24 +116,24 @@ static void test_load_small_file(void) {
error = grpc_load_file(tmp_name, 0, &slice);
GPR_ASSERT(error == GRPC_ERROR_NONE);
- GPR_ASSERT(GPR_SLICE_LENGTH(slice) == strlen(blah));
- GPR_ASSERT(!memcmp(GPR_SLICE_START_PTR(slice), blah, strlen(blah)));
+ GPR_ASSERT(GRPC_SLICE_LENGTH(slice) == strlen(blah));
+ GPR_ASSERT(!memcmp(GRPC_SLICE_START_PTR(slice), blah, strlen(blah)));
error = grpc_load_file(tmp_name, 1, &slice_with_null_term);
GPR_ASSERT(error == GRPC_ERROR_NONE);
- GPR_ASSERT(GPR_SLICE_LENGTH(slice_with_null_term) == (strlen(blah) + 1));
- GPR_ASSERT(strcmp((const char *)GPR_SLICE_START_PTR(slice_with_null_term),
+ GPR_ASSERT(GRPC_SLICE_LENGTH(slice_with_null_term) == (strlen(blah) + 1));
+ GPR_ASSERT(strcmp((const char *)GRPC_SLICE_START_PTR(slice_with_null_term),
blah) == 0);
remove(tmp_name);
gpr_free(tmp_name);
- gpr_slice_unref(slice);
- gpr_slice_unref(slice_with_null_term);
+ grpc_slice_unref(slice);
+ grpc_slice_unref(slice_with_null_term);
}
static void test_load_big_file(void) {
FILE *tmp = NULL;
- gpr_slice slice;
+ grpc_slice slice;
grpc_error *error;
char *tmp_name;
static const size_t buffer_size = 124631;
@@ -153,15 +153,15 @@ static void test_load_big_file(void) {
error = grpc_load_file(tmp_name, 0, &slice);
GPR_ASSERT(error == GRPC_ERROR_NONE);
- GPR_ASSERT(GPR_SLICE_LENGTH(slice) == buffer_size);
- current = GPR_SLICE_START_PTR(slice);
+ GPR_ASSERT(GRPC_SLICE_LENGTH(slice) == buffer_size);
+ current = GRPC_SLICE_START_PTR(slice);
for (i = 0; i < buffer_size; i++) {
GPR_ASSERT(current[i] == 42);
}
remove(tmp_name);
gpr_free(tmp_name);
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
gpr_free(buffer);
}
diff --git a/test/core/iomgr/resource_quota_test.c b/test/core/iomgr/resource_quota_test.c
index 22c4e4e989..a82d44f7f8 100644
--- a/test/core/iomgr/resource_quota_test.c
+++ b/test/core/iomgr/resource_quota_test.c
@@ -620,8 +620,8 @@ static void test_one_slice(void) {
int num_allocs = 0;
grpc_resource_user_slice_allocator_init(&alloc, usr, inc_int_cb, &num_allocs);
- gpr_slice_buffer buffer;
- gpr_slice_buffer_init(&buffer);
+ grpc_slice_buffer buffer;
+ grpc_slice_buffer_init(&buffer);
{
const int start_allocs = num_allocs;
@@ -631,7 +631,7 @@ static void test_one_slice(void) {
GPR_ASSERT(num_allocs == start_allocs + 1);
}
- gpr_slice_buffer_destroy(&buffer);
+ grpc_slice_buffer_destroy(&buffer);
destroy_user(usr);
grpc_resource_quota_unref(q);
}
@@ -649,8 +649,8 @@ static void test_one_slice_deleted_late(void) {
int num_allocs = 0;
grpc_resource_user_slice_allocator_init(&alloc, usr, inc_int_cb, &num_allocs);
- gpr_slice_buffer buffer;
- gpr_slice_buffer_init(&buffer);
+ grpc_slice_buffer buffer;
+ grpc_slice_buffer_init(&buffer);
{
const int start_allocs = num_allocs;
@@ -667,7 +667,7 @@ static void test_one_slice_deleted_late(void) {
}
grpc_resource_quota_unref(q);
- gpr_slice_buffer_destroy(&buffer);
+ grpc_slice_buffer_destroy(&buffer);
}
int main(int argc, char **argv) {
diff --git a/test/core/iomgr/tcp_posix_test.c b/test/core/iomgr/tcp_posix_test.c
index 29f12a5afb..5eafa570bb 100644
--- a/test/core/iomgr/tcp_posix_test.c
+++ b/test/core/iomgr/tcp_posix_test.c
@@ -124,22 +124,22 @@ struct read_socket_state {
grpc_endpoint *ep;
size_t read_bytes;
size_t target_read_bytes;
- gpr_slice_buffer incoming;
+ grpc_slice_buffer incoming;
grpc_closure read_cb;
};
-static size_t count_slices(gpr_slice *slices, size_t nslices,
+static size_t count_slices(grpc_slice *slices, size_t nslices,
int *current_data) {
size_t num_bytes = 0;
unsigned i, j;
unsigned char *buf;
for (i = 0; i < nslices; ++i) {
- buf = GPR_SLICE_START_PTR(slices[i]);
- for (j = 0; j < GPR_SLICE_LENGTH(slices[i]); ++j) {
+ buf = GRPC_SLICE_START_PTR(slices[i]);
+ for (j = 0; j < GRPC_SLICE_LENGTH(slices[i]); ++j) {
GPR_ASSERT(buf[j] == *current_data);
*current_data = (*current_data + 1) % 256;
}
- num_bytes += GPR_SLICE_LENGTH(slices[i]);
+ num_bytes += GRPC_SLICE_LENGTH(slices[i]);
}
return num_bytes;
}
@@ -193,7 +193,7 @@ static void read_test(size_t num_bytes, size_t slice_size) {
state.ep = ep;
state.read_bytes = 0;
state.target_read_bytes = written_bytes;
- gpr_slice_buffer_init(&state.incoming);
+ grpc_slice_buffer_init(&state.incoming);
grpc_closure_init(&state.read_cb, read_cb, &state);
grpc_endpoint_read(&exec_ctx, ep, &state.incoming, &state.read_cb);
@@ -212,7 +212,7 @@ static void read_test(size_t num_bytes, size_t slice_size) {
GPR_ASSERT(state.read_bytes == state.target_read_bytes);
gpr_mu_unlock(g_mu);
- gpr_slice_buffer_destroy(&state.incoming);
+ grpc_slice_buffer_destroy(&state.incoming);
grpc_endpoint_destroy(&exec_ctx, ep);
grpc_exec_ctx_finish(&exec_ctx);
}
@@ -244,7 +244,7 @@ static void large_read_test(size_t slice_size) {
state.ep = ep;
state.read_bytes = 0;
state.target_read_bytes = (size_t)written_bytes;
- gpr_slice_buffer_init(&state.incoming);
+ grpc_slice_buffer_init(&state.incoming);
grpc_closure_init(&state.read_cb, read_cb, &state);
grpc_endpoint_read(&exec_ctx, ep, &state.incoming, &state.read_cb);
@@ -263,7 +263,7 @@ static void large_read_test(size_t slice_size) {
GPR_ASSERT(state.read_bytes == state.target_read_bytes);
gpr_mu_unlock(g_mu);
- gpr_slice_buffer_destroy(&state.incoming);
+ grpc_slice_buffer_destroy(&state.incoming);
grpc_endpoint_destroy(&exec_ctx, ep);
grpc_exec_ctx_finish(&exec_ctx);
}
@@ -273,21 +273,21 @@ struct write_socket_state {
int write_done;
};
-static gpr_slice *allocate_blocks(size_t num_bytes, size_t slice_size,
- size_t *num_blocks, uint8_t *current_data) {
+static grpc_slice *allocate_blocks(size_t num_bytes, size_t slice_size,
+ size_t *num_blocks, uint8_t *current_data) {
size_t nslices = num_bytes / slice_size + (num_bytes % slice_size ? 1u : 0u);
- gpr_slice *slices = gpr_malloc(sizeof(gpr_slice) * nslices);
+ grpc_slice *slices = gpr_malloc(sizeof(grpc_slice) * nslices);
size_t num_bytes_left = num_bytes;
unsigned i, j;
unsigned char *buf;
*num_blocks = nslices;
for (i = 0; i < nslices; ++i) {
- slices[i] = gpr_slice_malloc(slice_size > num_bytes_left ? num_bytes_left
- : slice_size);
- num_bytes_left -= GPR_SLICE_LENGTH(slices[i]);
- buf = GPR_SLICE_START_PTR(slices[i]);
- for (j = 0; j < GPR_SLICE_LENGTH(slices[i]); ++j) {
+ slices[i] = grpc_slice_malloc(slice_size > num_bytes_left ? num_bytes_left
+ : slice_size);
+ num_bytes_left -= GRPC_SLICE_LENGTH(slices[i]);
+ buf = GRPC_SLICE_START_PTR(slices[i]);
+ for (j = 0; j < GRPC_SLICE_LENGTH(slices[i]); ++j) {
buf[j] = *current_data;
(*current_data)++;
}
@@ -357,9 +357,9 @@ static void write_test(size_t num_bytes, size_t slice_size) {
grpc_endpoint *ep;
struct write_socket_state state;
size_t num_blocks;
- gpr_slice *slices;
+ grpc_slice *slices;
uint8_t current_data = 0;
- gpr_slice_buffer outgoing;
+ grpc_slice_buffer outgoing;
grpc_closure write_done_closure;
gpr_timespec deadline = GRPC_TIMEOUT_SECONDS_TO_DEADLINE(20);
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
@@ -382,8 +382,8 @@ static void write_test(size_t num_bytes, size_t slice_size) {
slices = allocate_blocks(num_bytes, slice_size, &num_blocks, &current_data);
- gpr_slice_buffer_init(&outgoing);
- gpr_slice_buffer_addn(&outgoing, slices, num_blocks);
+ grpc_slice_buffer_init(&outgoing);
+ grpc_slice_buffer_addn(&outgoing, slices, num_blocks);
grpc_closure_init(&write_done_closure, write_done, &state);
grpc_endpoint_write(&exec_ctx, ep, &outgoing, &write_done_closure);
@@ -404,7 +404,7 @@ static void write_test(size_t num_bytes, size_t slice_size) {
}
gpr_mu_unlock(g_mu);
- gpr_slice_buffer_destroy(&outgoing);
+ grpc_slice_buffer_destroy(&outgoing);
grpc_endpoint_destroy(&exec_ctx, ep);
gpr_free(slices);
grpc_exec_ctx_finish(&exec_ctx);
@@ -451,7 +451,7 @@ static void release_fd_test(size_t num_bytes, size_t slice_size) {
state.ep = ep;
state.read_bytes = 0;
state.target_read_bytes = written_bytes;
- gpr_slice_buffer_init(&state.incoming);
+ grpc_slice_buffer_init(&state.incoming);
grpc_closure_init(&state.read_cb, read_cb, &state);
grpc_endpoint_read(&exec_ctx, ep, &state.incoming, &state.read_cb);
@@ -472,7 +472,7 @@ static void release_fd_test(size_t num_bytes, size_t slice_size) {
GPR_ASSERT(state.read_bytes == state.target_read_bytes);
gpr_mu_unlock(g_mu);
- gpr_slice_buffer_destroy(&state.incoming);
+ grpc_slice_buffer_destroy(&state.incoming);
grpc_tcp_destroy_and_release_fd(&exec_ctx, ep, &fd, &fd_released_cb);
grpc_exec_ctx_flush(&exec_ctx);
gpr_mu_lock(g_mu);
diff --git a/test/core/nanopb/fuzzer_response.c b/test/core/nanopb/fuzzer_response.c
index a82f20df83..202c120c67 100644
--- a/test/core/nanopb/fuzzer_response.c
+++ b/test/core/nanopb/fuzzer_response.c
@@ -45,11 +45,11 @@ static void dont_log(gpr_log_func_args *args) {}
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
if (squelch) gpr_set_log_function(dont_log);
- gpr_slice slice = gpr_slice_from_copied_buffer((const char *)data, size);
+ grpc_slice slice = grpc_slice_from_copied_buffer((const char *)data, size);
grpc_grpclb_initial_response *response;
if ((response = grpc_grpclb_initial_response_parse(slice))) {
grpc_grpclb_initial_response_destroy(response);
}
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
return 0;
}
diff --git a/test/core/nanopb/fuzzer_serverlist.c b/test/core/nanopb/fuzzer_serverlist.c
index 9700bf1cda..b225ae0d51 100644
--- a/test/core/nanopb/fuzzer_serverlist.c
+++ b/test/core/nanopb/fuzzer_serverlist.c
@@ -45,11 +45,11 @@ static void dont_log(gpr_log_func_args *args) {}
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
if (squelch) gpr_set_log_function(dont_log);
- gpr_slice slice = gpr_slice_from_copied_buffer((const char *)data, size);
+ grpc_slice slice = grpc_slice_from_copied_buffer((const char *)data, size);
grpc_grpclb_serverlist *serverlist;
if ((serverlist = grpc_grpclb_response_parse_serverlist(slice))) {
grpc_grpclb_destroy_serverlist(serverlist);
}
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
return 0;
}
diff --git a/test/core/security/b64_test.c b/test/core/security/b64_test.c
index b26bd026fd..af883f51e9 100644
--- a/test/core/security/b64_test.c
+++ b/test/core/security/b64_test.c
@@ -35,9 +35,9 @@
#include <string.h>
+#include <grpc/slice.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/slice.h>
#include "test/core/util/test_config.h"
static int buffers_are_equal(const unsigned char *buf1,
@@ -57,12 +57,12 @@ static void test_simple_encode_decode_b64(int url_safe, int multiline) {
const char *hello = "hello";
char *hello_b64 =
grpc_base64_encode(hello, strlen(hello), url_safe, multiline);
- gpr_slice hello_slice = grpc_base64_decode(hello_b64, url_safe);
- GPR_ASSERT(GPR_SLICE_LENGTH(hello_slice) == strlen(hello));
- GPR_ASSERT(strncmp((const char *)GPR_SLICE_START_PTR(hello_slice), hello,
- GPR_SLICE_LENGTH(hello_slice)) == 0);
+ grpc_slice hello_slice = grpc_base64_decode(hello_b64, url_safe);
+ GPR_ASSERT(GRPC_SLICE_LENGTH(hello_slice) == strlen(hello));
+ GPR_ASSERT(strncmp((const char *)GRPC_SLICE_START_PTR(hello_slice), hello,
+ GRPC_SLICE_LENGTH(hello_slice)) == 0);
- gpr_slice_unref(hello_slice);
+ grpc_slice_unref(hello_slice);
gpr_free(hello_b64);
}
@@ -70,17 +70,17 @@ static void test_full_range_encode_decode_b64(int url_safe, int multiline) {
unsigned char orig[256];
size_t i;
char *b64;
- gpr_slice orig_decoded;
+ grpc_slice orig_decoded;
for (i = 0; i < sizeof(orig); i++) orig[i] = (uint8_t)i;
/* Try all the different paddings. */
for (i = 0; i < 3; i++) {
b64 = grpc_base64_encode(orig, sizeof(orig) - i, url_safe, multiline);
orig_decoded = grpc_base64_decode(b64, url_safe);
- GPR_ASSERT(GPR_SLICE_LENGTH(orig_decoded) == (sizeof(orig) - i));
- GPR_ASSERT(buffers_are_equal(orig, GPR_SLICE_START_PTR(orig_decoded),
+ GPR_ASSERT(GRPC_SLICE_LENGTH(orig_decoded) == (sizeof(orig) - i));
+ GPR_ASSERT(buffers_are_equal(orig, GRPC_SLICE_START_PTR(orig_decoded),
sizeof(orig) - i));
- gpr_slice_unref(orig_decoded);
+ grpc_slice_unref(orig_decoded);
gpr_free(b64);
}
}
@@ -121,21 +121,21 @@ static void test_url_safe_unsafe_mismtach_failure(void) {
unsigned char orig[256];
size_t i;
char *b64;
- gpr_slice orig_decoded;
+ grpc_slice orig_decoded;
int url_safe = 1;
for (i = 0; i < sizeof(orig); i++) orig[i] = (uint8_t)i;
b64 = grpc_base64_encode(orig, sizeof(orig), url_safe, 0);
orig_decoded = grpc_base64_decode(b64, !url_safe);
- GPR_ASSERT(GPR_SLICE_IS_EMPTY(orig_decoded));
+ GPR_ASSERT(GRPC_SLICE_IS_EMPTY(orig_decoded));
gpr_free(b64);
- gpr_slice_unref(orig_decoded);
+ grpc_slice_unref(orig_decoded);
b64 = grpc_base64_encode(orig, sizeof(orig), !url_safe, 0);
orig_decoded = grpc_base64_decode(b64, url_safe);
- GPR_ASSERT(GPR_SLICE_IS_EMPTY(orig_decoded));
+ GPR_ASSERT(GRPC_SLICE_IS_EMPTY(orig_decoded));
gpr_free(b64);
- gpr_slice_unref(orig_decoded);
+ grpc_slice_unref(orig_decoded);
}
static void test_rfc4648_test_vectors(void) {
@@ -171,40 +171,40 @@ static void test_rfc4648_test_vectors(void) {
}
static void test_unpadded_decode(void) {
- gpr_slice decoded;
+ grpc_slice decoded;
decoded = grpc_base64_decode("Zm9vYmFy", 0);
- GPR_ASSERT(!GPR_SLICE_IS_EMPTY(decoded));
- GPR_ASSERT(gpr_slice_str_cmp(decoded, "foobar") == 0);
- gpr_slice_unref(decoded);
+ GPR_ASSERT(!GRPC_SLICE_IS_EMPTY(decoded));
+ GPR_ASSERT(grpc_slice_str_cmp(decoded, "foobar") == 0);
+ grpc_slice_unref(decoded);
decoded = grpc_base64_decode("Zm9vYmE", 0);
- GPR_ASSERT(!GPR_SLICE_IS_EMPTY(decoded));
- GPR_ASSERT(gpr_slice_str_cmp(decoded, "fooba") == 0);
- gpr_slice_unref(decoded);
+ GPR_ASSERT(!GRPC_SLICE_IS_EMPTY(decoded));
+ GPR_ASSERT(grpc_slice_str_cmp(decoded, "fooba") == 0);
+ grpc_slice_unref(decoded);
decoded = grpc_base64_decode("Zm9vYg", 0);
- GPR_ASSERT(!GPR_SLICE_IS_EMPTY(decoded));
- GPR_ASSERT(gpr_slice_str_cmp(decoded, "foob") == 0);
- gpr_slice_unref(decoded);
+ GPR_ASSERT(!GRPC_SLICE_IS_EMPTY(decoded));
+ GPR_ASSERT(grpc_slice_str_cmp(decoded, "foob") == 0);
+ grpc_slice_unref(decoded);
decoded = grpc_base64_decode("Zm9v", 0);
- GPR_ASSERT(!GPR_SLICE_IS_EMPTY(decoded));
- GPR_ASSERT(gpr_slice_str_cmp(decoded, "foo") == 0);
- gpr_slice_unref(decoded);
+ GPR_ASSERT(!GRPC_SLICE_IS_EMPTY(decoded));
+ GPR_ASSERT(grpc_slice_str_cmp(decoded, "foo") == 0);
+ grpc_slice_unref(decoded);
decoded = grpc_base64_decode("Zm8", 0);
- GPR_ASSERT(!GPR_SLICE_IS_EMPTY(decoded));
- GPR_ASSERT(gpr_slice_str_cmp(decoded, "fo") == 0);
- gpr_slice_unref(decoded);
+ GPR_ASSERT(!GRPC_SLICE_IS_EMPTY(decoded));
+ GPR_ASSERT(grpc_slice_str_cmp(decoded, "fo") == 0);
+ grpc_slice_unref(decoded);
decoded = grpc_base64_decode("Zg", 0);
- GPR_ASSERT(!GPR_SLICE_IS_EMPTY(decoded));
- GPR_ASSERT(gpr_slice_str_cmp(decoded, "f") == 0);
- gpr_slice_unref(decoded);
+ GPR_ASSERT(!GRPC_SLICE_IS_EMPTY(decoded));
+ GPR_ASSERT(grpc_slice_str_cmp(decoded, "f") == 0);
+ grpc_slice_unref(decoded);
decoded = grpc_base64_decode("", 0);
- GPR_ASSERT(GPR_SLICE_IS_EMPTY(decoded));
+ GPR_ASSERT(GRPC_SLICE_IS_EMPTY(decoded));
}
int main(int argc, char **argv) {
diff --git a/test/core/security/create_jwt.c b/test/core/security/create_jwt.c
index 1bd135f175..741ace9bdd 100644
--- a/test/core/security/create_jwt.c
+++ b/test/core/security/create_jwt.c
@@ -37,21 +37,21 @@
#include "src/core/lib/iomgr/load_file.h"
#include "src/core/lib/security/credentials/jwt/jwt_credentials.h"
+#include <grpc/slice.h>
#include <grpc/support/alloc.h>
#include <grpc/support/cmdline.h>
#include <grpc/support/log.h>
-#include <grpc/support/slice.h>
void create_jwt(const char *json_key_file_path, const char *service_url,
const char *scope) {
grpc_auth_json_key key;
char *jwt;
- gpr_slice json_key_data;
+ grpc_slice json_key_data;
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"load_file", grpc_load_file(json_key_file_path, 1, &json_key_data)));
key = grpc_auth_json_key_create_from_string(
- (const char *)GPR_SLICE_START_PTR(json_key_data));
- gpr_slice_unref(json_key_data);
+ (const char *)GRPC_SLICE_START_PTR(json_key_data));
+ grpc_slice_unref(json_key_data);
if (!grpc_auth_json_key_is_valid(&key)) {
fprintf(stderr, "Could not parse json key.\n");
exit(1);
diff --git a/test/core/security/credentials_test.c b/test/core/security/credentials_test.c
index b74baa33f1..d4c755088d 100644
--- a/test/core/security/credentials_test.c
+++ b/test/core/security/credentials_test.c
@@ -187,14 +187,14 @@ static void test_add_to_empty_md_store(void) {
grpc_credentials_md_store *store = grpc_credentials_md_store_create(0);
const char *key_str = "hello";
const char *value_str = "there blah blah blah blah blah blah blah";
- gpr_slice key = gpr_slice_from_copied_string(key_str);
- gpr_slice value = gpr_slice_from_copied_string(value_str);
+ grpc_slice key = grpc_slice_from_copied_string(key_str);
+ grpc_slice value = grpc_slice_from_copied_string(value_str);
grpc_credentials_md_store_add(store, key, value);
GPR_ASSERT(store->num_entries == 1);
- GPR_ASSERT(gpr_slice_cmp(key, store->entries[0].key) == 0);
- GPR_ASSERT(gpr_slice_cmp(value, store->entries[0].value) == 0);
- gpr_slice_unref(key);
- gpr_slice_unref(value);
+ GPR_ASSERT(grpc_slice_cmp(key, store->entries[0].key) == 0);
+ GPR_ASSERT(grpc_slice_cmp(value, store->entries[0].value) == 0);
+ grpc_slice_unref(key);
+ grpc_slice_unref(value);
grpc_credentials_md_store_unref(store);
}
@@ -204,8 +204,8 @@ static void test_add_cstrings_to_empty_md_store(void) {
const char *value_str = "there blah blah blah blah blah blah blah";
grpc_credentials_md_store_add_cstrings(store, key_str, value_str);
GPR_ASSERT(store->num_entries == 1);
- GPR_ASSERT(gpr_slice_str_cmp(store->entries[0].key, key_str) == 0);
- GPR_ASSERT(gpr_slice_str_cmp(store->entries[0].value, value_str) == 0);
+ GPR_ASSERT(grpc_slice_str_cmp(store->entries[0].key, key_str) == 0);
+ GPR_ASSERT(grpc_slice_str_cmp(store->entries[0].value, value_str) == 0);
grpc_credentials_md_store_unref(store);
}
@@ -227,8 +227,8 @@ static void test_add_abunch_to_md_store(void) {
grpc_credentials_md_store_add_cstrings(store, key_str, value_str);
}
for (i = 0; i < num_entries; i++) {
- GPR_ASSERT(gpr_slice_str_cmp(store->entries[i].key, key_str) == 0);
- GPR_ASSERT(gpr_slice_str_cmp(store->entries[i].value, value_str) == 0);
+ GPR_ASSERT(grpc_slice_str_cmp(store->entries[i].key, key_str) == 0);
+ GPR_ASSERT(grpc_slice_str_cmp(store->entries[i].value, value_str) == 0);
}
grpc_credentials_md_store_unref(store);
}
@@ -243,9 +243,10 @@ static void test_oauth2_token_fetcher_creds_parsing_ok(void) {
GPR_ASSERT(token_lifetime.tv_sec == 3599);
GPR_ASSERT(token_lifetime.tv_nsec == 0);
GPR_ASSERT(token_md->num_entries == 1);
- GPR_ASSERT(gpr_slice_str_cmp(token_md->entries[0].key, "authorization") == 0);
- GPR_ASSERT(gpr_slice_str_cmp(token_md->entries[0].value,
- "Bearer ya29.AHES6ZRN3-HlhAPya30GnW_bHSb_") ==
+ GPR_ASSERT(grpc_slice_str_cmp(token_md->entries[0].key, "authorization") ==
+ 0);
+ GPR_ASSERT(grpc_slice_str_cmp(token_md->entries[0].value,
+ "Bearer ya29.AHES6ZRN3-HlhAPya30GnW_bHSb_") ==
0);
grpc_credentials_md_store_unref(token_md);
grpc_http_response_destroy(&response);
@@ -333,8 +334,8 @@ static void check_metadata(expected_md *expected, grpc_credentials_md *md_elems,
for (i = 0; i < num_md; i++) {
size_t j;
for (j = 0; j < num_md; j++) {
- if (0 == gpr_slice_str_cmp(md_elems[j].key, expected[i].key)) {
- GPR_ASSERT(gpr_slice_str_cmp(md_elems[j].value, expected[i].value) ==
+ if (0 == grpc_slice_str_cmp(md_elems[j].key, expected[i].key)) {
+ GPR_ASSERT(grpc_slice_str_cmp(md_elems[j].value, expected[i].value) ==
0);
break;
}
@@ -528,9 +529,9 @@ static void on_oauth2_creds_get_metadata_success(
GPR_ASSERT(status == GRPC_CREDENTIALS_OK);
GPR_ASSERT(error_details == NULL);
GPR_ASSERT(num_md == 1);
- GPR_ASSERT(gpr_slice_str_cmp(md_elems[0].key, "authorization") == 0);
- GPR_ASSERT(gpr_slice_str_cmp(md_elems[0].value,
- "Bearer ya29.AHES6ZRN3-HlhAPya30GnW_bHSb_") ==
+ GPR_ASSERT(grpc_slice_str_cmp(md_elems[0].key, "authorization") == 0);
+ GPR_ASSERT(grpc_slice_str_cmp(md_elems[0].value,
+ "Bearer ya29.AHES6ZRN3-HlhAPya30GnW_bHSb_") ==
0);
GPR_ASSERT(user_data != NULL);
GPR_ASSERT(strcmp((const char *)user_data, test_user_data) == 0);
@@ -781,8 +782,8 @@ static void on_jwt_creds_get_metadata_success(
GPR_ASSERT(status == GRPC_CREDENTIALS_OK);
GPR_ASSERT(error_details == NULL);
GPR_ASSERT(num_md == 1);
- GPR_ASSERT(gpr_slice_str_cmp(md_elems[0].key, "authorization") == 0);
- GPR_ASSERT(gpr_slice_str_cmp(md_elems[0].value, expected_md_value) == 0);
+ GPR_ASSERT(grpc_slice_str_cmp(md_elems[0].key, "authorization") == 0);
+ GPR_ASSERT(grpc_slice_str_cmp(md_elems[0].value, expected_md_value) == 0);
GPR_ASSERT(user_data != NULL);
GPR_ASSERT(strcmp((const char *)user_data, test_user_data) == 0);
gpr_free(expected_md_value);
@@ -1057,8 +1058,8 @@ static void on_plugin_metadata_received_success(
GPR_ASSERT(md_elems != NULL);
GPR_ASSERT(num_md == GPR_ARRAY_SIZE(plugin_md));
for (i = 0; i < num_md; i++) {
- GPR_ASSERT(gpr_slice_str_cmp(md_elems[i].key, plugin_md[i].key) == 0);
- GPR_ASSERT(gpr_slice_str_cmp(md_elems[i].value, plugin_md[i].value) == 0);
+ GPR_ASSERT(grpc_slice_str_cmp(md_elems[i].key, plugin_md[i].key) == 0);
+ GPR_ASSERT(grpc_slice_str_cmp(md_elems[i].value, plugin_md[i].value) == 0);
}
}
diff --git a/test/core/security/fetch_oauth2.c b/test/core/security/fetch_oauth2.c
index 292f59a7c1..e9e211206c 100644
--- a/test/core/security/fetch_oauth2.c
+++ b/test/core/security/fetch_oauth2.c
@@ -36,10 +36,10 @@
#include <grpc/grpc.h>
#include <grpc/grpc_security.h>
+#include <grpc/slice.h>
#include <grpc/support/alloc.h>
#include <grpc/support/cmdline.h>
#include <grpc/support/log.h>
-#include <grpc/support/slice.h>
#include <grpc/support/sync.h>
#include "src/core/lib/iomgr/load_file.h"
@@ -48,12 +48,12 @@
static grpc_call_credentials *create_refresh_token_creds(
const char *json_refresh_token_file_path) {
- gpr_slice refresh_token;
+ grpc_slice refresh_token;
GPR_ASSERT(GRPC_LOG_IF_ERROR(
"load_file",
grpc_load_file(json_refresh_token_file_path, 1, &refresh_token)));
return grpc_google_refresh_token_credentials_create(
- (const char *)GPR_SLICE_START_PTR(refresh_token), NULL);
+ (const char *)GRPC_SLICE_START_PTR(refresh_token), NULL);
}
int main(int argc, char **argv) {
diff --git a/test/core/security/json_token_test.c b/test/core/security/json_token_test.c
index 405fe56c46..201655881f 100644
--- a/test/core/security/json_token_test.c
+++ b/test/core/security/json_token_test.c
@@ -37,9 +37,9 @@
#include <string.h>
#include <grpc/grpc_security.h>
+#include <grpc/slice.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/slice.h>
#include "src/core/lib/json/json.h"
#include "src/core/lib/security/credentials/oauth2/oauth2_credentials.h"
@@ -223,20 +223,20 @@ static grpc_json *parse_json_part_from_jwt(const char *str, size_t len,
char *b64;
char *decoded;
grpc_json *json;
- gpr_slice slice;
+ grpc_slice slice;
b64 = gpr_malloc(len + 1);
strncpy(b64, str, len);
b64[len] = '\0';
slice = grpc_base64_decode(b64, 1);
- GPR_ASSERT(!GPR_SLICE_IS_EMPTY(slice));
- decoded = gpr_malloc(GPR_SLICE_LENGTH(slice) + 1);
- strncpy(decoded, (const char *)GPR_SLICE_START_PTR(slice),
- GPR_SLICE_LENGTH(slice));
- decoded[GPR_SLICE_LENGTH(slice)] = '\0';
+ GPR_ASSERT(!GRPC_SLICE_IS_EMPTY(slice));
+ decoded = gpr_malloc(GRPC_SLICE_LENGTH(slice) + 1);
+ strncpy(decoded, (const char *)GRPC_SLICE_START_PTR(slice),
+ GRPC_SLICE_LENGTH(slice));
+ decoded[GRPC_SLICE_LENGTH(slice)] = '\0';
json = grpc_json_parse_string(decoded);
gpr_free(b64);
*scratchpad = decoded;
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
return json;
}
@@ -341,9 +341,9 @@ static void check_jwt_signature(const char *b64_signature, RSA *rsa_key,
EVP_MD_CTX *md_ctx = EVP_MD_CTX_create();
EVP_PKEY *key = EVP_PKEY_new();
- gpr_slice sig = grpc_base64_decode(b64_signature, 1);
- GPR_ASSERT(!GPR_SLICE_IS_EMPTY(sig));
- GPR_ASSERT(GPR_SLICE_LENGTH(sig) == 128);
+ grpc_slice sig = grpc_base64_decode(b64_signature, 1);
+ GPR_ASSERT(!GRPC_SLICE_IS_EMPTY(sig));
+ GPR_ASSERT(GRPC_SLICE_LENGTH(sig) == 128);
GPR_ASSERT(md_ctx != NULL);
GPR_ASSERT(key != NULL);
@@ -352,10 +352,10 @@ static void check_jwt_signature(const char *b64_signature, RSA *rsa_key,
GPR_ASSERT(EVP_DigestVerifyInit(md_ctx, NULL, EVP_sha256(), NULL, key) == 1);
GPR_ASSERT(EVP_DigestVerifyUpdate(md_ctx, signed_data, signed_data_size) ==
1);
- GPR_ASSERT(EVP_DigestVerifyFinal(md_ctx, GPR_SLICE_START_PTR(sig),
- GPR_SLICE_LENGTH(sig)) == 1);
+ GPR_ASSERT(EVP_DigestVerifyFinal(md_ctx, GRPC_SLICE_START_PTR(sig),
+ GRPC_SLICE_LENGTH(sig)) == 1);
- gpr_slice_unref(sig);
+ grpc_slice_unref(sig);
if (key != NULL) EVP_PKEY_free(key);
if (md_ctx != NULL) EVP_MD_CTX_destroy(md_ctx);
}
diff --git a/test/core/security/jwt_verifier_test.c b/test/core/security/jwt_verifier_test.c
index 36b331a777..f8afba8d6d 100644
--- a/test/core/security/jwt_verifier_test.c
+++ b/test/core/security/jwt_verifier_test.c
@@ -37,9 +37,9 @@
#include <grpc/grpc.h>
+#include <grpc/slice.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/slice.h>
#include <grpc/support/string_util.h>
#include "src/core/lib/http/httpcli.h"
@@ -181,9 +181,9 @@ typedef struct {
static void test_claims_success(void) {
grpc_jwt_claims *claims;
- gpr_slice s = gpr_slice_from_copied_string(claims_without_time_constraint);
+ grpc_slice s = grpc_slice_from_copied_string(claims_without_time_constraint);
grpc_json *json = grpc_json_parse_string_with_len(
- (char *)GPR_SLICE_START_PTR(s), GPR_SLICE_LENGTH(s));
+ (char *)GRPC_SLICE_START_PTR(s), GRPC_SLICE_LENGTH(s));
GPR_ASSERT(json != NULL);
claims = grpc_jwt_claims_from_json(json, s);
GPR_ASSERT(claims != NULL);
@@ -199,9 +199,9 @@ static void test_claims_success(void) {
static void test_expired_claims_failure(void) {
grpc_jwt_claims *claims;
- gpr_slice s = gpr_slice_from_copied_string(expired_claims);
+ grpc_slice s = grpc_slice_from_copied_string(expired_claims);
grpc_json *json = grpc_json_parse_string_with_len(
- (char *)GPR_SLICE_START_PTR(s), GPR_SLICE_LENGTH(s));
+ (char *)GRPC_SLICE_START_PTR(s), GRPC_SLICE_LENGTH(s));
gpr_timespec exp_iat = {100, 0, GPR_CLOCK_REALTIME};
gpr_timespec exp_exp = {120, 0, GPR_CLOCK_REALTIME};
gpr_timespec exp_nbf = {60, 0, GPR_CLOCK_REALTIME};
@@ -223,17 +223,17 @@ static void test_expired_claims_failure(void) {
}
static void test_invalid_claims_failure(void) {
- gpr_slice s = gpr_slice_from_copied_string(invalid_claims);
+ grpc_slice s = grpc_slice_from_copied_string(invalid_claims);
grpc_json *json = grpc_json_parse_string_with_len(
- (char *)GPR_SLICE_START_PTR(s), GPR_SLICE_LENGTH(s));
+ (char *)GRPC_SLICE_START_PTR(s), GRPC_SLICE_LENGTH(s));
GPR_ASSERT(grpc_jwt_claims_from_json(json, s) == NULL);
}
static void test_bad_audience_claims_failure(void) {
grpc_jwt_claims *claims;
- gpr_slice s = gpr_slice_from_copied_string(claims_without_time_constraint);
+ grpc_slice s = grpc_slice_from_copied_string(claims_without_time_constraint);
grpc_json *json = grpc_json_parse_string_with_len(
- (char *)GPR_SLICE_START_PTR(s), GPR_SLICE_LENGTH(s));
+ (char *)GRPC_SLICE_START_PTR(s), GRPC_SLICE_LENGTH(s));
GPR_ASSERT(json != NULL);
claims = grpc_jwt_claims_from_json(json, s);
GPR_ASSERT(claims != NULL);
@@ -478,20 +478,20 @@ static void test_jwt_verifier_bad_json_key(void) {
}
static void corrupt_jwt_sig(char *jwt) {
- gpr_slice sig;
+ grpc_slice sig;
char *bad_b64_sig;
uint8_t *sig_bytes;
char *last_dot = strrchr(jwt, '.');
GPR_ASSERT(last_dot != NULL);
sig = grpc_base64_decode(last_dot + 1, 1);
- GPR_ASSERT(!GPR_SLICE_IS_EMPTY(sig));
- sig_bytes = GPR_SLICE_START_PTR(sig);
+ GPR_ASSERT(!GRPC_SLICE_IS_EMPTY(sig));
+ sig_bytes = GRPC_SLICE_START_PTR(sig);
(*sig_bytes)++; /* Corrupt first byte. */
- bad_b64_sig =
- grpc_base64_encode(GPR_SLICE_START_PTR(sig), GPR_SLICE_LENGTH(sig), 1, 0);
+ bad_b64_sig = grpc_base64_encode(GRPC_SLICE_START_PTR(sig),
+ GRPC_SLICE_LENGTH(sig), 1, 0);
memcpy(last_dot + 1, bad_b64_sig, strlen(bad_b64_sig));
gpr_free(bad_b64_sig);
- gpr_slice_unref(sig);
+ grpc_slice_unref(sig);
}
static void on_verification_bad_signature(void *user_data,
diff --git a/test/core/security/oauth2_utils.c b/test/core/security/oauth2_utils.c
index 9b97c38fcb..44a209258d 100644
--- a/test/core/security/oauth2_utils.c
+++ b/test/core/security/oauth2_utils.c
@@ -37,9 +37,9 @@
#include <grpc/grpc.h>
#include <grpc/grpc_security.h>
+#include <grpc/slice.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/slice.h>
#include <grpc/support/sync.h>
#include "src/core/lib/security/credentials/credentials.h"
@@ -57,16 +57,16 @@ static void on_oauth2_response(grpc_exec_ctx *exec_ctx, void *user_data,
const char *error_details) {
oauth2_request *request = user_data;
char *token = NULL;
- gpr_slice token_slice;
+ grpc_slice token_slice;
if (status == GRPC_CREDENTIALS_ERROR) {
gpr_log(GPR_ERROR, "Fetching token failed.");
} else {
GPR_ASSERT(num_md == 1);
token_slice = md_elems[0].value;
- token = gpr_malloc(GPR_SLICE_LENGTH(token_slice) + 1);
- memcpy(token, GPR_SLICE_START_PTR(token_slice),
- GPR_SLICE_LENGTH(token_slice));
- token[GPR_SLICE_LENGTH(token_slice)] = '\0';
+ token = gpr_malloc(GRPC_SLICE_LENGTH(token_slice) + 1);
+ memcpy(token, GRPC_SLICE_START_PTR(token_slice),
+ GRPC_SLICE_LENGTH(token_slice));
+ token[GRPC_SLICE_LENGTH(token_slice)] = '\0';
}
gpr_mu_lock(request->mu);
request->is_done = 1;
diff --git a/test/core/security/print_google_default_creds_token.c b/test/core/security/print_google_default_creds_token.c
index a391c0876b..2b74690bc3 100644
--- a/test/core/security/print_google_default_creds_token.c
+++ b/test/core/security/print_google_default_creds_token.c
@@ -36,14 +36,15 @@
#include <grpc/grpc.h>
#include <grpc/grpc_security.h>
+#include <grpc/slice.h>
#include <grpc/support/alloc.h>
#include <grpc/support/cmdline.h>
#include <grpc/support/log.h>
-#include <grpc/support/slice.h>
#include <grpc/support/sync.h>
#include "src/core/lib/security/credentials/composite/composite_credentials.h"
#include "src/core/lib/security/credentials/credentials.h"
+#include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/lib/support/string.h"
typedef struct {
@@ -62,7 +63,7 @@ static void on_metadata_response(grpc_exec_ctx *exec_ctx, void *user_data,
} else {
char *token;
GPR_ASSERT(num_md == 1);
- token = gpr_dump_slice(md_elems[0].value, GPR_DUMP_ASCII);
+ token = grpc_dump_slice(md_elems[0].value, GPR_DUMP_ASCII);
printf("\nGot token: %s\n\n", token);
gpr_free(token);
}
diff --git a/test/core/security/secure_endpoint_test.c b/test/core/security/secure_endpoint_test.c
index 2262fde98d..b5d95004fe 100644
--- a/test/core/security/secure_endpoint_test.c
+++ b/test/core/security/secure_endpoint_test.c
@@ -49,7 +49,7 @@ static gpr_mu *g_mu;
static grpc_pollset *g_pollset;
static grpc_endpoint_test_fixture secure_endpoint_create_fixture_tcp_socketpair(
- size_t slice_size, gpr_slice *leftover_slices, size_t leftover_nslices) {
+ size_t slice_size, grpc_slice *leftover_slices, size_t leftover_nslices) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
tsi_frame_protector *fake_read_protector = tsi_create_fake_protector(NULL);
tsi_frame_protector *fake_write_protector = tsi_create_fake_protector(NULL);
@@ -74,11 +74,11 @@ static grpc_endpoint_test_fixture secure_endpoint_create_fixture_tcp_socketpair(
size_t buffer_size = total_buffer_size;
uint8_t *encrypted_buffer = gpr_malloc(buffer_size);
uint8_t *cur = encrypted_buffer;
- gpr_slice encrypted_leftover;
+ grpc_slice encrypted_leftover;
for (i = 0; i < leftover_nslices; i++) {
- gpr_slice plain = leftover_slices[i];
- uint8_t *message_bytes = GPR_SLICE_START_PTR(plain);
- size_t message_size = GPR_SLICE_LENGTH(plain);
+ grpc_slice plain = leftover_slices[i];
+ uint8_t *message_bytes = GRPC_SLICE_START_PTR(plain);
+ size_t message_size = GRPC_SLICE_LENGTH(plain);
while (message_size > 0) {
size_t protected_buffer_size_to_send = buffer_size;
size_t processed_message_size = message_size;
@@ -92,7 +92,7 @@ static grpc_endpoint_test_fixture secure_endpoint_create_fixture_tcp_socketpair(
GPR_ASSERT(buffer_size >= protected_buffer_size_to_send);
buffer_size -= protected_buffer_size_to_send;
}
- gpr_slice_unref(plain);
+ grpc_slice_unref(plain);
}
do {
size_t protected_buffer_size_to_send = buffer_size;
@@ -104,11 +104,11 @@ static grpc_endpoint_test_fixture secure_endpoint_create_fixture_tcp_socketpair(
GPR_ASSERT(buffer_size >= protected_buffer_size_to_send);
buffer_size -= protected_buffer_size_to_send;
} while (still_pending_size > 0);
- encrypted_leftover = gpr_slice_from_copied_buffer(
+ encrypted_leftover = grpc_slice_from_copied_buffer(
(const char *)encrypted_buffer, total_buffer_size - buffer_size);
f.client_ep = grpc_secure_endpoint_create(fake_read_protector, tcp.client,
&encrypted_leftover, 1);
- gpr_slice_unref(encrypted_leftover);
+ grpc_slice_unref(encrypted_leftover);
gpr_free(encrypted_buffer);
}
@@ -125,8 +125,8 @@ secure_endpoint_create_fixture_tcp_socketpair_noleftover(size_t slice_size) {
static grpc_endpoint_test_fixture
secure_endpoint_create_fixture_tcp_socketpair_leftover(size_t slice_size) {
- gpr_slice s =
- gpr_slice_from_copied_string("hello world 12345678900987654321");
+ grpc_slice s =
+ grpc_slice_from_copied_string("hello world 12345678900987654321");
grpc_endpoint_test_fixture f;
f = secure_endpoint_create_fixture_tcp_socketpair(slice_size, &s, 1);
@@ -149,29 +149,29 @@ static void inc_call_ctr(grpc_exec_ctx *exec_ctx, void *arg,
static void test_leftover(grpc_endpoint_test_config config, size_t slice_size) {
grpc_endpoint_test_fixture f = config.create_fixture(slice_size);
- gpr_slice_buffer incoming;
- gpr_slice s =
- gpr_slice_from_copied_string("hello world 12345678900987654321");
+ grpc_slice_buffer incoming;
+ grpc_slice s =
+ grpc_slice_from_copied_string("hello world 12345678900987654321");
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
int n = 0;
grpc_closure done_closure;
gpr_log(GPR_INFO, "Start test left over");
- gpr_slice_buffer_init(&incoming);
+ grpc_slice_buffer_init(&incoming);
grpc_closure_init(&done_closure, inc_call_ctr, &n);
grpc_endpoint_read(&exec_ctx, f.client_ep, &incoming, &done_closure);
grpc_exec_ctx_finish(&exec_ctx);
GPR_ASSERT(n == 1);
GPR_ASSERT(incoming.count == 1);
- GPR_ASSERT(0 == gpr_slice_cmp(s, incoming.slices[0]));
+ GPR_ASSERT(0 == grpc_slice_cmp(s, incoming.slices[0]));
grpc_endpoint_shutdown(&exec_ctx, f.client_ep);
grpc_endpoint_shutdown(&exec_ctx, f.server_ep);
grpc_endpoint_destroy(&exec_ctx, f.client_ep);
grpc_endpoint_destroy(&exec_ctx, f.server_ep);
grpc_exec_ctx_finish(&exec_ctx);
- gpr_slice_unref(s);
- gpr_slice_buffer_destroy(&incoming);
+ grpc_slice_unref(s);
+ grpc_slice_buffer_destroy(&incoming);
clean_up();
}
diff --git a/test/core/security/security_connector_test.c b/test/core/security/security_connector_test.c
index 6106bec9d3..8872cbe278 100644
--- a/test/core/security/security_connector_test.c
+++ b/test/core/security/security_connector_test.c
@@ -42,6 +42,7 @@
#include "src/core/lib/security/context/security_context.h"
#include "src/core/lib/security/transport/security_connector.h"
+#include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/lib/support/env.h"
#include "src/core/lib/support/string.h"
#include "src/core/lib/support/tmpfile.h"
@@ -368,9 +369,9 @@ static void test_default_ssl_roots(void) {
value. */
gpr_setenv(GRPC_DEFAULT_SSL_ROOTS_FILE_PATH_ENV_VAR, "");
grpc_set_ssl_roots_override_callback(override_roots_success);
- gpr_slice roots = grpc_get_default_ssl_roots_for_testing();
- char *roots_contents = gpr_dump_slice(roots, GPR_DUMP_ASCII);
- gpr_slice_unref(roots);
+ grpc_slice roots = grpc_get_default_ssl_roots_for_testing();
+ char *roots_contents = grpc_dump_slice(roots, GPR_DUMP_ASCII);
+ grpc_slice_unref(roots);
GPR_ASSERT(strcmp(roots_contents, roots_for_override_api) == 0);
gpr_free(roots_contents);
@@ -378,8 +379,8 @@ static void test_default_ssl_roots(void) {
instead. */
gpr_setenv(GRPC_DEFAULT_SSL_ROOTS_FILE_PATH_ENV_VAR, roots_env_var_file_path);
roots = grpc_get_default_ssl_roots_for_testing();
- roots_contents = gpr_dump_slice(roots, GPR_DUMP_ASCII);
- gpr_slice_unref(roots);
+ roots_contents = grpc_dump_slice(roots, GPR_DUMP_ASCII);
+ grpc_slice_unref(roots);
GPR_ASSERT(strcmp(roots_contents, roots_for_env_var) == 0);
gpr_free(roots_contents);
@@ -387,8 +388,8 @@ static void test_default_ssl_roots(void) {
the api. */
gpr_setenv(GRPC_DEFAULT_SSL_ROOTS_FILE_PATH_ENV_VAR, "");
roots = grpc_get_default_ssl_roots_for_testing();
- roots_contents = gpr_dump_slice(roots, GPR_DUMP_ASCII);
- gpr_slice_unref(roots);
+ roots_contents = grpc_dump_slice(roots, GPR_DUMP_ASCII);
+ grpc_slice_unref(roots);
GPR_ASSERT(strcmp(roots_contents, roots_for_override_api) == 0);
gpr_free(roots_contents);
@@ -396,7 +397,7 @@ static void test_default_ssl_roots(void) {
an empty slice. */
grpc_set_ssl_roots_override_callback(override_roots_permanent_failure);
roots = grpc_get_default_ssl_roots_for_testing();
- GPR_ASSERT(GPR_SLICE_IS_EMPTY(roots));
+ GPR_ASSERT(GRPC_SLICE_IS_EMPTY(roots));
/* Cleanup. */
remove(roots_env_var_file_path);
diff --git a/test/core/security/verify_jwt.c b/test/core/security/verify_jwt.c
index 728d2d637a..043d29e6bb 100644
--- a/test/core/security/verify_jwt.c
+++ b/test/core/security/verify_jwt.c
@@ -36,10 +36,10 @@
#include <grpc/grpc.h>
#include <grpc/grpc_security.h>
+#include <grpc/slice.h>
#include <grpc/support/alloc.h>
#include <grpc/support/cmdline.h>
#include <grpc/support/log.h>
-#include <grpc/support/slice.h>
#include <grpc/support/sync.h>
#include "src/core/lib/security/credentials/jwt/jwt_verifier.h"
diff --git a/test/core/support/percent_decode_corpus/04cb8ccc553f9b2f5e52c421aff6d1c954d3dae6 b/test/core/slice/percent_decode_corpus/04cb8ccc553f9b2f5e52c421aff6d1c954d3dae6
index a0c7605580..a0c7605580 100644
--- a/test/core/support/percent_decode_corpus/04cb8ccc553f9b2f5e52c421aff6d1c954d3dae6
+++ b/test/core/slice/percent_decode_corpus/04cb8ccc553f9b2f5e52c421aff6d1c954d3dae6
diff --git a/test/core/support/percent_decode_corpus/0dd8f3a63745b3a2d39791559b5c1b311447b537 b/test/core/slice/percent_decode_corpus/0dd8f3a63745b3a2d39791559b5c1b311447b537
index 8b36124b3f..8b36124b3f 100644
--- a/test/core/support/percent_decode_corpus/0dd8f3a63745b3a2d39791559b5c1b311447b537
+++ b/test/core/slice/percent_decode_corpus/0dd8f3a63745b3a2d39791559b5c1b311447b537
diff --git a/test/core/support/percent_decode_corpus/17eeaca784409adbe43365c32ac87915d736bba3 b/test/core/slice/percent_decode_corpus/17eeaca784409adbe43365c32ac87915d736bba3
index ea02afac49..ea02afac49 100644
--- a/test/core/support/percent_decode_corpus/17eeaca784409adbe43365c32ac87915d736bba3
+++ b/test/core/slice/percent_decode_corpus/17eeaca784409adbe43365c32ac87915d736bba3
diff --git a/test/core/support/percent_decode_corpus/2040c1ff65f52a7ae668c2c8f324de5dacc9d695 b/test/core/slice/percent_decode_corpus/2040c1ff65f52a7ae668c2c8f324de5dacc9d695
index 9e9b466b2f..9e9b466b2f 100644
--- a/test/core/support/percent_decode_corpus/2040c1ff65f52a7ae668c2c8f324de5dacc9d695
+++ b/test/core/slice/percent_decode_corpus/2040c1ff65f52a7ae668c2c8f324de5dacc9d695
diff --git a/test/core/support/percent_decode_corpus/26b0d1da23027ae54db96e125e4a9e98842d77fb b/test/core/slice/percent_decode_corpus/26b0d1da23027ae54db96e125e4a9e98842d77fb
index 88c739ecaa..88c739ecaa 100644
--- a/test/core/support/percent_decode_corpus/26b0d1da23027ae54db96e125e4a9e98842d77fb
+++ b/test/core/slice/percent_decode_corpus/26b0d1da23027ae54db96e125e4a9e98842d77fb
diff --git a/test/core/support/percent_decode_corpus/2a089c0db45acdb4c6ed8e7ff81ca7235792c0b9 b/test/core/slice/percent_decode_corpus/2a089c0db45acdb4c6ed8e7ff81ca7235792c0b9
index 5e6f546ff5..5e6f546ff5 100644
--- a/test/core/support/percent_decode_corpus/2a089c0db45acdb4c6ed8e7ff81ca7235792c0b9
+++ b/test/core/slice/percent_decode_corpus/2a089c0db45acdb4c6ed8e7ff81ca7235792c0b9
diff --git a/test/core/support/percent_decode_corpus/35b7b3bc3a740d5c3abca0d75b53f0e1e1ee998a b/test/core/slice/percent_decode_corpus/35b7b3bc3a740d5c3abca0d75b53f0e1e1ee998a
index 71d688b694..71d688b694 100644
--- a/test/core/support/percent_decode_corpus/35b7b3bc3a740d5c3abca0d75b53f0e1e1ee998a
+++ b/test/core/slice/percent_decode_corpus/35b7b3bc3a740d5c3abca0d75b53f0e1e1ee998a
diff --git a/test/core/support/percent_decode_corpus/36367ba1adba47a1cbc3a88707fde8cc7abdc248 b/test/core/slice/percent_decode_corpus/36367ba1adba47a1cbc3a88707fde8cc7abdc248
index 5a89a07ba7..5a89a07ba7 100644
--- a/test/core/support/percent_decode_corpus/36367ba1adba47a1cbc3a88707fde8cc7abdc248
+++ b/test/core/slice/percent_decode_corpus/36367ba1adba47a1cbc3a88707fde8cc7abdc248
diff --git a/test/core/support/percent_decode_corpus/39c2ba51548a0beaf0d6d1164531f1447dc311b5 b/test/core/slice/percent_decode_corpus/39c2ba51548a0beaf0d6d1164531f1447dc311b5
index cfa2be994f..cfa2be994f 100644
--- a/test/core/support/percent_decode_corpus/39c2ba51548a0beaf0d6d1164531f1447dc311b5
+++ b/test/core/slice/percent_decode_corpus/39c2ba51548a0beaf0d6d1164531f1447dc311b5
diff --git a/test/core/support/percent_decode_corpus/56d08fea787c041395c6697ce26cfbc0decbe688 b/test/core/slice/percent_decode_corpus/56d08fea787c041395c6697ce26cfbc0decbe688
index c1ddf65acd..c1ddf65acd 100644
--- a/test/core/support/percent_decode_corpus/56d08fea787c041395c6697ce26cfbc0decbe688
+++ b/test/core/slice/percent_decode_corpus/56d08fea787c041395c6697ce26cfbc0decbe688
diff --git a/test/core/support/percent_decode_corpus/678d981fdabb9f0d6640235cf1719dd1e1e66ae9 b/test/core/slice/percent_decode_corpus/678d981fdabb9f0d6640235cf1719dd1e1e66ae9
index dc427d1e12..dc427d1e12 100644
--- a/test/core/support/percent_decode_corpus/678d981fdabb9f0d6640235cf1719dd1e1e66ae9
+++ b/test/core/slice/percent_decode_corpus/678d981fdabb9f0d6640235cf1719dd1e1e66ae9
diff --git a/test/core/support/percent_decode_corpus/68751961609ec010565de0aa87521dcbf0722c5d b/test/core/slice/percent_decode_corpus/68751961609ec010565de0aa87521dcbf0722c5d
index 154449d0ef..154449d0ef 100644
--- a/test/core/support/percent_decode_corpus/68751961609ec010565de0aa87521dcbf0722c5d
+++ b/test/core/slice/percent_decode_corpus/68751961609ec010565de0aa87521dcbf0722c5d
diff --git a/test/core/support/percent_decode_corpus/7875c06c6f03c9aa2f8e9c59f8d8957c8a32e759 b/test/core/slice/percent_decode_corpus/7875c06c6f03c9aa2f8e9c59f8d8957c8a32e759
index 841ced83c3..841ced83c3 100644
--- a/test/core/support/percent_decode_corpus/7875c06c6f03c9aa2f8e9c59f8d8957c8a32e759
+++ b/test/core/slice/percent_decode_corpus/7875c06c6f03c9aa2f8e9c59f8d8957c8a32e759
diff --git a/test/core/support/percent_decode_corpus/7b302090e090a5829b6d1dd7be30bd4e36a7e60f b/test/core/slice/percent_decode_corpus/7b302090e090a5829b6d1dd7be30bd4e36a7e60f
index 6790bc2798..6790bc2798 100644
--- a/test/core/support/percent_decode_corpus/7b302090e090a5829b6d1dd7be30bd4e36a7e60f
+++ b/test/core/slice/percent_decode_corpus/7b302090e090a5829b6d1dd7be30bd4e36a7e60f
diff --git a/test/core/support/percent_decode_corpus/875e1022169c9e4c541a9ad894e69e989df22ba1 b/test/core/slice/percent_decode_corpus/875e1022169c9e4c541a9ad894e69e989df22ba1
index 1625d0a1ae..1625d0a1ae 100644
--- a/test/core/support/percent_decode_corpus/875e1022169c9e4c541a9ad894e69e989df22ba1
+++ b/test/core/slice/percent_decode_corpus/875e1022169c9e4c541a9ad894e69e989df22ba1
diff --git a/test/core/support/percent_decode_corpus/8c1051ce066f5a26de9a9d133180621d0da957b4 b/test/core/slice/percent_decode_corpus/8c1051ce066f5a26de9a9d133180621d0da957b4
index 125c330b3e..125c330b3e 100644
--- a/test/core/support/percent_decode_corpus/8c1051ce066f5a26de9a9d133180621d0da957b4
+++ b/test/core/slice/percent_decode_corpus/8c1051ce066f5a26de9a9d133180621d0da957b4
diff --git a/test/core/support/percent_decode_corpus/8e084e628ab83a18ac7ca7cb3506525263655c63 b/test/core/slice/percent_decode_corpus/8e084e628ab83a18ac7ca7cb3506525263655c63
index 6e6f08cb07..6e6f08cb07 100644
--- a/test/core/support/percent_decode_corpus/8e084e628ab83a18ac7ca7cb3506525263655c63
+++ b/test/core/slice/percent_decode_corpus/8e084e628ab83a18ac7ca7cb3506525263655c63
diff --git a/test/core/support/percent_decode_corpus/9d316c4675f40ddccaf8f1cc7aea94170b1e4223 b/test/core/slice/percent_decode_corpus/9d316c4675f40ddccaf8f1cc7aea94170b1e4223
index ab4a1c7657..ab4a1c7657 100644
--- a/test/core/support/percent_decode_corpus/9d316c4675f40ddccaf8f1cc7aea94170b1e4223
+++ b/test/core/slice/percent_decode_corpus/9d316c4675f40ddccaf8f1cc7aea94170b1e4223
diff --git a/test/core/support/percent_decode_corpus/ad1c7c11d18a7d116e2c2ef4d4c5afb1270836ae b/test/core/slice/percent_decode_corpus/ad1c7c11d18a7d116e2c2ef4d4c5afb1270836ae
index 4ac1945a84..4ac1945a84 100644
--- a/test/core/support/percent_decode_corpus/ad1c7c11d18a7d116e2c2ef4d4c5afb1270836ae
+++ b/test/core/slice/percent_decode_corpus/ad1c7c11d18a7d116e2c2ef4d4c5afb1270836ae
diff --git a/test/core/support/percent_decode_corpus/b471f94aa4facf502e622e4a248f1ba4063ae681 b/test/core/slice/percent_decode_corpus/b471f94aa4facf502e622e4a248f1ba4063ae681
index 5c673ae28a..5c673ae28a 100644
--- a/test/core/support/percent_decode_corpus/b471f94aa4facf502e622e4a248f1ba4063ae681
+++ b/test/core/slice/percent_decode_corpus/b471f94aa4facf502e622e4a248f1ba4063ae681
diff --git a/test/core/support/percent_decode_corpus/bf52ece030f16136d46e0dc97f58d60a0d8a1f0b b/test/core/slice/percent_decode_corpus/bf52ece030f16136d46e0dc97f58d60a0d8a1f0b
index e478275ed4..e478275ed4 100644
--- a/test/core/support/percent_decode_corpus/bf52ece030f16136d46e0dc97f58d60a0d8a1f0b
+++ b/test/core/slice/percent_decode_corpus/bf52ece030f16136d46e0dc97f58d60a0d8a1f0b
diff --git a/test/core/support/percent_decode_corpus/d5b2a7177339ba2b7ce2f60e5f4459bef1e72758 b/test/core/slice/percent_decode_corpus/d5b2a7177339ba2b7ce2f60e5f4459bef1e72758
index c73cbfe8af..c73cbfe8af 100644
--- a/test/core/support/percent_decode_corpus/d5b2a7177339ba2b7ce2f60e5f4459bef1e72758
+++ b/test/core/slice/percent_decode_corpus/d5b2a7177339ba2b7ce2f60e5f4459bef1e72758
diff --git a/test/core/support/percent_decode_corpus/de867b64c54a7ed773dc611fc5cd2f17c5433113 b/test/core/slice/percent_decode_corpus/de867b64c54a7ed773dc611fc5cd2f17c5433113
index f9f7246e9c..f9f7246e9c 100644
--- a/test/core/support/percent_decode_corpus/de867b64c54a7ed773dc611fc5cd2f17c5433113
+++ b/test/core/slice/percent_decode_corpus/de867b64c54a7ed773dc611fc5cd2f17c5433113
diff --git a/test/core/support/percent_decode_corpus/e3948dbe004950591630dd5c52f4e0fcbd5e388a b/test/core/slice/percent_decode_corpus/e3948dbe004950591630dd5c52f4e0fcbd5e388a
index 83ac46d833..83ac46d833 100644
--- a/test/core/support/percent_decode_corpus/e3948dbe004950591630dd5c52f4e0fcbd5e388a
+++ b/test/core/slice/percent_decode_corpus/e3948dbe004950591630dd5c52f4e0fcbd5e388a
diff --git a/test/core/support/percent_decode_corpus/e7064f0b80f61dbc65915311032d27baa569ae2a b/test/core/slice/percent_decode_corpus/e7064f0b80f61dbc65915311032d27baa569ae2a
index e8a0f87653..e8a0f87653 100644
--- a/test/core/support/percent_decode_corpus/e7064f0b80f61dbc65915311032d27baa569ae2a
+++ b/test/core/slice/percent_decode_corpus/e7064f0b80f61dbc65915311032d27baa569ae2a
diff --git a/test/core/support/percent_decode_corpus/xyz b/test/core/slice/percent_decode_corpus/xyz
index cd470e6190..cd470e6190 100644
--- a/test/core/support/percent_decode_corpus/xyz
+++ b/test/core/slice/percent_decode_corpus/xyz
diff --git a/test/core/support/percent_decode_fuzzer.c b/test/core/slice/percent_decode_fuzzer.c
index 3e02980e05..5e90446f30 100644
--- a/test/core/support/percent_decode_fuzzer.c
+++ b/test/core/slice/percent_decode_fuzzer.c
@@ -38,7 +38,7 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include "src/core/lib/support/percent_encoding.h"
+#include "src/core/lib/slice/percent_encoding.h"
#include "test/core/util/memory_counters.h"
bool squelch = true;
@@ -47,18 +47,18 @@ bool leak_check = true;
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
struct grpc_memory_counters counters;
grpc_memory_counters_init();
- gpr_slice input = gpr_slice_from_copied_buffer((const char *)data, size);
- gpr_slice output;
- if (gpr_strict_percent_decode_slice(
- input, gpr_url_percent_encoding_unreserved_bytes, &output)) {
- gpr_slice_unref(output);
+ grpc_slice input = grpc_slice_from_copied_buffer((const char *)data, size);
+ grpc_slice output;
+ if (grpc_strict_percent_decode_slice(
+ input, grpc_url_percent_encoding_unreserved_bytes, &output)) {
+ grpc_slice_unref(output);
}
- if (gpr_strict_percent_decode_slice(
- input, gpr_compatible_percent_encoding_unreserved_bytes, &output)) {
- gpr_slice_unref(output);
+ if (grpc_strict_percent_decode_slice(
+ input, grpc_compatible_percent_encoding_unreserved_bytes, &output)) {
+ grpc_slice_unref(output);
}
- gpr_slice_unref(gpr_permissive_percent_decode_slice(input));
- gpr_slice_unref(input);
+ grpc_slice_unref(grpc_permissive_percent_decode_slice(input));
+ grpc_slice_unref(input);
counters = grpc_memory_counters_snapshot();
grpc_memory_counters_destroy();
GPR_ASSERT(counters.total_size_relative == 0);
diff --git a/test/core/support/percent_encode_corpus/0d3ee7fa54e6c66103965fd4409b044ba7db6c3f b/test/core/slice/percent_encode_corpus/0d3ee7fa54e6c66103965fd4409b044ba7db6c3f
index d09c4a039c..d09c4a039c 100644
--- a/test/core/support/percent_encode_corpus/0d3ee7fa54e6c66103965fd4409b044ba7db6c3f
+++ b/test/core/slice/percent_encode_corpus/0d3ee7fa54e6c66103965fd4409b044ba7db6c3f
diff --git a/test/core/support/percent_encode_corpus/2e7ccf75e27b9501e3b28cf1c50ed0c45ab7c226 b/test/core/slice/percent_encode_corpus/2e7ccf75e27b9501e3b28cf1c50ed0c45ab7c226
index 4d0c38d0e2..4d0c38d0e2 100644
--- a/test/core/support/percent_encode_corpus/2e7ccf75e27b9501e3b28cf1c50ed0c45ab7c226
+++ b/test/core/slice/percent_encode_corpus/2e7ccf75e27b9501e3b28cf1c50ed0c45ab7c226
diff --git a/test/core/support/percent_encode_corpus/55bb859f3942c462b03b7cbcf22ab4a0ac9705cf b/test/core/slice/percent_encode_corpus/55bb859f3942c462b03b7cbcf22ab4a0ac9705cf
index fc6e93342a..fc6e93342a 100644
--- a/test/core/support/percent_encode_corpus/55bb859f3942c462b03b7cbcf22ab4a0ac9705cf
+++ b/test/core/slice/percent_encode_corpus/55bb859f3942c462b03b7cbcf22ab4a0ac9705cf
diff --git a/test/core/support/percent_encode_corpus/56070cecd54c845b6d4334953b17b712eb000d93 b/test/core/slice/percent_encode_corpus/56070cecd54c845b6d4334953b17b712eb000d93
index 6823c73f76..6823c73f76 100644
--- a/test/core/support/percent_encode_corpus/56070cecd54c845b6d4334953b17b712eb000d93
+++ b/test/core/slice/percent_encode_corpus/56070cecd54c845b6d4334953b17b712eb000d93
diff --git a/test/core/support/percent_encode_corpus/61f50e891bf7ff5eb7a7af206f1e25d77f8756e7 b/test/core/slice/percent_encode_corpus/61f50e891bf7ff5eb7a7af206f1e25d77f8756e7
index a65cbb4d5b..a65cbb4d5b 100644
--- a/test/core/support/percent_encode_corpus/61f50e891bf7ff5eb7a7af206f1e25d77f8756e7
+++ b/test/core/slice/percent_encode_corpus/61f50e891bf7ff5eb7a7af206f1e25d77f8756e7
diff --git a/test/core/support/percent_encode_corpus/6e0c60cefc704c7940e475a87dd9ae423061cb5a b/test/core/slice/percent_encode_corpus/6e0c60cefc704c7940e475a87dd9ae423061cb5a
index 8d031d7e2d..8d031d7e2d 100644
--- a/test/core/support/percent_encode_corpus/6e0c60cefc704c7940e475a87dd9ae423061cb5a
+++ b/test/core/slice/percent_encode_corpus/6e0c60cefc704c7940e475a87dd9ae423061cb5a
diff --git a/test/core/support/percent_encode_corpus/7271ebcc6d22a0f186f7bc3c1973a7ed1bec8d8e b/test/core/slice/percent_encode_corpus/7271ebcc6d22a0f186f7bc3c1973a7ed1bec8d8e
index 4d82ca3953..4d82ca3953 100644
--- a/test/core/support/percent_encode_corpus/7271ebcc6d22a0f186f7bc3c1973a7ed1bec8d8e
+++ b/test/core/slice/percent_encode_corpus/7271ebcc6d22a0f186f7bc3c1973a7ed1bec8d8e
diff --git a/test/core/support/percent_encode_corpus/74c83ece3e2920a67593a9be9c82468f16cbb969 b/test/core/slice/percent_encode_corpus/74c83ece3e2920a67593a9be9c82468f16cbb969
index bb7f4ae07e..bb7f4ae07e 100644
--- a/test/core/support/percent_encode_corpus/74c83ece3e2920a67593a9be9c82468f16cbb969
+++ b/test/core/slice/percent_encode_corpus/74c83ece3e2920a67593a9be9c82468f16cbb969
diff --git a/test/core/support/percent_encode_corpus/98e004fd2a9f141a7a019720820080e12d637c06 b/test/core/slice/percent_encode_corpus/98e004fd2a9f141a7a019720820080e12d637c06
index 50879d0f37..50879d0f37 100644
--- a/test/core/support/percent_encode_corpus/98e004fd2a9f141a7a019720820080e12d637c06
+++ b/test/core/slice/percent_encode_corpus/98e004fd2a9f141a7a019720820080e12d637c06
diff --git a/test/core/support/percent_encode_corpus/ba2c1e98227aa21ea3bb2ca4d0e504119717da8b b/test/core/slice/percent_encode_corpus/ba2c1e98227aa21ea3bb2ca4d0e504119717da8b
index dc1ab9bfc2..dc1ab9bfc2 100644
--- a/test/core/support/percent_encode_corpus/ba2c1e98227aa21ea3bb2ca4d0e504119717da8b
+++ b/test/core/slice/percent_encode_corpus/ba2c1e98227aa21ea3bb2ca4d0e504119717da8b
diff --git a/test/core/support/percent_encode_corpus/c16b9fd45370d4afb5d3ebd307a6e263c25ffd45 b/test/core/slice/percent_encode_corpus/c16b9fd45370d4afb5d3ebd307a6e263c25ffd45
index 3476e0b70b..3476e0b70b 100644
--- a/test/core/support/percent_encode_corpus/c16b9fd45370d4afb5d3ebd307a6e263c25ffd45
+++ b/test/core/slice/percent_encode_corpus/c16b9fd45370d4afb5d3ebd307a6e263c25ffd45
diff --git a/test/core/support/percent_encode_corpus/d58c3cd4eab9b6d2343abfa1c25c90a383fe0ec3 b/test/core/slice/percent_encode_corpus/d58c3cd4eab9b6d2343abfa1c25c90a383fe0ec3
index 822d50abf8..822d50abf8 100644
--- a/test/core/support/percent_encode_corpus/d58c3cd4eab9b6d2343abfa1c25c90a383fe0ec3
+++ b/test/core/slice/percent_encode_corpus/d58c3cd4eab9b6d2343abfa1c25c90a383fe0ec3
diff --git a/test/core/support/percent_encode_corpus/e2619218ede30d2b7b8ecd601a9f0ae754b728b4 b/test/core/slice/percent_encode_corpus/e2619218ede30d2b7b8ecd601a9f0ae754b728b4
index 101639c93d..101639c93d 100644
--- a/test/core/support/percent_encode_corpus/e2619218ede30d2b7b8ecd601a9f0ae754b728b4
+++ b/test/core/slice/percent_encode_corpus/e2619218ede30d2b7b8ecd601a9f0ae754b728b4
diff --git a/test/core/support/percent_encode_corpus/f93b3653e453f0e3eea3198001be6ce46e64bd21 b/test/core/slice/percent_encode_corpus/f93b3653e453f0e3eea3198001be6ce46e64bd21
index 6e07ab342f..6e07ab342f 100644
--- a/test/core/support/percent_encode_corpus/f93b3653e453f0e3eea3198001be6ce46e64bd21
+++ b/test/core/slice/percent_encode_corpus/f93b3653e453f0e3eea3198001be6ce46e64bd21
diff --git a/test/core/support/percent_encode_corpus/fd41d029c7682ad3d1c40a9fd017a4c85b673a54 b/test/core/slice/percent_encode_corpus/fd41d029c7682ad3d1c40a9fd017a4c85b673a54
index 13d7fab596..13d7fab596 100644
--- a/test/core/support/percent_encode_corpus/fd41d029c7682ad3d1c40a9fd017a4c85b673a54
+++ b/test/core/slice/percent_encode_corpus/fd41d029c7682ad3d1c40a9fd017a4c85b673a54
diff --git a/test/core/support/percent_encode_corpus/xyz b/test/core/slice/percent_encode_corpus/xyz
index cd470e6190..cd470e6190 100644
--- a/test/core/support/percent_encode_corpus/xyz
+++ b/test/core/slice/percent_encode_corpus/xyz
diff --git a/test/core/support/percent_encode_fuzzer.c b/test/core/slice/percent_encode_fuzzer.c
index c9548232b5..9698e796b4 100644
--- a/test/core/support/percent_encode_fuzzer.c
+++ b/test/core/slice/percent_encode_fuzzer.c
@@ -38,7 +38,7 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include "src/core/lib/support/percent_encoding.h"
+#include "src/core/lib/slice/percent_encoding.h"
#include "test/core/util/memory_counters.h"
bool squelch = true;
@@ -47,27 +47,27 @@ bool leak_check = true;
static void test(const uint8_t *data, size_t size, const uint8_t *dict) {
struct grpc_memory_counters counters;
grpc_memory_counters_init();
- gpr_slice input = gpr_slice_from_copied_buffer((const char *)data, size);
- gpr_slice output = gpr_percent_encode_slice(input, dict);
- gpr_slice decoded_output;
+ grpc_slice input = grpc_slice_from_copied_buffer((const char *)data, size);
+ grpc_slice output = grpc_percent_encode_slice(input, dict);
+ grpc_slice decoded_output;
// encoder must always produce decodable output
- GPR_ASSERT(gpr_strict_percent_decode_slice(output, dict, &decoded_output));
- gpr_slice permissive_decoded_output =
- gpr_permissive_percent_decode_slice(output);
+ GPR_ASSERT(grpc_strict_percent_decode_slice(output, dict, &decoded_output));
+ grpc_slice permissive_decoded_output =
+ grpc_permissive_percent_decode_slice(output);
// and decoded output must always match the input
- GPR_ASSERT(gpr_slice_cmp(input, decoded_output) == 0);
- GPR_ASSERT(gpr_slice_cmp(input, permissive_decoded_output) == 0);
- gpr_slice_unref(input);
- gpr_slice_unref(output);
- gpr_slice_unref(decoded_output);
- gpr_slice_unref(permissive_decoded_output);
+ GPR_ASSERT(grpc_slice_cmp(input, decoded_output) == 0);
+ GPR_ASSERT(grpc_slice_cmp(input, permissive_decoded_output) == 0);
+ grpc_slice_unref(input);
+ grpc_slice_unref(output);
+ grpc_slice_unref(decoded_output);
+ grpc_slice_unref(permissive_decoded_output);
counters = grpc_memory_counters_snapshot();
grpc_memory_counters_destroy();
GPR_ASSERT(counters.total_size_relative == 0);
}
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
- test(data, size, gpr_url_percent_encoding_unreserved_bytes);
- test(data, size, gpr_compatible_percent_encoding_unreserved_bytes);
+ test(data, size, grpc_url_percent_encoding_unreserved_bytes);
+ test(data, size, grpc_compatible_percent_encoding_unreserved_bytes);
return 0;
}
diff --git a/test/core/support/percent_encoding_test.c b/test/core/slice/percent_encoding_test.c
index ab5f3f2d14..d71c99f54c 100644
--- a/test/core/support/percent_encoding_test.c
+++ b/test/core/slice/percent_encoding_test.c
@@ -31,11 +31,12 @@
*
*/
-#include "src/core/lib/support/percent_encoding.h"
+#include "src/core/lib/slice/percent_encoding.h"
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
+#include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/lib/support/string.h"
#include "test/core/util/test_config.h"
@@ -56,21 +57,21 @@ static void test_vector(const char *raw, size_t raw_length, const char *encoded,
gpr_free(raw_msg);
gpr_free(encoded_msg);
- gpr_slice raw_slice = gpr_slice_from_copied_buffer(raw, raw_length);
- gpr_slice encoded_slice =
- gpr_slice_from_copied_buffer(encoded, encoded_length);
- gpr_slice raw2encoded_slice = gpr_percent_encode_slice(raw_slice, dict);
- gpr_slice encoded2raw_slice;
- GPR_ASSERT(
- gpr_strict_percent_decode_slice(encoded_slice, dict, &encoded2raw_slice));
- gpr_slice encoded2raw_permissive_slice =
- gpr_permissive_percent_decode_slice(encoded_slice);
+ grpc_slice raw_slice = grpc_slice_from_copied_buffer(raw, raw_length);
+ grpc_slice encoded_slice =
+ grpc_slice_from_copied_buffer(encoded, encoded_length);
+ grpc_slice raw2encoded_slice = grpc_percent_encode_slice(raw_slice, dict);
+ grpc_slice encoded2raw_slice;
+ GPR_ASSERT(grpc_strict_percent_decode_slice(encoded_slice, dict,
+ &encoded2raw_slice));
+ grpc_slice encoded2raw_permissive_slice =
+ grpc_permissive_percent_decode_slice(encoded_slice);
char *raw2encoded_msg =
- gpr_dump_slice(raw2encoded_slice, GPR_DUMP_HEX | GPR_DUMP_ASCII);
+ grpc_dump_slice(raw2encoded_slice, GPR_DUMP_HEX | GPR_DUMP_ASCII);
char *encoded2raw_msg =
- gpr_dump_slice(encoded2raw_slice, GPR_DUMP_HEX | GPR_DUMP_ASCII);
- char *encoded2raw_permissive_msg = gpr_dump_slice(
+ grpc_dump_slice(encoded2raw_slice, GPR_DUMP_HEX | GPR_DUMP_ASCII);
+ char *encoded2raw_permissive_msg = grpc_dump_slice(
encoded2raw_permissive_slice, GPR_DUMP_HEX | GPR_DUMP_ASCII);
gpr_log(GPR_DEBUG,
"Result:\nraw2encoded = %s\nencoded2raw = %s\nencoded2raw_permissive "
@@ -80,15 +81,15 @@ static void test_vector(const char *raw, size_t raw_length, const char *encoded,
gpr_free(encoded2raw_msg);
gpr_free(encoded2raw_permissive_msg);
- GPR_ASSERT(0 == gpr_slice_cmp(raw_slice, encoded2raw_slice));
- GPR_ASSERT(0 == gpr_slice_cmp(raw_slice, encoded2raw_permissive_slice));
- GPR_ASSERT(0 == gpr_slice_cmp(encoded_slice, raw2encoded_slice));
+ GPR_ASSERT(0 == grpc_slice_cmp(raw_slice, encoded2raw_slice));
+ GPR_ASSERT(0 == grpc_slice_cmp(raw_slice, encoded2raw_permissive_slice));
+ GPR_ASSERT(0 == grpc_slice_cmp(encoded_slice, raw2encoded_slice));
- gpr_slice_unref(encoded2raw_slice);
- gpr_slice_unref(encoded2raw_permissive_slice);
- gpr_slice_unref(raw2encoded_slice);
- gpr_slice_unref(raw_slice);
- gpr_slice_unref(encoded_slice);
+ grpc_slice_unref(encoded2raw_slice);
+ grpc_slice_unref(encoded2raw_permissive_slice);
+ grpc_slice_unref(raw2encoded_slice);
+ grpc_slice_unref(raw_slice);
+ grpc_slice_unref(encoded_slice);
}
static void test_nonconformant_vector(const char *encoded,
@@ -106,28 +107,28 @@ static void test_nonconformant_vector(const char *encoded,
gpr_free(permissive_unencoded_msg);
gpr_free(encoded_msg);
- gpr_slice permissive_unencoded_slice = gpr_slice_from_copied_buffer(
+ grpc_slice permissive_unencoded_slice = grpc_slice_from_copied_buffer(
permissive_unencoded, permissive_unencoded_length);
- gpr_slice encoded_slice =
- gpr_slice_from_copied_buffer(encoded, encoded_length);
- gpr_slice encoded2raw_slice;
- GPR_ASSERT(!gpr_strict_percent_decode_slice(encoded_slice, dict,
- &encoded2raw_slice));
- gpr_slice encoded2raw_permissive_slice =
- gpr_permissive_percent_decode_slice(encoded_slice);
-
- char *encoded2raw_permissive_msg = gpr_dump_slice(
+ grpc_slice encoded_slice =
+ grpc_slice_from_copied_buffer(encoded, encoded_length);
+ grpc_slice encoded2raw_slice;
+ GPR_ASSERT(!grpc_strict_percent_decode_slice(encoded_slice, dict,
+ &encoded2raw_slice));
+ grpc_slice encoded2raw_permissive_slice =
+ grpc_permissive_percent_decode_slice(encoded_slice);
+
+ char *encoded2raw_permissive_msg = grpc_dump_slice(
encoded2raw_permissive_slice, GPR_DUMP_HEX | GPR_DUMP_ASCII);
gpr_log(GPR_DEBUG, "Result:\nencoded2raw_permissive = %s",
encoded2raw_permissive_msg);
gpr_free(encoded2raw_permissive_msg);
- GPR_ASSERT(0 == gpr_slice_cmp(permissive_unencoded_slice,
- encoded2raw_permissive_slice));
+ GPR_ASSERT(0 == grpc_slice_cmp(permissive_unencoded_slice,
+ encoded2raw_permissive_slice));
- gpr_slice_unref(permissive_unencoded_slice);
- gpr_slice_unref(encoded2raw_permissive_slice);
- gpr_slice_unref(encoded_slice);
+ grpc_slice_unref(permissive_unencoded_slice);
+ grpc_slice_unref(encoded2raw_permissive_slice);
+ grpc_slice_unref(encoded_slice);
}
int main(int argc, char **argv) {
@@ -135,23 +136,23 @@ int main(int argc, char **argv) {
TEST_VECTOR(
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.~",
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_.~",
- gpr_url_percent_encoding_unreserved_bytes);
- TEST_VECTOR("\x00", "%00", gpr_url_percent_encoding_unreserved_bytes);
- TEST_VECTOR("\x01", "%01", gpr_url_percent_encoding_unreserved_bytes);
- TEST_VECTOR("a b", "a%20b", gpr_url_percent_encoding_unreserved_bytes);
- TEST_VECTOR(" b", "%20b", gpr_url_percent_encoding_unreserved_bytes);
- TEST_VECTOR("a b", "a b", gpr_compatible_percent_encoding_unreserved_bytes);
- TEST_VECTOR(" b", " b", gpr_compatible_percent_encoding_unreserved_bytes);
- TEST_VECTOR("\x0f", "%0F", gpr_url_percent_encoding_unreserved_bytes);
- TEST_VECTOR("\xff", "%FF", gpr_url_percent_encoding_unreserved_bytes);
- TEST_VECTOR("\xee", "%EE", gpr_url_percent_encoding_unreserved_bytes);
+ grpc_url_percent_encoding_unreserved_bytes);
+ TEST_VECTOR("\x00", "%00", grpc_url_percent_encoding_unreserved_bytes);
+ TEST_VECTOR("\x01", "%01", grpc_url_percent_encoding_unreserved_bytes);
+ TEST_VECTOR("a b", "a%20b", grpc_url_percent_encoding_unreserved_bytes);
+ TEST_VECTOR(" b", "%20b", grpc_url_percent_encoding_unreserved_bytes);
+ TEST_VECTOR("a b", "a b", grpc_compatible_percent_encoding_unreserved_bytes);
+ TEST_VECTOR(" b", " b", grpc_compatible_percent_encoding_unreserved_bytes);
+ TEST_VECTOR("\x0f", "%0F", grpc_url_percent_encoding_unreserved_bytes);
+ TEST_VECTOR("\xff", "%FF", grpc_url_percent_encoding_unreserved_bytes);
+ TEST_VECTOR("\xee", "%EE", grpc_url_percent_encoding_unreserved_bytes);
TEST_NONCONFORMANT_VECTOR("%", "%",
- gpr_url_percent_encoding_unreserved_bytes);
+ grpc_url_percent_encoding_unreserved_bytes);
TEST_NONCONFORMANT_VECTOR("%A", "%A",
- gpr_url_percent_encoding_unreserved_bytes);
+ grpc_url_percent_encoding_unreserved_bytes);
TEST_NONCONFORMANT_VECTOR("%AG", "%AG",
- gpr_url_percent_encoding_unreserved_bytes);
+ grpc_url_percent_encoding_unreserved_bytes);
TEST_NONCONFORMANT_VECTOR("\0", "\0",
- gpr_url_percent_encoding_unreserved_bytes);
+ grpc_url_percent_encoding_unreserved_bytes);
return 0;
}
diff --git a/test/core/support/slice_buffer_test.c b/test/core/slice/slice_buffer_test.c
index cf2da84c2b..bf9ae197d2 100644
--- a/test/core/support/slice_buffer_test.c
+++ b/test/core/slice/slice_buffer_test.c
@@ -31,72 +31,72 @@
*
*/
+#include <grpc/slice_buffer.h>
#include <grpc/support/log.h>
-#include <grpc/support/slice_buffer.h>
#include "test/core/util/test_config.h"
void test_slice_buffer_add() {
- gpr_slice_buffer buf;
- gpr_slice aaa = gpr_slice_from_copied_string("aaa");
- gpr_slice bb = gpr_slice_from_copied_string("bb");
+ grpc_slice_buffer buf;
+ grpc_slice aaa = grpc_slice_from_copied_string("aaa");
+ grpc_slice bb = grpc_slice_from_copied_string("bb");
size_t i;
- gpr_slice_buffer_init(&buf);
+ grpc_slice_buffer_init(&buf);
for (i = 0; i < 10; i++) {
- gpr_slice_ref(aaa);
- gpr_slice_ref(bb);
- gpr_slice_buffer_add(&buf, aaa);
- gpr_slice_buffer_add(&buf, bb);
+ grpc_slice_ref(aaa);
+ grpc_slice_ref(bb);
+ grpc_slice_buffer_add(&buf, aaa);
+ grpc_slice_buffer_add(&buf, bb);
}
GPR_ASSERT(buf.count > 0);
GPR_ASSERT(buf.length == 50);
- gpr_slice_buffer_reset_and_unref(&buf);
+ grpc_slice_buffer_reset_and_unref(&buf);
GPR_ASSERT(buf.count == 0);
GPR_ASSERT(buf.length == 0);
for (i = 0; i < 10; i++) {
- gpr_slice_ref(aaa);
- gpr_slice_ref(bb);
- gpr_slice_buffer_add(&buf, aaa);
- gpr_slice_buffer_add(&buf, bb);
+ grpc_slice_ref(aaa);
+ grpc_slice_ref(bb);
+ grpc_slice_buffer_add(&buf, aaa);
+ grpc_slice_buffer_add(&buf, bb);
}
GPR_ASSERT(buf.count > 0);
GPR_ASSERT(buf.length == 50);
for (i = 0; i < 10; i++) {
- gpr_slice_buffer_pop(&buf);
- gpr_slice_unref(aaa);
- gpr_slice_unref(bb);
+ grpc_slice_buffer_pop(&buf);
+ grpc_slice_unref(aaa);
+ grpc_slice_unref(bb);
}
GPR_ASSERT(buf.count == 0);
GPR_ASSERT(buf.length == 0);
- gpr_slice_buffer_destroy(&buf);
+ grpc_slice_buffer_destroy(&buf);
}
void test_slice_buffer_move_first() {
- gpr_slice slices[3];
- gpr_slice_buffer src;
- gpr_slice_buffer dst;
+ grpc_slice slices[3];
+ grpc_slice_buffer src;
+ grpc_slice_buffer dst;
int idx = 0;
size_t src_len = 0;
size_t dst_len = 0;
- slices[0] = gpr_slice_from_copied_string("aaa");
- slices[1] = gpr_slice_from_copied_string("bbbb");
- slices[2] = gpr_slice_from_copied_string("ccc");
+ slices[0] = grpc_slice_from_copied_string("aaa");
+ slices[1] = grpc_slice_from_copied_string("bbbb");
+ slices[2] = grpc_slice_from_copied_string("ccc");
- gpr_slice_buffer_init(&src);
- gpr_slice_buffer_init(&dst);
+ grpc_slice_buffer_init(&src);
+ grpc_slice_buffer_init(&dst);
for (idx = 0; idx < 3; idx++) {
- gpr_slice_ref(slices[idx]);
+ grpc_slice_ref(slices[idx]);
/* For this test, it is important that we add each slice at a new
slice index */
- gpr_slice_buffer_add_indexed(&src, slices[idx]);
- gpr_slice_buffer_add_indexed(&dst, slices[idx]);
+ grpc_slice_buffer_add_indexed(&src, slices[idx]);
+ grpc_slice_buffer_add_indexed(&dst, slices[idx]);
}
/* Case 1: Move more than the first slice's length from src to dst */
src_len = src.length;
dst_len = dst.length;
- gpr_slice_buffer_move_first(&src, 4, &dst);
+ grpc_slice_buffer_move_first(&src, 4, &dst);
src_len -= 4;
dst_len += 4;
GPR_ASSERT(src.length == src_len);
@@ -104,7 +104,7 @@ void test_slice_buffer_move_first() {
/* src now has two slices ["bbb"] and ["ccc"] */
/* Case 2: Move the first slice from src to dst */
- gpr_slice_buffer_move_first(&src, 3, &dst);
+ grpc_slice_buffer_move_first(&src, 3, &dst);
src_len -= 3;
dst_len += 3;
GPR_ASSERT(src.length == src_len);
@@ -112,7 +112,7 @@ void test_slice_buffer_move_first() {
/* src now has one slice ["ccc"] */
/* Case 3: Move less than the first slice's length from src to dst*/
- gpr_slice_buffer_move_first(&src, 2, &dst);
+ grpc_slice_buffer_move_first(&src, 2, &dst);
src_len -= 2;
dst_len += 2;
GPR_ASSERT(src.length == src.length);
diff --git a/test/core/slice/slice_string_helpers_test.c b/test/core/slice/slice_string_helpers_test.c
new file mode 100644
index 0000000000..6d6b55ab45
--- /dev/null
+++ b/test/core/slice/slice_string_helpers_test.c
@@ -0,0 +1,150 @@
+/*
+ *
+ * Copyright 2015, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#include "src/core/lib/slice/slice_string_helpers.h"
+
+#include <limits.h>
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <grpc/support/alloc.h>
+#include <grpc/support/log.h>
+#include <grpc/support/string_util.h>
+#include <grpc/support/useful.h>
+
+#include "src/core/lib/support/string.h"
+#include "test/core/util/test_config.h"
+
+#define LOG_TEST_NAME(x) gpr_log(GPR_INFO, "%s", x)
+
+static void expect_slice_dump(grpc_slice slice, uint32_t flags,
+ const char *result) {
+ char *got = grpc_dump_slice(slice, flags);
+ GPR_ASSERT(0 == strcmp(got, result));
+ gpr_free(got);
+ grpc_slice_unref(slice);
+}
+
+static void test_dump_slice(void) {
+ static const char *text = "HELLO WORLD!";
+ static const char *long_text =
+ "It was a bright cold day in April, and the clocks were striking "
+ "thirteen. Winston Smith, his chin nuzzled into his breast in an effort "
+ "to escape the vile wind, slipped quickly through the glass doors of "
+ "Victory Mansions, though not quickly enough to prevent a swirl of "
+ "gritty dust from entering along with him.";
+
+ LOG_TEST_NAME("test_dump_slice");
+
+ expect_slice_dump(grpc_slice_from_copied_string(text), GPR_DUMP_ASCII, text);
+ expect_slice_dump(grpc_slice_from_copied_string(long_text), GPR_DUMP_ASCII,
+ long_text);
+ expect_slice_dump(grpc_slice_from_copied_buffer("\x01", 1), GPR_DUMP_HEX,
+ "01");
+ expect_slice_dump(grpc_slice_from_copied_buffer("\x01", 1),
+ GPR_DUMP_HEX | GPR_DUMP_ASCII, "01 '.'");
+}
+
+static void test_strsplit(void) {
+ grpc_slice_buffer *parts;
+ grpc_slice str;
+
+ LOG_TEST_NAME("test_strsplit");
+
+ parts = gpr_malloc(sizeof(grpc_slice_buffer));
+ grpc_slice_buffer_init(parts);
+
+ str = grpc_slice_from_copied_string("one, two, three, four");
+ grpc_slice_split(str, ", ", parts);
+ GPR_ASSERT(4 == parts->count);
+ GPR_ASSERT(0 == grpc_slice_str_cmp(parts->slices[0], "one"));
+ GPR_ASSERT(0 == grpc_slice_str_cmp(parts->slices[1], "two"));
+ GPR_ASSERT(0 == grpc_slice_str_cmp(parts->slices[2], "three"));
+ GPR_ASSERT(0 == grpc_slice_str_cmp(parts->slices[3], "four"));
+ grpc_slice_buffer_reset_and_unref(parts);
+ grpc_slice_unref(str);
+
+ /* separator not present in string */
+ str = grpc_slice_from_copied_string("one two three four");
+ grpc_slice_split(str, ", ", parts);
+ GPR_ASSERT(1 == parts->count);
+ GPR_ASSERT(0 == grpc_slice_str_cmp(parts->slices[0], "one two three four"));
+ grpc_slice_buffer_reset_and_unref(parts);
+ grpc_slice_unref(str);
+
+ /* separator at the end */
+ str = grpc_slice_from_copied_string("foo,");
+ grpc_slice_split(str, ",", parts);
+ GPR_ASSERT(2 == parts->count);
+ GPR_ASSERT(0 == grpc_slice_str_cmp(parts->slices[0], "foo"));
+ GPR_ASSERT(0 == grpc_slice_str_cmp(parts->slices[1], ""));
+ grpc_slice_buffer_reset_and_unref(parts);
+ grpc_slice_unref(str);
+
+ /* separator at the beginning */
+ str = grpc_slice_from_copied_string(",foo");
+ grpc_slice_split(str, ",", parts);
+ GPR_ASSERT(2 == parts->count);
+ GPR_ASSERT(0 == grpc_slice_str_cmp(parts->slices[0], ""));
+ GPR_ASSERT(0 == grpc_slice_str_cmp(parts->slices[1], "foo"));
+ grpc_slice_buffer_reset_and_unref(parts);
+ grpc_slice_unref(str);
+
+ /* standalone separator */
+ str = grpc_slice_from_copied_string(",");
+ grpc_slice_split(str, ",", parts);
+ GPR_ASSERT(2 == parts->count);
+ GPR_ASSERT(0 == grpc_slice_str_cmp(parts->slices[0], ""));
+ GPR_ASSERT(0 == grpc_slice_str_cmp(parts->slices[1], ""));
+ grpc_slice_buffer_reset_and_unref(parts);
+ grpc_slice_unref(str);
+
+ /* empty input */
+ str = grpc_slice_from_copied_string("");
+ grpc_slice_split(str, ", ", parts);
+ GPR_ASSERT(1 == parts->count);
+ GPR_ASSERT(0 == grpc_slice_str_cmp(parts->slices[0], ""));
+ grpc_slice_buffer_reset_and_unref(parts);
+ grpc_slice_unref(str);
+
+ grpc_slice_buffer_destroy(parts);
+ gpr_free(parts);
+}
+
+int main(int argc, char **argv) {
+ grpc_test_init(argc, argv);
+ test_dump_slice();
+ test_strsplit();
+ return 0;
+}
diff --git a/test/core/support/slice_test.c b/test/core/slice/slice_test.c
index 06c364b368..ca44becfd0 100644
--- a/test/core/support/slice_test.c
+++ b/test/core/slice/slice_test.c
@@ -31,7 +31,7 @@
*
*/
-#include <grpc/support/slice.h>
+#include <grpc/slice.h>
#include <string.h>
@@ -42,23 +42,23 @@
#define LOG_TEST_NAME(x) gpr_log(GPR_INFO, "%s", x);
static void test_slice_malloc_returns_something_sensible(void) {
- /* Calls gpr_slice_create for various lengths and verifies the internals for
+ /* Calls grpc_slice_create for various lengths and verifies the internals for
consistency. */
size_t length;
size_t i;
- gpr_slice slice;
+ grpc_slice slice;
LOG_TEST_NAME("test_slice_malloc_returns_something_sensible");
for (length = 0; length <= 1024; length++) {
- slice = gpr_slice_malloc(length);
+ slice = grpc_slice_malloc(length);
/* If there is a length, slice.data must be non-NULL. If length is zero
we don't care. */
if (length) {
- GPR_ASSERT(GPR_SLICE_START_PTR(slice));
+ GPR_ASSERT(GRPC_SLICE_START_PTR(slice));
}
/* Returned slice length must be what was requested. */
- GPR_ASSERT(GPR_SLICE_LENGTH(slice) == length);
+ GPR_ASSERT(GRPC_SLICE_LENGTH(slice) == length);
/* If the slice has a refcount, it must be destroyable. */
if (slice.refcount) {
GPR_ASSERT(slice.refcount->ref != NULL);
@@ -66,10 +66,10 @@ static void test_slice_malloc_returns_something_sensible(void) {
}
/* We must be able to write to every byte of the data */
for (i = 0; i < length; i++) {
- GPR_SLICE_START_PTR(slice)[i] = (uint8_t)i;
+ GRPC_SLICE_START_PTR(slice)[i] = (uint8_t)i;
}
/* And finally we must succeed in destroying the slice */
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
}
}
@@ -78,11 +78,11 @@ static void do_nothing(void *ignored) {}
static void test_slice_new_returns_something_sensible(void) {
uint8_t x;
- gpr_slice slice = gpr_slice_new(&x, 1, do_nothing);
+ grpc_slice slice = grpc_slice_new(&x, 1, do_nothing);
GPR_ASSERT(slice.refcount);
GPR_ASSERT(slice.data.refcounted.bytes == &x);
GPR_ASSERT(slice.data.refcounted.length == 1);
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
}
/* destroy function that sets a mark to indicate it was called. */
@@ -91,18 +91,18 @@ static void set_mark(void *p) { *((int *)p) = 1; }
static void test_slice_new_with_user_data(void) {
int marker = 0;
uint8_t buf[2];
- gpr_slice slice;
+ grpc_slice slice;
buf[0] = 0;
buf[1] = 1;
- slice = gpr_slice_new_with_user_data(buf, 2, set_mark, &marker);
+ slice = grpc_slice_new_with_user_data(buf, 2, set_mark, &marker);
GPR_ASSERT(marker == 0);
- GPR_ASSERT(GPR_SLICE_LENGTH(slice) == 2);
- GPR_ASSERT(GPR_SLICE_START_PTR(slice)[0] == 0);
- GPR_ASSERT(GPR_SLICE_START_PTR(slice)[1] == 1);
+ GPR_ASSERT(GRPC_SLICE_LENGTH(slice) == 2);
+ GPR_ASSERT(GRPC_SLICE_START_PTR(slice)[0] == 0);
+ GPR_ASSERT(GRPC_SLICE_START_PTR(slice)[1] == 1);
/* unref should cause destroy function to run. */
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
GPR_ASSERT(marker == 1);
}
@@ -118,7 +118,7 @@ static void test_slice_new_with_len_returns_something_sensible(void) {
int num_refs = 5; /* To test adding/removing an arbitrary number of refs */
int i;
- gpr_slice slice = gpr_slice_new_with_len(&x, 1, do_nothing_with_len_1);
+ grpc_slice slice = grpc_slice_new_with_len(&x, 1, do_nothing_with_len_1);
GPR_ASSERT(slice.refcount); /* ref count is initialized to 1 at this point */
GPR_ASSERT(slice.data.refcounted.bytes == &x);
GPR_ASSERT(slice.data.refcounted.length == 1);
@@ -128,21 +128,21 @@ static void test_slice_new_with_len_returns_something_sensible(void) {
make sure that that the destroy callback (i.e do_nothing_with_len_1()) is
not called until the last unref operation */
for (i = 0; i < num_refs; i++) {
- gpr_slice_ref(slice);
+ grpc_slice_ref(slice);
}
for (i = 0; i < num_refs; i++) {
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
}
GPR_ASSERT(do_nothing_with_len_1_calls == 0); /* Shouldn't be called yet */
/* last unref */
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
GPR_ASSERT(do_nothing_with_len_1_calls == 1);
}
static void test_slice_sub_works(unsigned length) {
- gpr_slice slice;
- gpr_slice sub;
+ grpc_slice slice;
+ grpc_slice sub;
unsigned i, j, k;
LOG_TEST_NAME("test_slice_sub_works");
@@ -150,38 +150,39 @@ static void test_slice_sub_works(unsigned length) {
/* Create a slice in which each byte is equal to the distance from it to the
beginning of the slice. */
- slice = gpr_slice_malloc(length);
+ slice = grpc_slice_malloc(length);
for (i = 0; i < length; i++) {
- GPR_SLICE_START_PTR(slice)[i] = (uint8_t)i;
+ GRPC_SLICE_START_PTR(slice)[i] = (uint8_t)i;
}
/* Ensure that for all subsets length is correct and that we start on the
correct byte. Additionally check that no copies were made. */
for (i = 0; i < length; i++) {
for (j = i; j < length; j++) {
- sub = gpr_slice_sub(slice, i, j);
- GPR_ASSERT(GPR_SLICE_LENGTH(sub) == j - i);
+ sub = grpc_slice_sub(slice, i, j);
+ GPR_ASSERT(GRPC_SLICE_LENGTH(sub) == j - i);
for (k = 0; k < j - i; k++) {
- GPR_ASSERT(GPR_SLICE_START_PTR(sub)[k] == (uint8_t)(i + k));
+ GPR_ASSERT(GRPC_SLICE_START_PTR(sub)[k] == (uint8_t)(i + k));
}
- gpr_slice_unref(sub);
+ grpc_slice_unref(sub);
}
}
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
}
-static void check_head_tail(gpr_slice slice, gpr_slice head, gpr_slice tail) {
- GPR_ASSERT(GPR_SLICE_LENGTH(slice) ==
- GPR_SLICE_LENGTH(head) + GPR_SLICE_LENGTH(tail));
- GPR_ASSERT(0 == memcmp(GPR_SLICE_START_PTR(slice), GPR_SLICE_START_PTR(head),
- GPR_SLICE_LENGTH(head)));
- GPR_ASSERT(0 == memcmp(GPR_SLICE_START_PTR(slice) + GPR_SLICE_LENGTH(head),
- GPR_SLICE_START_PTR(tail), GPR_SLICE_LENGTH(tail)));
+static void check_head_tail(grpc_slice slice, grpc_slice head,
+ grpc_slice tail) {
+ GPR_ASSERT(GRPC_SLICE_LENGTH(slice) ==
+ GRPC_SLICE_LENGTH(head) + GRPC_SLICE_LENGTH(tail));
+ GPR_ASSERT(0 == memcmp(GRPC_SLICE_START_PTR(slice),
+ GRPC_SLICE_START_PTR(head), GRPC_SLICE_LENGTH(head)));
+ GPR_ASSERT(0 == memcmp(GRPC_SLICE_START_PTR(slice) + GRPC_SLICE_LENGTH(head),
+ GRPC_SLICE_START_PTR(tail), GRPC_SLICE_LENGTH(tail)));
}
static void test_slice_split_head_works(size_t length) {
- gpr_slice slice;
- gpr_slice head, tail;
+ grpc_slice slice;
+ grpc_slice head, tail;
size_t i;
LOG_TEST_NAME("test_slice_split_head_works");
@@ -189,27 +190,27 @@ static void test_slice_split_head_works(size_t length) {
/* Create a slice in which each byte is equal to the distance from it to the
beginning of the slice. */
- slice = gpr_slice_malloc(length);
+ slice = grpc_slice_malloc(length);
for (i = 0; i < length; i++) {
- GPR_SLICE_START_PTR(slice)[i] = (uint8_t)i;
+ GRPC_SLICE_START_PTR(slice)[i] = (uint8_t)i;
}
/* Ensure that for all subsets length is correct and that we start on the
correct byte. Additionally check that no copies were made. */
for (i = 0; i < length; i++) {
- tail = gpr_slice_ref(slice);
- head = gpr_slice_split_head(&tail, i);
+ tail = grpc_slice_ref(slice);
+ head = grpc_slice_split_head(&tail, i);
check_head_tail(slice, head, tail);
- gpr_slice_unref(tail);
- gpr_slice_unref(head);
+ grpc_slice_unref(tail);
+ grpc_slice_unref(head);
}
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
}
static void test_slice_split_tail_works(size_t length) {
- gpr_slice slice;
- gpr_slice head, tail;
+ grpc_slice slice;
+ grpc_slice head, tail;
size_t i;
LOG_TEST_NAME("test_slice_split_tail_works");
@@ -217,35 +218,35 @@ static void test_slice_split_tail_works(size_t length) {
/* Create a slice in which each byte is equal to the distance from it to the
beginning of the slice. */
- slice = gpr_slice_malloc(length);
+ slice = grpc_slice_malloc(length);
for (i = 0; i < length; i++) {
- GPR_SLICE_START_PTR(slice)[i] = (uint8_t)i;
+ GRPC_SLICE_START_PTR(slice)[i] = (uint8_t)i;
}
/* Ensure that for all subsets length is correct and that we start on the
correct byte. Additionally check that no copies were made. */
for (i = 0; i < length; i++) {
- head = gpr_slice_ref(slice);
- tail = gpr_slice_split_tail(&head, i);
+ head = grpc_slice_ref(slice);
+ tail = grpc_slice_split_tail(&head, i);
check_head_tail(slice, head, tail);
- gpr_slice_unref(tail);
- gpr_slice_unref(head);
+ grpc_slice_unref(tail);
+ grpc_slice_unref(head);
}
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
}
static void test_slice_from_copied_string_works(void) {
static const char *text = "HELLO WORLD!";
- gpr_slice slice;
+ grpc_slice slice;
LOG_TEST_NAME("test_slice_from_copied_string_works");
- slice = gpr_slice_from_copied_string(text);
- GPR_ASSERT(strlen(text) == GPR_SLICE_LENGTH(slice));
- GPR_ASSERT(0 ==
- memcmp(text, GPR_SLICE_START_PTR(slice), GPR_SLICE_LENGTH(slice)));
- gpr_slice_unref(slice);
+ slice = grpc_slice_from_copied_string(text);
+ GPR_ASSERT(strlen(text) == GRPC_SLICE_LENGTH(slice));
+ GPR_ASSERT(
+ 0 == memcmp(text, GRPC_SLICE_START_PTR(slice), GRPC_SLICE_LENGTH(slice)));
+ grpc_slice_unref(slice);
}
int main(int argc, char **argv) {
diff --git a/test/core/support/string_test.c b/test/core/support/string_test.c
index 378e45a942..78b77fad8e 100644
--- a/test/core/support/string_test.c
+++ b/test/core/support/string_test.c
@@ -76,34 +76,6 @@ static void test_dump(void) {
expect_dump("ab", 2, GPR_DUMP_HEX | GPR_DUMP_ASCII, "61 62 'ab'");
}
-static void expect_slice_dump(gpr_slice slice, uint32_t flags,
- const char *result) {
- char *got = gpr_dump_slice(slice, flags);
- GPR_ASSERT(0 == strcmp(got, result));
- gpr_free(got);
- gpr_slice_unref(slice);
-}
-
-static void test_dump_slice(void) {
- static const char *text = "HELLO WORLD!";
- static const char *long_text =
- "It was a bright cold day in April, and the clocks were striking "
- "thirteen. Winston Smith, his chin nuzzled into his breast in an effort "
- "to escape the vile wind, slipped quickly through the glass doors of "
- "Victory Mansions, though not quickly enough to prevent a swirl of "
- "gritty dust from entering along with him.";
-
- LOG_TEST_NAME("test_dump_slice");
-
- expect_slice_dump(gpr_slice_from_copied_string(text), GPR_DUMP_ASCII, text);
- expect_slice_dump(gpr_slice_from_copied_string(long_text), GPR_DUMP_ASCII,
- long_text);
- expect_slice_dump(gpr_slice_from_copied_buffer("\x01", 1), GPR_DUMP_HEX,
- "01");
- expect_slice_dump(gpr_slice_from_copied_buffer("\x01", 1),
- GPR_DUMP_HEX | GPR_DUMP_ASCII, "01 '.'");
-}
-
static void test_pu32_fail(const char *s) {
uint32_t out;
GPR_ASSERT(!gpr_parse_bytes_to_uint32(s, strlen(s), &out));
@@ -221,72 +193,6 @@ static void test_strjoin_sep(void) {
gpr_free(joined);
}
-static void test_strsplit(void) {
- gpr_slice_buffer *parts;
- gpr_slice str;
-
- LOG_TEST_NAME("test_strsplit");
-
- parts = gpr_malloc(sizeof(gpr_slice_buffer));
- gpr_slice_buffer_init(parts);
-
- str = gpr_slice_from_copied_string("one, two, three, four");
- gpr_slice_split(str, ", ", parts);
- GPR_ASSERT(4 == parts->count);
- GPR_ASSERT(0 == gpr_slice_str_cmp(parts->slices[0], "one"));
- GPR_ASSERT(0 == gpr_slice_str_cmp(parts->slices[1], "two"));
- GPR_ASSERT(0 == gpr_slice_str_cmp(parts->slices[2], "three"));
- GPR_ASSERT(0 == gpr_slice_str_cmp(parts->slices[3], "four"));
- gpr_slice_buffer_reset_and_unref(parts);
- gpr_slice_unref(str);
-
- /* separator not present in string */
- str = gpr_slice_from_copied_string("one two three four");
- gpr_slice_split(str, ", ", parts);
- GPR_ASSERT(1 == parts->count);
- GPR_ASSERT(0 == gpr_slice_str_cmp(parts->slices[0], "one two three four"));
- gpr_slice_buffer_reset_and_unref(parts);
- gpr_slice_unref(str);
-
- /* separator at the end */
- str = gpr_slice_from_copied_string("foo,");
- gpr_slice_split(str, ",", parts);
- GPR_ASSERT(2 == parts->count);
- GPR_ASSERT(0 == gpr_slice_str_cmp(parts->slices[0], "foo"));
- GPR_ASSERT(0 == gpr_slice_str_cmp(parts->slices[1], ""));
- gpr_slice_buffer_reset_and_unref(parts);
- gpr_slice_unref(str);
-
- /* separator at the beginning */
- str = gpr_slice_from_copied_string(",foo");
- gpr_slice_split(str, ",", parts);
- GPR_ASSERT(2 == parts->count);
- GPR_ASSERT(0 == gpr_slice_str_cmp(parts->slices[0], ""));
- GPR_ASSERT(0 == gpr_slice_str_cmp(parts->slices[1], "foo"));
- gpr_slice_buffer_reset_and_unref(parts);
- gpr_slice_unref(str);
-
- /* standalone separator */
- str = gpr_slice_from_copied_string(",");
- gpr_slice_split(str, ",", parts);
- GPR_ASSERT(2 == parts->count);
- GPR_ASSERT(0 == gpr_slice_str_cmp(parts->slices[0], ""));
- GPR_ASSERT(0 == gpr_slice_str_cmp(parts->slices[1], ""));
- gpr_slice_buffer_reset_and_unref(parts);
- gpr_slice_unref(str);
-
- /* empty input */
- str = gpr_slice_from_copied_string("");
- gpr_slice_split(str, ", ", parts);
- GPR_ASSERT(1 == parts->count);
- GPR_ASSERT(0 == gpr_slice_str_cmp(parts->slices[0], ""));
- gpr_slice_buffer_reset_and_unref(parts);
- gpr_slice_unref(str);
-
- gpr_slice_buffer_destroy(parts);
- gpr_free(parts);
-}
-
static void test_ltoa() {
char *str;
char buf[GPR_LTOA_MIN_BUFSIZE];
@@ -377,12 +283,10 @@ int main(int argc, char **argv) {
grpc_test_init(argc, argv);
test_strdup();
test_dump();
- test_dump_slice();
test_parse_uint32();
test_asprintf();
test_strjoin();
test_strjoin_sep();
- test_strsplit();
test_ltoa();
test_int64toa();
test_leftpad();
diff --git a/test/core/surface/byte_buffer_reader_test.c b/test/core/surface/byte_buffer_reader_test.c
index 1ab1a06211..d8d7a52d15 100644
--- a/test/core/surface/byte_buffer_reader_test.c
+++ b/test/core/surface/byte_buffer_reader_test.c
@@ -34,7 +34,7 @@
#include <grpc/byte_buffer.h>
#include <grpc/byte_buffer_reader.h>
#include <grpc/grpc.h>
-#include <grpc/support/slice.h>
+#include <grpc/slice.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
@@ -49,102 +49,102 @@
#define LOG_TEST(x) gpr_log(GPR_INFO, "%s", x)
static void test_read_one_slice(void) {
- gpr_slice slice;
+ grpc_slice slice;
grpc_byte_buffer *buffer;
grpc_byte_buffer_reader reader;
- gpr_slice first_slice, second_slice;
+ grpc_slice first_slice, second_slice;
int first_code, second_code;
LOG_TEST("test_read_one_slice");
- slice = gpr_slice_from_copied_string("test");
+ slice = grpc_slice_from_copied_string("test");
buffer = grpc_raw_byte_buffer_create(&slice, 1);
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
GPR_ASSERT(grpc_byte_buffer_reader_init(&reader, buffer) &&
"Couldn't init byte buffer reader");
first_code = grpc_byte_buffer_reader_next(&reader, &first_slice);
GPR_ASSERT(first_code != 0);
- GPR_ASSERT(memcmp(GPR_SLICE_START_PTR(first_slice), "test", 4) == 0);
- gpr_slice_unref(first_slice);
+ GPR_ASSERT(memcmp(GRPC_SLICE_START_PTR(first_slice), "test", 4) == 0);
+ grpc_slice_unref(first_slice);
second_code = grpc_byte_buffer_reader_next(&reader, &second_slice);
GPR_ASSERT(second_code == 0);
grpc_byte_buffer_destroy(buffer);
}
static void test_read_one_slice_malloc(void) {
- gpr_slice slice;
+ grpc_slice slice;
grpc_byte_buffer *buffer;
grpc_byte_buffer_reader reader;
- gpr_slice first_slice, second_slice;
+ grpc_slice first_slice, second_slice;
int first_code, second_code;
LOG_TEST("test_read_one_slice_malloc");
- slice = gpr_slice_malloc(4);
- memcpy(GPR_SLICE_START_PTR(slice), "test", 4);
+ slice = grpc_slice_malloc(4);
+ memcpy(GRPC_SLICE_START_PTR(slice), "test", 4);
buffer = grpc_raw_byte_buffer_create(&slice, 1);
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
GPR_ASSERT(grpc_byte_buffer_reader_init(&reader, buffer) &&
"Couldn't init byte buffer reader");
first_code = grpc_byte_buffer_reader_next(&reader, &first_slice);
GPR_ASSERT(first_code != 0);
- GPR_ASSERT(memcmp(GPR_SLICE_START_PTR(first_slice), "test", 4) == 0);
- gpr_slice_unref(first_slice);
+ GPR_ASSERT(memcmp(GRPC_SLICE_START_PTR(first_slice), "test", 4) == 0);
+ grpc_slice_unref(first_slice);
second_code = grpc_byte_buffer_reader_next(&reader, &second_slice);
GPR_ASSERT(second_code == 0);
grpc_byte_buffer_destroy(buffer);
}
static void test_read_none_compressed_slice(void) {
- gpr_slice slice;
+ grpc_slice slice;
grpc_byte_buffer *buffer;
grpc_byte_buffer_reader reader;
- gpr_slice first_slice, second_slice;
+ grpc_slice first_slice, second_slice;
int first_code, second_code;
LOG_TEST("test_read_none_compressed_slice");
- slice = gpr_slice_from_copied_string("test");
+ slice = grpc_slice_from_copied_string("test");
buffer = grpc_raw_byte_buffer_create(&slice, 1);
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
GPR_ASSERT(grpc_byte_buffer_reader_init(&reader, buffer) &&
"Couldn't init byte buffer reader");
first_code = grpc_byte_buffer_reader_next(&reader, &first_slice);
GPR_ASSERT(first_code != 0);
- GPR_ASSERT(memcmp(GPR_SLICE_START_PTR(first_slice), "test", 4) == 0);
- gpr_slice_unref(first_slice);
+ GPR_ASSERT(memcmp(GRPC_SLICE_START_PTR(first_slice), "test", 4) == 0);
+ grpc_slice_unref(first_slice);
second_code = grpc_byte_buffer_reader_next(&reader, &second_slice);
GPR_ASSERT(second_code == 0);
grpc_byte_buffer_destroy(buffer);
}
static void test_read_corrupted_slice(void) {
- gpr_slice slice;
+ grpc_slice slice;
grpc_byte_buffer *buffer;
grpc_byte_buffer_reader reader;
LOG_TEST("test_read_corrupted_slice");
- slice = gpr_slice_from_copied_string("test");
+ slice = grpc_slice_from_copied_string("test");
buffer = grpc_raw_byte_buffer_create(&slice, 1);
buffer->data.raw.compression = GRPC_COMPRESS_GZIP; /* lies! */
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
GPR_ASSERT(!grpc_byte_buffer_reader_init(&reader, buffer));
grpc_byte_buffer_destroy(buffer);
}
static void read_compressed_slice(grpc_compression_algorithm algorithm,
size_t input_size) {
- gpr_slice input_slice;
- gpr_slice_buffer sliceb_in;
- gpr_slice_buffer sliceb_out;
+ grpc_slice input_slice;
+ grpc_slice_buffer sliceb_in;
+ grpc_slice_buffer sliceb_out;
grpc_byte_buffer *buffer;
grpc_byte_buffer_reader reader;
- gpr_slice read_slice;
+ grpc_slice read_slice;
size_t read_count = 0;
- gpr_slice_buffer_init(&sliceb_in);
- gpr_slice_buffer_init(&sliceb_out);
+ grpc_slice_buffer_init(&sliceb_in);
+ grpc_slice_buffer_init(&sliceb_out);
- input_slice = gpr_slice_malloc(input_size);
- memset(GPR_SLICE_START_PTR(input_slice), 'a', input_size);
- gpr_slice_buffer_add(&sliceb_in, input_slice); /* takes ownership */
+ input_slice = grpc_slice_malloc(input_size);
+ memset(GRPC_SLICE_START_PTR(input_slice), 'a', input_size);
+ grpc_slice_buffer_add(&sliceb_in, input_slice); /* takes ownership */
GPR_ASSERT(grpc_msg_compress(algorithm, &sliceb_in, &sliceb_out));
buffer = grpc_raw_compressed_byte_buffer_create(sliceb_out.slices,
@@ -153,17 +153,17 @@ static void read_compressed_slice(grpc_compression_algorithm algorithm,
"Couldn't init byte buffer reader");
while (grpc_byte_buffer_reader_next(&reader, &read_slice)) {
- GPR_ASSERT(memcmp(GPR_SLICE_START_PTR(read_slice),
- GPR_SLICE_START_PTR(input_slice) + read_count,
- GPR_SLICE_LENGTH(read_slice)) == 0);
- read_count += GPR_SLICE_LENGTH(read_slice);
- gpr_slice_unref(read_slice);
+ GPR_ASSERT(memcmp(GRPC_SLICE_START_PTR(read_slice),
+ GRPC_SLICE_START_PTR(input_slice) + read_count,
+ GRPC_SLICE_LENGTH(read_slice)) == 0);
+ read_count += GRPC_SLICE_LENGTH(read_slice);
+ grpc_slice_unref(read_slice);
}
GPR_ASSERT(read_count == input_size);
grpc_byte_buffer_reader_destroy(&reader);
grpc_byte_buffer_destroy(buffer);
- gpr_slice_buffer_destroy(&sliceb_out);
- gpr_slice_buffer_destroy(&sliceb_in);
+ grpc_slice_buffer_destroy(&sliceb_out);
+ grpc_slice_buffer_destroy(&sliceb_in);
}
static void test_read_gzip_compressed_slice(void) {
@@ -179,15 +179,15 @@ static void test_read_deflate_compressed_slice(void) {
}
static void test_byte_buffer_from_reader(void) {
- gpr_slice slice;
+ grpc_slice slice;
grpc_byte_buffer *buffer, *buffer_from_reader;
grpc_byte_buffer_reader reader;
LOG_TEST("test_byte_buffer_from_reader");
- slice = gpr_slice_malloc(4);
- memcpy(GPR_SLICE_START_PTR(slice), "test", 4);
+ slice = grpc_slice_malloc(4);
+ memcpy(GRPC_SLICE_START_PTR(slice), "test", 4);
buffer = grpc_raw_byte_buffer_create(&slice, 1);
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
GPR_ASSERT(grpc_byte_buffer_reader_init(&reader, buffer) &&
"Couldn't init byte buffer reader");
@@ -195,7 +195,7 @@ static void test_byte_buffer_from_reader(void) {
GPR_ASSERT(buffer->type == buffer_from_reader->type);
GPR_ASSERT(buffer_from_reader->data.raw.compression == GRPC_COMPRESS_NONE);
GPR_ASSERT(buffer_from_reader->data.raw.slice_buffer.count == 1);
- GPR_ASSERT(memcmp(GPR_SLICE_START_PTR(
+ GPR_ASSERT(memcmp(GRPC_SLICE_START_PTR(
buffer_from_reader->data.raw.slice_buffer.slices[0]),
"test", 4) == 0);
@@ -206,70 +206,70 @@ static void test_byte_buffer_from_reader(void) {
static void test_readall(void) {
char *lotsa_as[512];
char *lotsa_bs[1024];
- gpr_slice slices[2];
+ grpc_slice slices[2];
grpc_byte_buffer *buffer;
grpc_byte_buffer_reader reader;
- gpr_slice slice_out;
+ grpc_slice slice_out;
LOG_TEST("test_readall");
memset(lotsa_as, 'a', 512);
memset(lotsa_bs, 'b', 1024);
/* use slices large enough to overflow inlining */
- slices[0] = gpr_slice_malloc(512);
- memcpy(GPR_SLICE_START_PTR(slices[0]), lotsa_as, 512);
- slices[1] = gpr_slice_malloc(1024);
- memcpy(GPR_SLICE_START_PTR(slices[1]), lotsa_bs, 1024);
+ slices[0] = grpc_slice_malloc(512);
+ memcpy(GRPC_SLICE_START_PTR(slices[0]), lotsa_as, 512);
+ slices[1] = grpc_slice_malloc(1024);
+ memcpy(GRPC_SLICE_START_PTR(slices[1]), lotsa_bs, 1024);
buffer = grpc_raw_byte_buffer_create(slices, 2);
- gpr_slice_unref(slices[0]);
- gpr_slice_unref(slices[1]);
+ grpc_slice_unref(slices[0]);
+ grpc_slice_unref(slices[1]);
GPR_ASSERT(grpc_byte_buffer_reader_init(&reader, buffer) &&
"Couldn't init byte buffer reader");
slice_out = grpc_byte_buffer_reader_readall(&reader);
- GPR_ASSERT(GPR_SLICE_LENGTH(slice_out) == 512 + 1024);
- GPR_ASSERT(memcmp(GPR_SLICE_START_PTR(slice_out), lotsa_as, 512) == 0);
- GPR_ASSERT(memcmp(&(GPR_SLICE_START_PTR(slice_out)[512]), lotsa_bs, 1024) ==
+ GPR_ASSERT(GRPC_SLICE_LENGTH(slice_out) == 512 + 1024);
+ GPR_ASSERT(memcmp(GRPC_SLICE_START_PTR(slice_out), lotsa_as, 512) == 0);
+ GPR_ASSERT(memcmp(&(GRPC_SLICE_START_PTR(slice_out)[512]), lotsa_bs, 1024) ==
0);
- gpr_slice_unref(slice_out);
+ grpc_slice_unref(slice_out);
grpc_byte_buffer_destroy(buffer);
}
static void test_byte_buffer_copy(void) {
char *lotsa_as[512];
char *lotsa_bs[1024];
- gpr_slice slices[2];
+ grpc_slice slices[2];
grpc_byte_buffer *buffer;
grpc_byte_buffer *copied_buffer;
grpc_byte_buffer_reader reader;
- gpr_slice slice_out;
+ grpc_slice slice_out;
LOG_TEST("test_byte_buffer_copy");
memset(lotsa_as, 'a', 512);
memset(lotsa_bs, 'b', 1024);
/* use slices large enough to overflow inlining */
- slices[0] = gpr_slice_malloc(512);
- memcpy(GPR_SLICE_START_PTR(slices[0]), lotsa_as, 512);
- slices[1] = gpr_slice_malloc(1024);
- memcpy(GPR_SLICE_START_PTR(slices[1]), lotsa_bs, 1024);
+ slices[0] = grpc_slice_malloc(512);
+ memcpy(GRPC_SLICE_START_PTR(slices[0]), lotsa_as, 512);
+ slices[1] = grpc_slice_malloc(1024);
+ memcpy(GRPC_SLICE_START_PTR(slices[1]), lotsa_bs, 1024);
buffer = grpc_raw_byte_buffer_create(slices, 2);
- gpr_slice_unref(slices[0]);
- gpr_slice_unref(slices[1]);
+ grpc_slice_unref(slices[0]);
+ grpc_slice_unref(slices[1]);
copied_buffer = grpc_byte_buffer_copy(buffer);
GPR_ASSERT(grpc_byte_buffer_reader_init(&reader, buffer) &&
"Couldn't init byte buffer reader");
slice_out = grpc_byte_buffer_reader_readall(&reader);
- GPR_ASSERT(GPR_SLICE_LENGTH(slice_out) == 512 + 1024);
- GPR_ASSERT(memcmp(GPR_SLICE_START_PTR(slice_out), lotsa_as, 512) == 0);
- GPR_ASSERT(memcmp(&(GPR_SLICE_START_PTR(slice_out)[512]), lotsa_bs, 1024) ==
+ GPR_ASSERT(GRPC_SLICE_LENGTH(slice_out) == 512 + 1024);
+ GPR_ASSERT(memcmp(GRPC_SLICE_START_PTR(slice_out), lotsa_as, 512) == 0);
+ GPR_ASSERT(memcmp(&(GRPC_SLICE_START_PTR(slice_out)[512]), lotsa_bs, 1024) ==
0);
- gpr_slice_unref(slice_out);
+ grpc_slice_unref(slice_out);
grpc_byte_buffer_destroy(buffer);
grpc_byte_buffer_destroy(copied_buffer);
}
diff --git a/test/core/surface/public_headers_must_be_c89.c b/test/core/surface/public_headers_must_be_c89.c
index 53bdf612fc..d4cfa25d44 100644
--- a/test/core/surface/public_headers_must_be_c89.c
+++ b/test/core/surface/public_headers_must_be_c89.c
@@ -50,6 +50,8 @@
#include <grpc/impl/codegen/status.h>
#include <grpc/impl/codegen/sync.h>
#include <grpc/impl/codegen/sync_generic.h>
+#include <grpc/slice.h>
+#include <grpc/slice_buffer.h>
#include <grpc/status.h>
#include <grpc/support/alloc.h>
#include <grpc/support/atm.h>
@@ -60,8 +62,6 @@
#include <grpc/support/host_port.h>
#include <grpc/support/log.h>
#include <grpc/support/port_platform.h>
-#include <grpc/support/slice.h>
-#include <grpc/support/slice_buffer.h>
#include <grpc/support/string_util.h>
#include <grpc/support/subprocess.h>
#include <grpc/support/sync.h>
diff --git a/test/core/transport/chttp2/bin_decoder_test.c b/test/core/transport/chttp2/bin_decoder_test.c
index c4e6cd332f..7ddc30291a 100644
--- a/test/core/transport/chttp2/bin_decoder_test.c
+++ b/test/core/transport/chttp2/bin_decoder_test.c
@@ -38,50 +38,51 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include "src/core/ext/transport/chttp2/transport/bin_encoder.h"
+#include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/lib/support/string.h"
static int all_ok = 1;
-static void expect_slice_eq(gpr_slice expected, gpr_slice slice, char *debug,
+static void expect_slice_eq(grpc_slice expected, grpc_slice slice, char *debug,
int line) {
- if (0 != gpr_slice_cmp(slice, expected)) {
- char *hs = gpr_dump_slice(slice, GPR_DUMP_HEX | GPR_DUMP_ASCII);
- char *he = gpr_dump_slice(expected, GPR_DUMP_HEX | GPR_DUMP_ASCII);
+ if (0 != grpc_slice_cmp(slice, expected)) {
+ char *hs = grpc_dump_slice(slice, GPR_DUMP_HEX | GPR_DUMP_ASCII);
+ char *he = grpc_dump_slice(expected, GPR_DUMP_HEX | GPR_DUMP_ASCII);
gpr_log(GPR_ERROR, "FAILED:%d: %s\ngot: %s\nwant: %s", line, debug, hs,
he);
gpr_free(hs);
gpr_free(he);
all_ok = 0;
}
- gpr_slice_unref(expected);
- gpr_slice_unref(slice);
+ grpc_slice_unref(expected);
+ grpc_slice_unref(slice);
}
-static gpr_slice base64_encode(const char *s) {
- gpr_slice ss = gpr_slice_from_copied_string(s);
- gpr_slice out = grpc_chttp2_base64_encode(ss);
- gpr_slice_unref(ss);
+static grpc_slice base64_encode(const char *s) {
+ grpc_slice ss = grpc_slice_from_copied_string(s);
+ grpc_slice out = grpc_chttp2_base64_encode(ss);
+ grpc_slice_unref(ss);
return out;
}
-static gpr_slice base64_decode(const char *s) {
- gpr_slice ss = gpr_slice_from_copied_string(s);
- gpr_slice out = grpc_chttp2_base64_decode(ss);
- gpr_slice_unref(ss);
+static grpc_slice base64_decode(const char *s) {
+ grpc_slice ss = grpc_slice_from_copied_string(s);
+ grpc_slice out = grpc_chttp2_base64_decode(ss);
+ grpc_slice_unref(ss);
return out;
}
-static gpr_slice base64_decode_with_length(const char *s,
- size_t output_length) {
- gpr_slice ss = gpr_slice_from_copied_string(s);
- gpr_slice out = grpc_chttp2_base64_decode_with_length(ss, output_length);
- gpr_slice_unref(ss);
+static grpc_slice base64_decode_with_length(const char *s,
+ size_t output_length) {
+ grpc_slice ss = grpc_slice_from_copied_string(s);
+ grpc_slice out = grpc_chttp2_base64_decode_with_length(ss, output_length);
+ grpc_slice_unref(ss);
return out;
}
-#define EXPECT_SLICE_EQ(expected, slice) \
- expect_slice_eq( \
- gpr_slice_from_copied_buffer(expected, sizeof(expected) - 1), slice, \
+#define EXPECT_SLICE_EQ(expected, slice) \
+ expect_slice_eq( \
+ grpc_slice_from_copied_buffer(expected, sizeof(expected) - 1), slice, \
#slice, __LINE__);
#define ENCODE_AND_DECODE(s) \
diff --git a/test/core/transport/chttp2/bin_encoder_test.c b/test/core/transport/chttp2/bin_encoder_test.c
index 08d10735a5..53b55a301e 100644
--- a/test/core/transport/chttp2/bin_encoder_test.c
+++ b/test/core/transport/chttp2/bin_encoder_test.c
@@ -41,53 +41,54 @@
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
+#include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/lib/support/string.h"
static int all_ok = 1;
-static void expect_slice_eq(gpr_slice expected, gpr_slice slice, char *debug,
+static void expect_slice_eq(grpc_slice expected, grpc_slice slice, char *debug,
int line) {
- if (0 != gpr_slice_cmp(slice, expected)) {
- char *hs = gpr_dump_slice(slice, GPR_DUMP_HEX | GPR_DUMP_ASCII);
- char *he = gpr_dump_slice(expected, GPR_DUMP_HEX | GPR_DUMP_ASCII);
+ if (0 != grpc_slice_cmp(slice, expected)) {
+ char *hs = grpc_dump_slice(slice, GPR_DUMP_HEX | GPR_DUMP_ASCII);
+ char *he = grpc_dump_slice(expected, GPR_DUMP_HEX | GPR_DUMP_ASCII);
gpr_log(GPR_ERROR, "FAILED:%d: %s\ngot: %s\nwant: %s", line, debug, hs,
he);
gpr_free(hs);
gpr_free(he);
all_ok = 0;
}
- gpr_slice_unref(expected);
- gpr_slice_unref(slice);
+ grpc_slice_unref(expected);
+ grpc_slice_unref(slice);
}
-static gpr_slice B64(const char *s) {
- gpr_slice ss = gpr_slice_from_copied_string(s);
- gpr_slice out = grpc_chttp2_base64_encode(ss);
- gpr_slice_unref(ss);
+static grpc_slice B64(const char *s) {
+ grpc_slice ss = grpc_slice_from_copied_string(s);
+ grpc_slice out = grpc_chttp2_base64_encode(ss);
+ grpc_slice_unref(ss);
return out;
}
-static gpr_slice HUFF(const char *s) {
- gpr_slice ss = gpr_slice_from_copied_string(s);
- gpr_slice out = grpc_chttp2_huffman_compress(ss);
- gpr_slice_unref(ss);
+static grpc_slice HUFF(const char *s) {
+ grpc_slice ss = grpc_slice_from_copied_string(s);
+ grpc_slice out = grpc_chttp2_huffman_compress(ss);
+ grpc_slice_unref(ss);
return out;
}
-#define EXPECT_SLICE_EQ(expected, slice) \
- expect_slice_eq( \
- gpr_slice_from_copied_buffer(expected, sizeof(expected) - 1), slice, \
+#define EXPECT_SLICE_EQ(expected, slice) \
+ expect_slice_eq( \
+ grpc_slice_from_copied_buffer(expected, sizeof(expected) - 1), slice, \
#slice, __LINE__);
static void expect_combined_equiv(const char *s, size_t len, int line) {
- gpr_slice input = gpr_slice_from_copied_buffer(s, len);
- gpr_slice base64 = grpc_chttp2_base64_encode(input);
- gpr_slice expect = grpc_chttp2_huffman_compress(base64);
- gpr_slice got = grpc_chttp2_base64_encode_and_huffman_compress_impl(input);
- if (0 != gpr_slice_cmp(expect, got)) {
- char *t = gpr_dump_slice(input, GPR_DUMP_HEX | GPR_DUMP_ASCII);
- char *e = gpr_dump_slice(expect, GPR_DUMP_HEX | GPR_DUMP_ASCII);
- char *g = gpr_dump_slice(got, GPR_DUMP_HEX | GPR_DUMP_ASCII);
+ grpc_slice input = grpc_slice_from_copied_buffer(s, len);
+ grpc_slice base64 = grpc_chttp2_base64_encode(input);
+ grpc_slice expect = grpc_chttp2_huffman_compress(base64);
+ grpc_slice got = grpc_chttp2_base64_encode_and_huffman_compress_impl(input);
+ if (0 != grpc_slice_cmp(expect, got)) {
+ char *t = grpc_dump_slice(input, GPR_DUMP_HEX | GPR_DUMP_ASCII);
+ char *e = grpc_dump_slice(expect, GPR_DUMP_HEX | GPR_DUMP_ASCII);
+ char *g = grpc_dump_slice(got, GPR_DUMP_HEX | GPR_DUMP_ASCII);
gpr_log(GPR_ERROR, "FAILED:%d:\ntest: %s\ngot: %s\nwant: %s", line, t, g,
e);
gpr_free(t);
@@ -95,10 +96,10 @@ static void expect_combined_equiv(const char *s, size_t len, int line) {
gpr_free(g);
all_ok = 0;
}
- gpr_slice_unref(input);
- gpr_slice_unref(base64);
- gpr_slice_unref(expect);
- gpr_slice_unref(got);
+ grpc_slice_unref(input);
+ grpc_slice_unref(base64);
+ grpc_slice_unref(expect);
+ grpc_slice_unref(got);
}
#define EXPECT_COMBINED_EQUIV(x) \
diff --git a/test/core/transport/chttp2/hpack_encoder_test.c b/test/core/transport/chttp2/hpack_encoder_test.c
index 1c1c74879b..91421e18f4 100644
--- a/test/core/transport/chttp2/hpack_encoder_test.c
+++ b/test/core/transport/chttp2/hpack_encoder_test.c
@@ -41,6 +41,7 @@
#include <grpc/support/string_util.h>
#include "src/core/ext/transport/chttp2/transport/hpack_parser.h"
+#include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/lib/support/string.h"
#include "src/core/lib/transport/metadata.h"
#include "test/core/util/parse_hexstring.h"
@@ -60,9 +61,9 @@ size_t cap_to_delete = 0;
hexstring passed in */
static void verify(size_t window_available, int eof, size_t expect_window_used,
const char *expected, size_t nheaders, ...) {
- gpr_slice_buffer output;
- gpr_slice merged;
- gpr_slice expect = parse_hexstring(expected);
+ grpc_slice_buffer output;
+ grpc_slice merged;
+ grpc_slice expect = parse_hexstring(expected);
size_t i;
va_list l;
grpc_linked_mdelem *e = gpr_malloc(sizeof(*e) * nheaders);
@@ -93,19 +94,19 @@ static void verify(size_t window_available, int eof, size_t expect_window_used,
}
to_delete[num_to_delete++] = e;
- gpr_slice_buffer_init(&output);
+ grpc_slice_buffer_init(&output);
grpc_transport_one_way_stats stats;
memset(&stats, 0, sizeof(stats));
grpc_chttp2_encode_header(&g_compressor, 0xdeadbeef, &b, eof, 16384, &stats,
&output);
merged = grpc_slice_merge(output.slices, output.count);
- gpr_slice_buffer_destroy(&output);
+ grpc_slice_buffer_destroy(&output);
grpc_metadata_batch_destroy(&b);
- if (0 != gpr_slice_cmp(merged, expect)) {
- char *expect_str = gpr_dump_slice(expect, GPR_DUMP_HEX | GPR_DUMP_ASCII);
- char *got_str = gpr_dump_slice(merged, GPR_DUMP_HEX | GPR_DUMP_ASCII);
+ if (0 != grpc_slice_cmp(merged, expect)) {
+ char *expect_str = grpc_dump_slice(expect, GPR_DUMP_HEX | GPR_DUMP_ASCII);
+ char *got_str = grpc_dump_slice(merged, GPR_DUMP_HEX | GPR_DUMP_ASCII);
gpr_log(GPR_ERROR, "mismatched output for %s", expected);
gpr_log(GPR_ERROR, "EXPECT: %s", expect_str);
gpr_log(GPR_ERROR, "GOT: %s", got_str);
@@ -114,8 +115,8 @@ static void verify(size_t window_available, int eof, size_t expect_window_used,
g_failure = 1;
}
- gpr_slice_unref(merged);
- gpr_slice_unref(expect);
+ grpc_slice_unref(merged);
+ grpc_slice_unref(expect);
}
static void test_basic_headers(void) {
@@ -186,7 +187,7 @@ static void test_decode_table_overflow(void) {
static void verify_table_size_change_match_elem_size(const char *key,
const char *value) {
- gpr_slice_buffer output;
+ grpc_slice_buffer output;
grpc_mdelem *elem = grpc_mdelem_from_strings(key, value);
size_t elem_size = grpc_mdelem_get_size_in_hpack_table(elem);
size_t initial_table_size = g_compressor.table_size;
@@ -198,13 +199,13 @@ static void verify_table_size_change_match_elem_size(const char *key,
e[0].next = NULL;
b.list.head = &e[0];
b.list.tail = &e[0];
- gpr_slice_buffer_init(&output);
+ grpc_slice_buffer_init(&output);
grpc_transport_one_way_stats stats;
memset(&stats, 0, sizeof(stats));
grpc_chttp2_encode_header(&g_compressor, 0xdeadbeef, &b, 0, 16384, &stats,
&output);
- gpr_slice_buffer_destroy(&output);
+ grpc_slice_buffer_destroy(&output);
grpc_metadata_batch_destroy(&b);
GPR_ASSERT(g_compressor.table_size == elem_size + initial_table_size);
diff --git a/test/core/transport/chttp2/hpack_parser_test.c b/test/core/transport/chttp2/hpack_parser_test.c
index 55b64f5d99..e2813df70c 100644
--- a/test/core/transport/chttp2/hpack_parser_test.c
+++ b/test/core/transport/chttp2/hpack_parser_test.c
@@ -36,9 +36,9 @@
#include <stdarg.h>
#include <grpc/grpc.h>
+#include <grpc/slice.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/slice.h>
#include "test/core/util/parse_hexstring.h"
#include "test/core/util/slice_splitter.h"
#include "test/core/util/test_config.h"
@@ -52,16 +52,16 @@ static void onhdr(grpc_exec_ctx *exec_ctx, void *ud, grpc_mdelem *md) {
GPR_ASSERT(ekey);
evalue = va_arg(chk->args, char *);
GPR_ASSERT(evalue);
- GPR_ASSERT(gpr_slice_str_cmp(md->key->slice, ekey) == 0);
- GPR_ASSERT(gpr_slice_str_cmp(md->value->slice, evalue) == 0);
+ GPR_ASSERT(grpc_slice_str_cmp(md->key->slice, ekey) == 0);
+ GPR_ASSERT(grpc_slice_str_cmp(md->value->slice, evalue) == 0);
GRPC_MDELEM_UNREF(md);
}
static void test_vector(grpc_chttp2_hpack_parser *parser,
grpc_slice_split_mode mode, const char *hexstring,
... /* char *key, char *value */) {
- gpr_slice input = parse_hexstring(hexstring);
- gpr_slice *slices;
+ grpc_slice input = parse_hexstring(hexstring);
+ grpc_slice *slices;
size_t nslices;
size_t i;
test_checker chk;
@@ -72,18 +72,18 @@ static void test_vector(grpc_chttp2_hpack_parser *parser,
parser->on_header_user_data = &chk;
grpc_split_slices(mode, &input, 1, &slices, &nslices);
- gpr_slice_unref(input);
+ grpc_slice_unref(input);
for (i = 0; i < nslices; i++) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
GPR_ASSERT(grpc_chttp2_hpack_parser_parse(
- &exec_ctx, parser, GPR_SLICE_START_PTR(slices[i]),
- GPR_SLICE_END_PTR(slices[i])) == GRPC_ERROR_NONE);
+ &exec_ctx, parser, GRPC_SLICE_START_PTR(slices[i]),
+ GRPC_SLICE_END_PTR(slices[i])) == GRPC_ERROR_NONE);
grpc_exec_ctx_finish(&exec_ctx);
}
for (i = 0; i < nslices; i++) {
- gpr_slice_unref(slices[i]);
+ grpc_slice_unref(slices[i]);
}
gpr_free(slices);
diff --git a/test/core/transport/chttp2/hpack_table_test.c b/test/core/transport/chttp2/hpack_table_test.c
index 75b0ef4629..1a7e2442ca 100644
--- a/test/core/transport/chttp2/hpack_table_test.c
+++ b/test/core/transport/chttp2/hpack_table_test.c
@@ -48,7 +48,7 @@
static void assert_str(const grpc_chttp2_hptbl *tbl, grpc_mdstr *mdstr,
const char *str) {
- GPR_ASSERT(gpr_slice_str_cmp(mdstr->slice, str) == 0);
+ GPR_ASSERT(grpc_slice_str_cmp(mdstr->slice, str) == 0);
}
static void assert_index(const grpc_chttp2_hptbl *tbl, uint32_t idx,
diff --git a/test/core/transport/chttp2/varint_test.c b/test/core/transport/chttp2/varint_test.c
index 3552bf0c59..e29be4b056 100644
--- a/test/core/transport/chttp2/varint_test.c
+++ b/test/core/transport/chttp2/varint_test.c
@@ -33,24 +33,25 @@
#include "src/core/ext/transport/chttp2/transport/varint.h"
+#include <grpc/slice.h>
#include <grpc/support/log.h>
-#include <grpc/support/slice.h>
#include "test/core/util/test_config.h"
static void test_varint(uint32_t value, uint32_t prefix_bits, uint8_t prefix_or,
const char *expect_bytes, size_t expect_length) {
uint32_t nbytes = GRPC_CHTTP2_VARINT_LENGTH(value, prefix_bits);
- gpr_slice expect = gpr_slice_from_copied_buffer(expect_bytes, expect_length);
- gpr_slice slice;
+ grpc_slice expect =
+ grpc_slice_from_copied_buffer(expect_bytes, expect_length);
+ grpc_slice slice;
gpr_log(GPR_DEBUG, "Test: 0x%08x", value);
GPR_ASSERT(nbytes == expect_length);
- slice = gpr_slice_malloc(nbytes);
+ slice = grpc_slice_malloc(nbytes);
GRPC_CHTTP2_WRITE_VARINT(value, prefix_bits, prefix_or,
- GPR_SLICE_START_PTR(slice), nbytes);
- GPR_ASSERT(gpr_slice_cmp(expect, slice) == 0);
- gpr_slice_unref(expect);
- gpr_slice_unref(slice);
+ GRPC_SLICE_START_PTR(slice), nbytes);
+ GPR_ASSERT(grpc_slice_cmp(expect, slice) == 0);
+ grpc_slice_unref(expect);
+ grpc_slice_unref(slice);
}
#define TEST_VARINT(value, prefix_bits, prefix_or, expect) \
diff --git a/test/core/transport/metadata_test.c b/test/core/transport/metadata_test.c
index 007892930c..5c89d8530a 100644
--- a/test/core/transport/metadata_test.c
+++ b/test/core/transport/metadata_test.c
@@ -68,8 +68,8 @@ static void test_create_string(void) {
s3 = grpc_mdstr_from_string("very much not hello");
GPR_ASSERT(s1 == s2);
GPR_ASSERT(s3 != s1);
- GPR_ASSERT(gpr_slice_str_cmp(s1->slice, "hello") == 0);
- GPR_ASSERT(gpr_slice_str_cmp(s3->slice, "very much not hello") == 0);
+ GPR_ASSERT(grpc_slice_str_cmp(s1->slice, "hello") == 0);
+ GPR_ASSERT(grpc_slice_str_cmp(s3->slice, "very much not hello") == 0);
GRPC_MDSTR_UNREF(s1);
GRPC_MDSTR_UNREF(s2);
GRPC_MDSTR_UNREF(s3);
@@ -89,9 +89,9 @@ static void test_create_metadata(void) {
GPR_ASSERT(m3 != m1);
GPR_ASSERT(m3->key == m1->key);
GPR_ASSERT(m3->value != m1->value);
- GPR_ASSERT(gpr_slice_str_cmp(m1->key->slice, "a") == 0);
- GPR_ASSERT(gpr_slice_str_cmp(m1->value->slice, "b") == 0);
- GPR_ASSERT(gpr_slice_str_cmp(m3->value->slice, "c") == 0);
+ GPR_ASSERT(grpc_slice_str_cmp(m1->key->slice, "a") == 0);
+ GPR_ASSERT(grpc_slice_str_cmp(m1->value->slice, "b") == 0);
+ GPR_ASSERT(grpc_slice_str_cmp(m3->value->slice, "c") == 0);
GRPC_MDELEM_UNREF(m1);
GRPC_MDELEM_UNREF(m2);
GRPC_MDELEM_UNREF(m3);
@@ -205,7 +205,7 @@ static void test_things_stick_around(void) {
static void test_slices_work(void) {
/* ensure no memory leaks when switching representation from mdstr to slice */
grpc_mdstr *str;
- gpr_slice slice;
+ grpc_slice slice;
LOG_TEST("test_slices_work");
@@ -213,14 +213,14 @@ static void test_slices_work(void) {
str = grpc_mdstr_from_string(
"123456789012345678901234567890123456789012345678901234567890");
- slice = gpr_slice_ref(str->slice);
+ slice = grpc_slice_ref(str->slice);
GRPC_MDSTR_UNREF(str);
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
str = grpc_mdstr_from_string(
"123456789012345678901234567890123456789012345678901234567890");
- slice = gpr_slice_ref(str->slice);
- gpr_slice_unref(slice);
+ slice = grpc_slice_ref(str->slice);
+ grpc_slice_unref(slice);
GRPC_MDSTR_UNREF(str);
grpc_shutdown();
@@ -228,8 +228,8 @@ static void test_slices_work(void) {
static void test_base64_and_huffman_works(void) {
grpc_mdstr *str;
- gpr_slice slice1;
- gpr_slice slice2;
+ grpc_slice slice1;
+ grpc_slice slice2;
LOG_TEST("test_base64_and_huffman_works");
@@ -237,9 +237,9 @@ static void test_base64_and_huffman_works(void) {
str = grpc_mdstr_from_string("abcdefg");
slice1 = grpc_mdstr_as_base64_encoded_and_huffman_compressed(str);
slice2 = grpc_chttp2_base64_encode_and_huffman_compress(str->slice);
- GPR_ASSERT(0 == gpr_slice_cmp(slice1, slice2));
+ GPR_ASSERT(0 == grpc_slice_cmp(slice1, slice2));
- gpr_slice_unref(slice2);
+ grpc_slice_unref(slice2);
GRPC_MDSTR_UNREF(str);
grpc_shutdown();
}
@@ -276,13 +276,13 @@ static void verify_binary_header_size(const char *key, const uint8_t *value,
grpc_mdelem *elem = grpc_mdelem_from_string_and_buffer(key, value, value_len);
GPR_ASSERT(grpc_is_binary_header(key, strlen(key)));
size_t elem_size = grpc_mdelem_get_size_in_hpack_table(elem);
- gpr_slice value_slice =
- gpr_slice_from_copied_buffer((const char *)value, value_len);
- gpr_slice base64_encoded = grpc_chttp2_base64_encode(value_slice);
- size_t expected_size = 32 + strlen(key) + GPR_SLICE_LENGTH(base64_encoded);
+ grpc_slice value_slice =
+ grpc_slice_from_copied_buffer((const char *)value, value_len);
+ grpc_slice base64_encoded = grpc_chttp2_base64_encode(value_slice);
+ size_t expected_size = 32 + strlen(key) + GRPC_SLICE_LENGTH(base64_encoded);
GPR_ASSERT(expected_size == elem_size);
- gpr_slice_unref(value_slice);
- gpr_slice_unref(base64_encoded);
+ grpc_slice_unref(value_slice);
+ grpc_slice_unref(base64_encoded);
GRPC_MDELEM_UNREF(elem);
}
diff --git a/test/core/util/mock_endpoint.c b/test/core/util/mock_endpoint.c
index 2dac877a65..28ff0642cc 100644
--- a/test/core/util/mock_endpoint.c
+++ b/test/core/util/mock_endpoint.c
@@ -41,19 +41,19 @@
typedef struct grpc_mock_endpoint {
grpc_endpoint base;
gpr_mu mu;
- void (*on_write)(gpr_slice slice);
- gpr_slice_buffer read_buffer;
- gpr_slice_buffer *on_read_out;
+ void (*on_write)(grpc_slice slice);
+ grpc_slice_buffer read_buffer;
+ grpc_slice_buffer *on_read_out;
grpc_closure *on_read;
grpc_resource_user *resource_user;
} grpc_mock_endpoint;
static void me_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
- gpr_slice_buffer *slices, grpc_closure *cb) {
+ grpc_slice_buffer *slices, grpc_closure *cb) {
grpc_mock_endpoint *m = (grpc_mock_endpoint *)ep;
gpr_mu_lock(&m->mu);
if (m->read_buffer.count > 0) {
- gpr_slice_buffer_swap(&m->read_buffer, slices);
+ grpc_slice_buffer_swap(&m->read_buffer, slices);
grpc_exec_ctx_sched(exec_ctx, cb, GRPC_ERROR_NONE, NULL);
} else {
m->on_read = cb;
@@ -63,7 +63,7 @@ static void me_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
}
static void me_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
- gpr_slice_buffer *slices, grpc_closure *cb) {
+ grpc_slice_buffer *slices, grpc_closure *cb) {
grpc_mock_endpoint *m = (grpc_mock_endpoint *)ep;
for (size_t i = 0; i < slices->count; i++) {
m->on_write(slices->slices[i]);
@@ -91,7 +91,7 @@ static void me_shutdown(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep) {
static void me_destroy(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep) {
grpc_mock_endpoint *m = (grpc_mock_endpoint *)ep;
- gpr_slice_buffer_destroy(&m->read_buffer);
+ grpc_slice_buffer_destroy(&m->read_buffer);
grpc_resource_user_unref(exec_ctx, m->resource_user);
gpr_free(m);
}
@@ -119,7 +119,7 @@ static const grpc_endpoint_vtable vtable = {
me_get_peer,
};
-grpc_endpoint *grpc_mock_endpoint_create(void (*on_write)(gpr_slice slice),
+grpc_endpoint *grpc_mock_endpoint_create(void (*on_write)(grpc_slice slice),
grpc_resource_quota *resource_quota) {
grpc_mock_endpoint *m = gpr_malloc(sizeof(*m));
m->base.vtable = &vtable;
@@ -127,7 +127,7 @@ grpc_endpoint *grpc_mock_endpoint_create(void (*on_write)(gpr_slice slice),
gpr_asprintf(&name, "mock_endpoint_%" PRIxPTR, (intptr_t)m);
m->resource_user = grpc_resource_user_create(resource_quota, name);
gpr_free(name);
- gpr_slice_buffer_init(&m->read_buffer);
+ grpc_slice_buffer_init(&m->read_buffer);
gpr_mu_init(&m->mu);
m->on_write = on_write;
m->on_read = NULL;
@@ -135,15 +135,15 @@ grpc_endpoint *grpc_mock_endpoint_create(void (*on_write)(gpr_slice slice),
}
void grpc_mock_endpoint_put_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
- gpr_slice slice) {
+ grpc_slice slice) {
grpc_mock_endpoint *m = (grpc_mock_endpoint *)ep;
gpr_mu_lock(&m->mu);
if (m->on_read != NULL) {
- gpr_slice_buffer_add(m->on_read_out, slice);
+ grpc_slice_buffer_add(m->on_read_out, slice);
grpc_exec_ctx_sched(exec_ctx, m->on_read, GRPC_ERROR_NONE, NULL);
m->on_read = NULL;
} else {
- gpr_slice_buffer_add(&m->read_buffer, slice);
+ grpc_slice_buffer_add(&m->read_buffer, slice);
}
gpr_mu_unlock(&m->mu);
}
diff --git a/test/core/util/mock_endpoint.h b/test/core/util/mock_endpoint.h
index b3a464ca01..ec7f0fcfcd 100644
--- a/test/core/util/mock_endpoint.h
+++ b/test/core/util/mock_endpoint.h
@@ -36,9 +36,10 @@
#include "src/core/lib/iomgr/endpoint.h"
-grpc_endpoint *grpc_mock_endpoint_create(void (*on_write)(gpr_slice slice),
+grpc_endpoint *grpc_mock_endpoint_create(void (*on_write)(grpc_slice slice),
grpc_resource_quota *resource_quota);
void grpc_mock_endpoint_put_read(grpc_exec_ctx *exec_ctx,
- grpc_endpoint *mock_endpoint, gpr_slice slice);
+ grpc_endpoint *mock_endpoint,
+ grpc_slice slice);
#endif
diff --git a/test/core/util/one_corpus_entry_fuzzer.c b/test/core/util/one_corpus_entry_fuzzer.c
index 95ae4cf706..c016ebb536 100644
--- a/test/core/util/one_corpus_entry_fuzzer.c
+++ b/test/core/util/one_corpus_entry_fuzzer.c
@@ -42,12 +42,13 @@ extern bool squelch;
extern bool leak_check;
int main(int argc, char **argv) {
- gpr_slice buffer;
+ grpc_slice buffer;
squelch = false;
leak_check = false;
GPR_ASSERT(
GRPC_LOG_IF_ERROR("load_file", grpc_load_file(argv[1], 0, &buffer)));
- LLVMFuzzerTestOneInput(GPR_SLICE_START_PTR(buffer), GPR_SLICE_LENGTH(buffer));
- gpr_slice_unref(buffer);
+ LLVMFuzzerTestOneInput(GRPC_SLICE_START_PTR(buffer),
+ GRPC_SLICE_LENGTH(buffer));
+ grpc_slice_unref(buffer);
return 0;
}
diff --git a/test/core/util/parse_hexstring.c b/test/core/util/parse_hexstring.c
index 3ad7ce5828..60ab1bb0c4 100644
--- a/test/core/util/parse_hexstring.c
+++ b/test/core/util/parse_hexstring.c
@@ -34,12 +34,12 @@
#include "test/core/util/parse_hexstring.h"
#include <grpc/support/log.h>
-gpr_slice parse_hexstring(const char *hexstring) {
+grpc_slice parse_hexstring(const char *hexstring) {
size_t nibbles = 0;
const char *p = 0;
uint8_t *out;
uint8_t temp;
- gpr_slice slice;
+ grpc_slice slice;
for (p = hexstring; *p; p++) {
nibbles += (*p >= '0' && *p <= '9') || (*p >= 'a' && *p <= 'f');
@@ -47,8 +47,8 @@ gpr_slice parse_hexstring(const char *hexstring) {
GPR_ASSERT((nibbles & 1) == 0);
- slice = gpr_slice_malloc(nibbles / 2);
- out = GPR_SLICE_START_PTR(slice);
+ slice = grpc_slice_malloc(nibbles / 2);
+ out = GRPC_SLICE_START_PTR(slice);
nibbles = 0;
temp = 0;
diff --git a/test/core/util/parse_hexstring.h b/test/core/util/parse_hexstring.h
index ddbfe541c6..32a4426812 100644
--- a/test/core/util/parse_hexstring.h
+++ b/test/core/util/parse_hexstring.h
@@ -34,8 +34,8 @@
#ifndef GRPC_TEST_CORE_UTIL_PARSE_HEXSTRING_H
#define GRPC_TEST_CORE_UTIL_PARSE_HEXSTRING_H
-#include <grpc/support/slice.h>
+#include <grpc/slice.h>
-gpr_slice parse_hexstring(const char *hexstring);
+grpc_slice parse_hexstring(const char *hexstring);
#endif /* GRPC_TEST_CORE_UTIL_PARSE_HEXSTRING_H */
diff --git a/test/core/util/passthru_endpoint.c b/test/core/util/passthru_endpoint.c
index a920a15aa5..8b323d1e45 100644
--- a/test/core/util/passthru_endpoint.c
+++ b/test/core/util/passthru_endpoint.c
@@ -43,8 +43,8 @@ typedef struct passthru_endpoint passthru_endpoint;
typedef struct {
grpc_endpoint base;
passthru_endpoint *parent;
- gpr_slice_buffer read_buffer;
- gpr_slice_buffer *on_read_out;
+ grpc_slice_buffer read_buffer;
+ grpc_slice_buffer *on_read_out;
grpc_closure *on_read;
grpc_resource_user *resource_user;
} half;
@@ -58,14 +58,14 @@ struct passthru_endpoint {
};
static void me_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
- gpr_slice_buffer *slices, grpc_closure *cb) {
+ grpc_slice_buffer *slices, grpc_closure *cb) {
half *m = (half *)ep;
gpr_mu_lock(&m->parent->mu);
if (m->parent->shutdown) {
grpc_exec_ctx_sched(exec_ctx, cb, GRPC_ERROR_CREATE("Already shutdown"),
NULL);
} else if (m->read_buffer.count > 0) {
- gpr_slice_buffer_swap(&m->read_buffer, slices);
+ grpc_slice_buffer_swap(&m->read_buffer, slices);
grpc_exec_ctx_sched(exec_ctx, cb, GRPC_ERROR_NONE, NULL);
} else {
m->on_read = cb;
@@ -80,7 +80,7 @@ static half *other_half(half *h) {
}
static void me_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
- gpr_slice_buffer *slices, grpc_closure *cb) {
+ grpc_slice_buffer *slices, grpc_closure *cb) {
half *m = other_half((half *)ep);
gpr_mu_lock(&m->parent->mu);
grpc_error *error = GRPC_ERROR_NONE;
@@ -88,13 +88,13 @@ static void me_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
error = GRPC_ERROR_CREATE("Endpoint already shutdown");
} else if (m->on_read != NULL) {
for (size_t i = 0; i < slices->count; i++) {
- gpr_slice_buffer_add(m->on_read_out, gpr_slice_ref(slices->slices[i]));
+ grpc_slice_buffer_add(m->on_read_out, grpc_slice_ref(slices->slices[i]));
}
grpc_exec_ctx_sched(exec_ctx, m->on_read, GRPC_ERROR_NONE, NULL);
m->on_read = NULL;
} else {
for (size_t i = 0; i < slices->count; i++) {
- gpr_slice_buffer_add(&m->read_buffer, gpr_slice_ref(slices->slices[i]));
+ grpc_slice_buffer_add(&m->read_buffer, grpc_slice_ref(slices->slices[i]));
}
}
gpr_mu_unlock(&m->parent->mu);
@@ -132,8 +132,8 @@ static void me_destroy(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep) {
if (0 == --p->halves) {
gpr_mu_unlock(&p->mu);
gpr_mu_destroy(&p->mu);
- gpr_slice_buffer_destroy(&p->client.read_buffer);
- gpr_slice_buffer_destroy(&p->server.read_buffer);
+ grpc_slice_buffer_destroy(&p->client.read_buffer);
+ grpc_slice_buffer_destroy(&p->server.read_buffer);
grpc_resource_user_unref(exec_ctx, p->client.resource_user);
grpc_resource_user_unref(exec_ctx, p->server.resource_user);
gpr_free(p);
@@ -170,7 +170,7 @@ static void half_init(half *m, passthru_endpoint *parent,
const char *half_name) {
m->base.vtable = &vtable;
m->parent = parent;
- gpr_slice_buffer_init(&m->read_buffer);
+ grpc_slice_buffer_init(&m->read_buffer);
m->on_read = NULL;
char *name;
gpr_asprintf(&name, "passthru_endpoint_%s_%" PRIxPTR, half_name,
diff --git a/test/core/util/slice_splitter.c b/test/core/util/slice_splitter.c
index 95b55a6505..177c9892a5 100644
--- a/test/core/util/slice_splitter.c
+++ b/test/core/util/slice_splitter.c
@@ -50,8 +50,8 @@ const char *grpc_slice_split_mode_name(grpc_slice_split_mode mode) {
return "error";
}
-void grpc_split_slices(grpc_slice_split_mode mode, gpr_slice *src_slices,
- size_t src_slice_count, gpr_slice **dst_slices,
+void grpc_split_slices(grpc_slice_split_mode mode, grpc_slice *src_slices,
+ size_t src_slice_count, grpc_slice **dst_slices,
size_t *dst_slice_count) {
size_t i, j;
size_t length;
@@ -59,39 +59,39 @@ void grpc_split_slices(grpc_slice_split_mode mode, gpr_slice *src_slices,
switch (mode) {
case GRPC_SLICE_SPLIT_IDENTITY:
*dst_slice_count = src_slice_count;
- *dst_slices = gpr_malloc(sizeof(gpr_slice) * src_slice_count);
+ *dst_slices = gpr_malloc(sizeof(grpc_slice) * src_slice_count);
for (i = 0; i < src_slice_count; i++) {
(*dst_slices)[i] = src_slices[i];
- gpr_slice_ref((*dst_slices)[i]);
+ grpc_slice_ref((*dst_slices)[i]);
}
break;
case GRPC_SLICE_SPLIT_MERGE_ALL:
*dst_slice_count = 1;
length = 0;
for (i = 0; i < src_slice_count; i++) {
- length += GPR_SLICE_LENGTH(src_slices[i]);
+ length += GRPC_SLICE_LENGTH(src_slices[i]);
}
- *dst_slices = gpr_malloc(sizeof(gpr_slice));
- **dst_slices = gpr_slice_malloc(length);
+ *dst_slices = gpr_malloc(sizeof(grpc_slice));
+ **dst_slices = grpc_slice_malloc(length);
length = 0;
for (i = 0; i < src_slice_count; i++) {
- memcpy(GPR_SLICE_START_PTR(**dst_slices) + length,
- GPR_SLICE_START_PTR(src_slices[i]),
- GPR_SLICE_LENGTH(src_slices[i]));
- length += GPR_SLICE_LENGTH(src_slices[i]);
+ memcpy(GRPC_SLICE_START_PTR(**dst_slices) + length,
+ GRPC_SLICE_START_PTR(src_slices[i]),
+ GRPC_SLICE_LENGTH(src_slices[i]));
+ length += GRPC_SLICE_LENGTH(src_slices[i]);
}
break;
case GRPC_SLICE_SPLIT_ONE_BYTE:
length = 0;
for (i = 0; i < src_slice_count; i++) {
- length += GPR_SLICE_LENGTH(src_slices[i]);
+ length += GRPC_SLICE_LENGTH(src_slices[i]);
}
*dst_slice_count = length;
- *dst_slices = gpr_malloc(sizeof(gpr_slice) * length);
+ *dst_slices = gpr_malloc(sizeof(grpc_slice) * length);
length = 0;
for (i = 0; i < src_slice_count; i++) {
- for (j = 0; j < GPR_SLICE_LENGTH(src_slices[i]); j++) {
- (*dst_slices)[length] = gpr_slice_sub(src_slices[i], j, j + 1);
+ for (j = 0; j < GRPC_SLICE_LENGTH(src_slices[i]); j++) {
+ (*dst_slices)[length] = grpc_slice_sub(src_slices[i], j, j + 1);
length++;
}
}
@@ -100,39 +100,39 @@ void grpc_split_slices(grpc_slice_split_mode mode, gpr_slice *src_slices,
}
void grpc_split_slices_to_buffer(grpc_slice_split_mode mode,
- gpr_slice *src_slices, size_t src_slice_count,
- gpr_slice_buffer *dst) {
- gpr_slice *slices;
+ grpc_slice *src_slices, size_t src_slice_count,
+ grpc_slice_buffer *dst) {
+ grpc_slice *slices;
size_t nslices;
size_t i;
grpc_split_slices(mode, src_slices, src_slice_count, &slices, &nslices);
for (i = 0; i < nslices; i++) {
/* add indexed to avoid re-merging split slices */
- gpr_slice_buffer_add_indexed(dst, slices[i]);
+ grpc_slice_buffer_add_indexed(dst, slices[i]);
}
gpr_free(slices);
}
-void grpc_split_slice_buffer(grpc_slice_split_mode mode, gpr_slice_buffer *src,
- gpr_slice_buffer *dst) {
+void grpc_split_slice_buffer(grpc_slice_split_mode mode, grpc_slice_buffer *src,
+ grpc_slice_buffer *dst) {
grpc_split_slices_to_buffer(mode, src->slices, src->count, dst);
}
-gpr_slice grpc_slice_merge(gpr_slice *slices, size_t nslices) {
+grpc_slice grpc_slice_merge(grpc_slice *slices, size_t nslices) {
uint8_t *out = NULL;
size_t length = 0;
size_t capacity = 0;
size_t i;
for (i = 0; i < nslices; i++) {
- if (GPR_SLICE_LENGTH(slices[i]) + length > capacity) {
- capacity = GPR_MAX(capacity * 2, GPR_SLICE_LENGTH(slices[i]) + length);
+ if (GRPC_SLICE_LENGTH(slices[i]) + length > capacity) {
+ capacity = GPR_MAX(capacity * 2, GRPC_SLICE_LENGTH(slices[i]) + length);
out = gpr_realloc(out, capacity);
}
- memcpy(out + length, GPR_SLICE_START_PTR(slices[i]),
- GPR_SLICE_LENGTH(slices[i]));
- length += GPR_SLICE_LENGTH(slices[i]);
+ memcpy(out + length, GRPC_SLICE_START_PTR(slices[i]),
+ GRPC_SLICE_LENGTH(slices[i]));
+ length += GRPC_SLICE_LENGTH(slices[i]);
}
- return gpr_slice_new(out, length, gpr_free);
+ return grpc_slice_new(out, length, gpr_free);
}
diff --git a/test/core/util/slice_splitter.h b/test/core/util/slice_splitter.h
index d030c2cb55..61628092b3 100644
--- a/test/core/util/slice_splitter.h
+++ b/test/core/util/slice_splitter.h
@@ -37,8 +37,8 @@
/* utility function to split/merge slices together to help create test
cases */
-#include <grpc/support/slice.h>
-#include <grpc/support/slice_buffer.h>
+#include <grpc/slice.h>
+#include <grpc/slice_buffer.h>
typedef enum {
/* merge all input slices into a single slice */
@@ -51,17 +51,17 @@ typedef enum {
/* allocates *dst_slices; caller must unref all slices in dst_slices then free
it */
-void grpc_split_slices(grpc_slice_split_mode mode, gpr_slice *src_slices,
- size_t src_slice_count, gpr_slice **dst_slices,
+void grpc_split_slices(grpc_slice_split_mode mode, grpc_slice *src_slices,
+ size_t src_slice_count, grpc_slice **dst_slices,
size_t *dst_slice_count);
void grpc_split_slices_to_buffer(grpc_slice_split_mode mode,
- gpr_slice *src_slices, size_t src_slice_count,
- gpr_slice_buffer *dst);
-void grpc_split_slice_buffer(grpc_slice_split_mode mode, gpr_slice_buffer *src,
- gpr_slice_buffer *dst);
+ grpc_slice *src_slices, size_t src_slice_count,
+ grpc_slice_buffer *dst);
+void grpc_split_slice_buffer(grpc_slice_split_mode mode, grpc_slice_buffer *src,
+ grpc_slice_buffer *dst);
-gpr_slice grpc_slice_merge(gpr_slice *slices, size_t nslices);
+grpc_slice grpc_slice_merge(grpc_slice *slices, size_t nslices);
const char *grpc_slice_split_mode_name(grpc_slice_split_mode mode);
diff --git a/test/cpp/grpclb/grpclb_api_test.cc b/test/cpp/grpclb/grpclb_api_test.cc
index e67189c69e..191d729a9e 100644
--- a/test/cpp/grpclb/grpclb_api_test.cc
+++ b/test/cpp/grpclb/grpclb_api_test.cc
@@ -71,12 +71,12 @@ TEST_F(GrpclbTest, CreateRequest) {
const grpc::string service_name = "AServiceName";
LoadBalanceRequest request;
grpc_grpclb_request* c_req = grpc_grpclb_request_create(service_name.c_str());
- gpr_slice slice = grpc_grpclb_request_encode(c_req);
- const int num_bytes_written = GPR_SLICE_LENGTH(slice);
+ grpc_slice slice = grpc_grpclb_request_encode(c_req);
+ const int num_bytes_written = GRPC_SLICE_LENGTH(slice);
EXPECT_GT(num_bytes_written, 0);
- request.ParseFromArray(GPR_SLICE_START_PTR(slice), num_bytes_written);
+ request.ParseFromArray(GRPC_SLICE_START_PTR(slice), num_bytes_written);
EXPECT_EQ(request.initial_request().name(), service_name);
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
grpc_grpclb_request_destroy(c_req);
}
@@ -88,15 +88,15 @@ TEST_F(GrpclbTest, ParseInitialResponse) {
client_stats_report_interval->set_seconds(123);
client_stats_report_interval->set_nanos(456);
const grpc::string encoded_response = response.SerializeAsString();
- gpr_slice encoded_slice =
- gpr_slice_from_copied_string(encoded_response.c_str());
+ grpc_slice encoded_slice =
+ grpc_slice_from_copied_string(encoded_response.c_str());
grpc_grpclb_initial_response* c_initial_response =
grpc_grpclb_initial_response_parse(encoded_slice);
EXPECT_FALSE(c_initial_response->has_load_balancer_delegate);
EXPECT_EQ(c_initial_response->client_stats_report_interval.seconds, 123);
EXPECT_EQ(c_initial_response->client_stats_report_interval.nanos, 456);
- gpr_slice_unref(encoded_slice);
+ grpc_slice_unref(encoded_slice);
grpc_grpclb_initial_response_destroy(c_initial_response);
}
@@ -116,7 +116,7 @@ TEST_F(GrpclbTest, ParseResponseServerList) {
expiration_interval->set_nanos(999);
const grpc::string encoded_response = response.SerializeAsString();
- const gpr_slice encoded_slice = gpr_slice_from_copied_buffer(
+ const grpc_slice encoded_slice = grpc_slice_from_copied_buffer(
encoded_response.data(), encoded_response.size());
grpc_grpclb_serverlist* c_serverlist =
grpc_grpclb_response_parse_serverlist(encoded_slice);
@@ -137,7 +137,7 @@ TEST_F(GrpclbTest, ParseResponseServerList) {
EXPECT_TRUE(c_serverlist->expiration_interval.has_nanos);
EXPECT_EQ(c_serverlist->expiration_interval.nanos, 999);
- gpr_slice_unref(encoded_slice);
+ grpc_slice_unref(encoded_slice);
grpc_grpclb_destroy_serverlist(c_serverlist);
}
diff --git a/test/cpp/grpclb/grpclb_test.cc b/test/cpp/grpclb/grpclb_test.cc
index 70d50ec2fa..175786332b 100644
--- a/test/cpp/grpclb/grpclb_test.cc
+++ b/test/cpp/grpclb/grpclb_test.cc
@@ -121,7 +121,7 @@ typedef struct test_fixture {
static void *tag(intptr_t t) { return (void *)t; }
-static gpr_slice build_response_payload_slice(
+static grpc_slice build_response_payload_slice(
const char *host, int *ports, size_t nports,
int64_t expiration_interval_secs, int32_t expiration_interval_nanos) {
// server_list {
@@ -159,7 +159,7 @@ static gpr_slice build_response_payload_slice(
server->set_load_balance_token(token_data);
}
const grpc::string &enc_resp = response.SerializeAsString();
- return gpr_slice_from_copied_buffer(enc_resp.data(), enc_resp.size());
+ return grpc_slice_from_copied_buffer(enc_resp.data(), enc_resp.size());
}
static void drain_cq(grpc_completion_queue *cq) {
@@ -221,17 +221,17 @@ static void start_lb_server(server_fixture *sf, int *ports, size_t nports,
// validate initial request.
grpc_byte_buffer_reader bbr;
grpc_byte_buffer_reader_init(&bbr, request_payload_recv);
- gpr_slice request_payload_slice = grpc_byte_buffer_reader_readall(&bbr);
+ grpc_slice request_payload_slice = grpc_byte_buffer_reader_readall(&bbr);
grpc::lb::v1::LoadBalanceRequest request;
- request.ParseFromArray(GPR_SLICE_START_PTR(request_payload_slice),
- GPR_SLICE_LENGTH(request_payload_slice));
+ request.ParseFromArray(GRPC_SLICE_START_PTR(request_payload_slice),
+ GRPC_SLICE_LENGTH(request_payload_slice));
GPR_ASSERT(request.has_initial_request());
GPR_ASSERT(request.initial_request().name() == sf->servers_hostport);
- gpr_slice_unref(request_payload_slice);
+ grpc_slice_unref(request_payload_slice);
grpc_byte_buffer_reader_destroy(&bbr);
grpc_byte_buffer_destroy(request_payload_recv);
- gpr_slice response_payload_slice;
+ grpc_slice response_payload_slice;
op = ops;
op->op = GRPC_OP_SEND_INITIAL_METADATA;
op->data.send_initial_metadata.count = 0;
@@ -275,7 +275,7 @@ static void start_lb_server(server_fixture *sf, int *ports, size_t nports,
sf->servers_hostport, i);
grpc_byte_buffer_destroy(response_payload);
- gpr_slice_unref(response_payload_slice);
+ grpc_slice_unref(response_payload_slice);
}
gpr_log(GPR_INFO, "LB Server[%s] shutting down", sf->servers_hostport);
@@ -365,7 +365,7 @@ static void start_backend_server(server_fixture *sf) {
gpr_log(GPR_INFO, "Server[%s] after tag 101", sf->servers_hostport);
bool exit = false;
- gpr_slice response_payload_slice = gpr_slice_from_copied_string(PAYLOAD);
+ grpc_slice response_payload_slice = grpc_slice_from_copied_string(PAYLOAD);
while (!exit) {
op = ops;
op->op = GRPC_OP_RECV_MESSAGE;
@@ -424,7 +424,7 @@ static void start_backend_server(server_fixture *sf) {
++sf->num_calls_serviced;
gpr_log(GPR_INFO, "Server[%s] OUT OF THE LOOP", sf->servers_hostport);
- gpr_slice_unref(response_payload_slice);
+ grpc_slice_unref(response_payload_slice);
op = ops;
op->op = GRPC_OP_SEND_STATUS_FROM_SERVER;
@@ -466,7 +466,8 @@ static void perform_request(client_fixture *cf) {
int i;
memset(ops, 0, sizeof(ops));
- gpr_slice request_payload_slice = gpr_slice_from_copied_string("hello world");
+ grpc_slice request_payload_slice =
+ grpc_slice_from_copied_string("hello world");
c = grpc_channel_create_call(cf->client, NULL, GRPC_PROPAGATE_DEFAULTS,
cf->cq, "/foo", "foo.test.google.fr:1234",
@@ -525,7 +526,7 @@ static void perform_request(client_fixture *cf) {
grpc_byte_buffer_destroy(response_payload_recv);
}
- gpr_slice_unref(request_payload_slice);
+ grpc_slice_unref(request_payload_slice);
op = ops;
op->op = GRPC_OP_SEND_CLOSE_FROM_CLIENT;
diff --git a/test/cpp/qps/client.h b/test/cpp/qps/client.h
index a8d125ad28..3a0c359b4c 100644
--- a/test/cpp/qps/client.h
+++ b/test/cpp/qps/client.h
@@ -103,7 +103,7 @@ class ClientRequestCreator<ByteBuffer> {
if (payload_config.has_bytebuf_params()) {
std::unique_ptr<char[]> buf(
new char[payload_config.bytebuf_params().req_size()]);
- gpr_slice s = gpr_slice_from_copied_buffer(
+ grpc_slice s = grpc_slice_from_copied_buffer(
buf.get(), payload_config.bytebuf_params().req_size());
Slice slice(s, Slice::STEAL_REF);
*req = ByteBuffer(&slice, 1);
diff --git a/test/cpp/qps/server_async.cc b/test/cpp/qps/server_async.cc
index f556fbdfa1..b3a06aeaf5 100644
--- a/test/cpp/qps/server_async.cc
+++ b/test/cpp/qps/server_async.cc
@@ -376,7 +376,7 @@ static Status ProcessGenericRPC(const PayloadConfig &payload_config,
ByteBuffer *response) {
int resp_size = payload_config.bytebuf_params().resp_size();
std::unique_ptr<char[]> buf(new char[resp_size]);
- gpr_slice s = gpr_slice_from_copied_buffer(buf.get(), resp_size);
+ grpc_slice s = grpc_slice_from_copied_buffer(buf.get(), resp_size);
Slice slice(s, Slice::STEAL_REF);
*response = ByteBuffer(&slice, 1);
return Status::OK;
diff --git a/test/cpp/util/byte_buffer_proto_helper.cc b/test/cpp/util/byte_buffer_proto_helper.cc
index d625d6f3f4..ab5ca261e6 100644
--- a/test/cpp/util/byte_buffer_proto_helper.cc
+++ b/test/cpp/util/byte_buffer_proto_helper.cc
@@ -51,7 +51,7 @@ std::unique_ptr<ByteBuffer> SerializeToByteBuffer(
grpc::protobuf::Message* message) {
grpc::string buf;
message->SerializeToString(&buf);
- gpr_slice s = gpr_slice_from_copied_string(buf.c_str());
+ grpc_slice s = grpc_slice_from_copied_string(buf.c_str());
Slice slice(s, Slice::STEAL_REF);
return std::unique_ptr<ByteBuffer>(new ByteBuffer(&slice, 1));
}
diff --git a/test/cpp/util/byte_buffer_test.cc b/test/cpp/util/byte_buffer_test.cc
index 2089a62011..470ce0cbf4 100644
--- a/test/cpp/util/byte_buffer_test.cc
+++ b/test/cpp/util/byte_buffer_test.cc
@@ -37,7 +37,7 @@
#include <vector>
#include <grpc++/support/slice.h>
-#include <grpc/support/slice.h>
+#include <grpc/slice.h>
#include <gtest/gtest.h>
namespace grpc {
@@ -49,14 +49,14 @@ const char* kContent2 = "yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy world";
class ByteBufferTest : public ::testing::Test {};
TEST_F(ByteBufferTest, CreateFromSingleSlice) {
- gpr_slice hello = gpr_slice_from_copied_string(kContent1);
+ grpc_slice hello = grpc_slice_from_copied_string(kContent1);
Slice s(hello, Slice::STEAL_REF);
ByteBuffer buffer(&s, 1);
}
TEST_F(ByteBufferTest, CreateFromVector) {
- gpr_slice hello = gpr_slice_from_copied_string(kContent1);
- gpr_slice world = gpr_slice_from_copied_string(kContent2);
+ grpc_slice hello = grpc_slice_from_copied_string(kContent1);
+ grpc_slice world = grpc_slice_from_copied_string(kContent2);
std::vector<Slice> slices;
slices.push_back(Slice(hello, Slice::STEAL_REF));
slices.push_back(Slice(world, Slice::STEAL_REF));
@@ -64,15 +64,15 @@ TEST_F(ByteBufferTest, CreateFromVector) {
}
TEST_F(ByteBufferTest, Clear) {
- gpr_slice hello = gpr_slice_from_copied_string(kContent1);
+ grpc_slice hello = grpc_slice_from_copied_string(kContent1);
Slice s(hello, Slice::STEAL_REF);
ByteBuffer buffer(&s, 1);
buffer.Clear();
}
TEST_F(ByteBufferTest, Length) {
- gpr_slice hello = gpr_slice_from_copied_string(kContent1);
- gpr_slice world = gpr_slice_from_copied_string(kContent2);
+ grpc_slice hello = grpc_slice_from_copied_string(kContent1);
+ grpc_slice world = grpc_slice_from_copied_string(kContent2);
std::vector<Slice> slices;
slices.push_back(Slice(hello, Slice::STEAL_REF));
slices.push_back(Slice(world, Slice::STEAL_REF));
@@ -80,12 +80,12 @@ TEST_F(ByteBufferTest, Length) {
EXPECT_EQ(strlen(kContent1) + strlen(kContent2), buffer.Length());
}
-bool SliceEqual(const Slice& a, gpr_slice b) {
- if (a.size() != GPR_SLICE_LENGTH(b)) {
+bool SliceEqual(const Slice& a, grpc_slice b) {
+ if (a.size() != GRPC_SLICE_LENGTH(b)) {
return false;
}
for (size_t i = 0; i < a.size(); i++) {
- if (a.begin()[i] != GPR_SLICE_START_PTR(b)[i]) {
+ if (a.begin()[i] != GRPC_SLICE_START_PTR(b)[i]) {
return false;
}
}
@@ -93,8 +93,8 @@ bool SliceEqual(const Slice& a, gpr_slice b) {
}
TEST_F(ByteBufferTest, Dump) {
- gpr_slice hello = gpr_slice_from_copied_string(kContent1);
- gpr_slice world = gpr_slice_from_copied_string(kContent2);
+ grpc_slice hello = grpc_slice_from_copied_string(kContent1);
+ grpc_slice world = grpc_slice_from_copied_string(kContent2);
std::vector<Slice> slices;
slices.push_back(Slice(hello, Slice::STEAL_REF));
slices.push_back(Slice(world, Slice::STEAL_REF));
@@ -106,8 +106,8 @@ TEST_F(ByteBufferTest, Dump) {
}
TEST_F(ByteBufferTest, SerializationMakesCopy) {
- gpr_slice hello = gpr_slice_from_copied_string(kContent1);
- gpr_slice world = gpr_slice_from_copied_string(kContent2);
+ grpc_slice hello = grpc_slice_from_copied_string(kContent1);
+ grpc_slice world = grpc_slice_from_copied_string(kContent2);
std::vector<Slice> slices;
slices.push_back(Slice(hello, Slice::STEAL_REF));
slices.push_back(Slice(world, Slice::STEAL_REF));
diff --git a/test/cpp/util/cli_call.cc b/test/cpp/util/cli_call.cc
index 1edffbe08e..a02a8b2ee2 100644
--- a/test/cpp/util/cli_call.cc
+++ b/test/cpp/util/cli_call.cc
@@ -41,8 +41,8 @@
#include <grpc++/generic/generic_stub.h>
#include <grpc++/support/byte_buffer.h>
#include <grpc/grpc.h>
+#include <grpc/slice.h>
#include <grpc/support/log.h>
-#include <grpc/support/slice.h>
namespace grpc {
namespace testing {
@@ -72,7 +72,7 @@ Status CliCall::Call(std::shared_ptr<grpc::Channel> channel,
cq.Next(&got_tag, &ok);
GPR_ASSERT(ok);
- gpr_slice s = gpr_slice_from_copied_string(request.c_str());
+ grpc_slice s = grpc_slice_from_copied_string(request.c_str());
grpc::Slice req_slice(s, grpc::Slice::STEAL_REF);
grpc::ByteBuffer send_buffer(&req_slice, 1);
call->Write(send_buffer, tag(2));
diff --git a/test/cpp/util/slice_test.cc b/test/cpp/util/slice_test.cc
index 45799ae157..8926fb7d5a 100644
--- a/test/cpp/util/slice_test.cc
+++ b/test/cpp/util/slice_test.cc
@@ -33,7 +33,7 @@
#include <grpc++/support/slice.h>
-#include <grpc/support/slice.h>
+#include <grpc/slice.h>
#include <gtest/gtest.h>
namespace grpc {
@@ -51,15 +51,15 @@ class SliceTest : public ::testing::Test {
};
TEST_F(SliceTest, Steal) {
- gpr_slice s = gpr_slice_from_copied_string(kContent);
+ grpc_slice s = grpc_slice_from_copied_string(kContent);
Slice spp(s, Slice::STEAL_REF);
CheckSlice(spp, kContent);
}
TEST_F(SliceTest, Add) {
- gpr_slice s = gpr_slice_from_copied_string(kContent);
+ grpc_slice s = grpc_slice_from_copied_string(kContent);
Slice spp(s, Slice::ADD_REF);
- gpr_slice_unref(s);
+ grpc_slice_unref(s);
CheckSlice(spp, kContent);
}
@@ -69,13 +69,13 @@ TEST_F(SliceTest, Empty) {
}
TEST_F(SliceTest, Cslice) {
- gpr_slice s = gpr_slice_from_copied_string(kContent);
+ grpc_slice s = grpc_slice_from_copied_string(kContent);
Slice spp(s, Slice::STEAL_REF);
CheckSlice(spp, kContent);
- gpr_slice c_slice = spp.c_slice();
- EXPECT_EQ(GPR_SLICE_START_PTR(s), GPR_SLICE_START_PTR(c_slice));
- EXPECT_EQ(GPR_SLICE_END_PTR(s), GPR_SLICE_END_PTR(c_slice));
- gpr_slice_unref(c_slice);
+ grpc_slice c_slice = spp.c_slice();
+ EXPECT_EQ(GRPC_SLICE_START_PTR(s), GRPC_SLICE_START_PTR(c_slice));
+ EXPECT_EQ(GRPC_SLICE_END_PTR(s), GRPC_SLICE_END_PTR(c_slice));
+ grpc_slice_unref(c_slice);
}
} // namespace
diff --git a/tools/codegen/core/gen_percent_encoding_tables.c b/tools/codegen/core/gen_percent_encoding_tables.c
index 93f30deeb3..347c210330 100644
--- a/tools/codegen/core/gen_percent_encoding_tables.c
+++ b/tools/codegen/core/gen_percent_encoding_tables.c
@@ -71,14 +71,14 @@ int main(void) {
legal('_');
legal('.');
legal('~');
- dump("gpr_url_percent_encoding_unreserved_bytes");
+ dump("grpc_url_percent_encoding_unreserved_bytes");
clear();
for (i = 32; i <= 126; i++) {
if (i == '%') continue;
legal(i);
}
- dump("gpr_compatible_percent_encoding_unreserved_bytes");
+ dump("grpc_compatible_percent_encoding_unreserved_bytes");
return 0;
}
diff --git a/tools/doxygen/Doxyfile.core b/tools/doxygen/Doxyfile.core
index 91abb922ea..1e748ba4a8 100644
--- a/tools/doxygen/Doxyfile.core
+++ b/tools/doxygen/Doxyfile.core
@@ -766,6 +766,8 @@ include/grpc/compression.h \
include/grpc/grpc.h \
include/grpc/grpc_posix.h \
include/grpc/grpc_security_constants.h \
+include/grpc/slice.h \
+include/grpc/slice_buffer.h \
include/grpc/status.h \
include/grpc/impl/codegen/byte_buffer_reader.h \
include/grpc/impl/codegen/compression_types.h \
@@ -799,8 +801,6 @@ include/grpc/support/host_port.h \
include/grpc/support/log.h \
include/grpc/support/log_windows.h \
include/grpc/support/port_platform.h \
-include/grpc/support/slice.h \
-include/grpc/support/slice_buffer.h \
include/grpc/support/string_util.h \
include/grpc/support/subprocess.h \
include/grpc/support/sync.h \
diff --git a/tools/doxygen/Doxyfile.core.internal b/tools/doxygen/Doxyfile.core.internal
index 793561d78f..55b8d40aca 100644
--- a/tools/doxygen/Doxyfile.core.internal
+++ b/tools/doxygen/Doxyfile.core.internal
@@ -766,6 +766,8 @@ include/grpc/compression.h \
include/grpc/grpc.h \
include/grpc/grpc_posix.h \
include/grpc/grpc_security_constants.h \
+include/grpc/slice.h \
+include/grpc/slice_buffer.h \
include/grpc/status.h \
include/grpc/impl/codegen/byte_buffer_reader.h \
include/grpc/impl/codegen/compression_types.h \
@@ -859,6 +861,8 @@ src/core/lib/json/json.h \
src/core/lib/json/json_common.h \
src/core/lib/json/json_reader.h \
src/core/lib/json/json_writer.h \
+src/core/lib/slice/percent_encoding.h \
+src/core/lib/slice/slice_string_helpers.h \
src/core/lib/surface/api_trace.h \
src/core/lib/surface/call.h \
src/core/lib/surface/call_test_only.h \
@@ -1041,6 +1045,10 @@ src/core/lib/json/json.c \
src/core/lib/json/json_reader.c \
src/core/lib/json/json_string.c \
src/core/lib/json/json_writer.c \
+src/core/lib/slice/percent_encoding.c \
+src/core/lib/slice/slice.c \
+src/core/lib/slice/slice_buffer.c \
+src/core/lib/slice/slice_string_helpers.c \
src/core/lib/surface/alarm.c \
src/core/lib/surface/api_trace.c \
src/core/lib/surface/byte_buffer.c \
@@ -1183,8 +1191,6 @@ include/grpc/support/host_port.h \
include/grpc/support/log.h \
include/grpc/support/log_windows.h \
include/grpc/support/port_platform.h \
-include/grpc/support/slice.h \
-include/grpc/support/slice_buffer.h \
include/grpc/support/string_util.h \
include/grpc/support/subprocess.h \
include/grpc/support/sync.h \
@@ -1215,7 +1221,6 @@ src/core/lib/support/block_annotate.h \
src/core/lib/support/env.h \
src/core/lib/support/mpscq.h \
src/core/lib/support/murmur_hash.h \
-src/core/lib/support/percent_encoding.h \
src/core/lib/support/stack_lockfree.h \
src/core/lib/support/string.h \
src/core/lib/support/string_windows.h \
@@ -1244,9 +1249,6 @@ src/core/lib/support/log_posix.c \
src/core/lib/support/log_windows.c \
src/core/lib/support/mpscq.c \
src/core/lib/support/murmur_hash.c \
-src/core/lib/support/percent_encoding.c \
-src/core/lib/support/slice.c \
-src/core/lib/support/slice_buffer.c \
src/core/lib/support/stack_lockfree.c \
src/core/lib/support/string.c \
src/core/lib/support/string_posix.c \
diff --git a/tools/fuzzer/runners/percent_decode_fuzzer.sh b/tools/fuzzer/runners/percent_decode_fuzzer.sh
index 5a47fa222c..d6abc18eb4 100644
--- a/tools/fuzzer/runners/percent_decode_fuzzer.sh
+++ b/tools/fuzzer/runners/percent_decode_fuzzer.sh
@@ -42,4 +42,4 @@ then
flags="-use_traces=1 $flags"
fi
-bins/$config/percent_decode_fuzzer $flags fuzzer_output test/core/support/percent_decode_corpus
+bins/$config/percent_decode_fuzzer $flags fuzzer_output test/core/slice/percent_decode_corpus
diff --git a/tools/fuzzer/runners/percent_encode_fuzzer.sh b/tools/fuzzer/runners/percent_encode_fuzzer.sh
index 8136ef8be9..eea4d191d9 100644
--- a/tools/fuzzer/runners/percent_encode_fuzzer.sh
+++ b/tools/fuzzer/runners/percent_encode_fuzzer.sh
@@ -42,4 +42,4 @@ then
flags="-use_traces=1 $flags"
fi
-bins/$config/percent_encode_fuzzer $flags fuzzer_output test/core/support/percent_encode_corpus
+bins/$config/percent_encode_fuzzer $flags fuzzer_output test/core/slice/percent_encode_corpus
diff --git a/tools/run_tests/sources_and_headers.json b/tools/run_tests/sources_and_headers.json
index 2faeed8d39..2b5147a973 100644
--- a/tools/run_tests/sources_and_headers.json
+++ b/tools/run_tests/sources_and_headers.json
@@ -739,51 +739,6 @@
"headers": [],
"is_filegroup": false,
"language": "c",
- "name": "gpr_percent_encoding_test",
- "src": [
- "test/core/support/percent_encoding_test.c"
- ],
- "third_party": false,
- "type": "target"
- },
- {
- "deps": [
- "gpr",
- "gpr_test_util"
- ],
- "headers": [],
- "is_filegroup": false,
- "language": "c",
- "name": "gpr_slice_buffer_test",
- "src": [
- "test/core/support/slice_buffer_test.c"
- ],
- "third_party": false,
- "type": "target"
- },
- {
- "deps": [
- "gpr",
- "gpr_test_util"
- ],
- "headers": [],
- "is_filegroup": false,
- "language": "c",
- "name": "gpr_slice_test",
- "src": [
- "test/core/support/slice_test.c"
- ],
- "third_party": false,
- "type": "target"
- },
- {
- "deps": [
- "gpr",
- "gpr_test_util"
- ],
- "headers": [],
- "is_filegroup": false,
- "language": "c",
"name": "gpr_stack_lockfree_test",
"src": [
"test/core/support/stack_lockfree_test.c"
@@ -1682,7 +1637,7 @@
"language": "c",
"name": "percent_decode_fuzzer",
"src": [
- "test/core/support/percent_decode_fuzzer.c"
+ "test/core/slice/percent_decode_fuzzer.c"
],
"third_party": false,
"type": "target"
@@ -1699,7 +1654,24 @@
"language": "c",
"name": "percent_encode_fuzzer",
"src": [
- "test/core/support/percent_encode_fuzzer.c"
+ "test/core/slice/percent_encode_fuzzer.c"
+ ],
+ "third_party": false,
+ "type": "target"
+ },
+ {
+ "deps": [
+ "gpr",
+ "gpr_test_util",
+ "grpc",
+ "grpc_test_util"
+ ],
+ "headers": [],
+ "is_filegroup": false,
+ "language": "c",
+ "name": "percent_encoding_test",
+ "src": [
+ "test/core/slice/percent_encoding_test.c"
],
"third_party": false,
"type": "target"
@@ -1868,6 +1840,57 @@
"headers": [],
"is_filegroup": false,
"language": "c",
+ "name": "slice_buffer_test",
+ "src": [
+ "test/core/slice/slice_buffer_test.c"
+ ],
+ "third_party": false,
+ "type": "target"
+ },
+ {
+ "deps": [
+ "gpr",
+ "gpr_test_util",
+ "grpc",
+ "grpc_test_util"
+ ],
+ "headers": [],
+ "is_filegroup": false,
+ "language": "c",
+ "name": "slice_string_helpers_test",
+ "src": [
+ "test/core/slice/slice_string_helpers_test.c"
+ ],
+ "third_party": false,
+ "type": "target"
+ },
+ {
+ "deps": [
+ "gpr",
+ "gpr_test_util",
+ "grpc",
+ "grpc_test_util"
+ ],
+ "headers": [],
+ "is_filegroup": false,
+ "language": "c",
+ "name": "slice_test",
+ "src": [
+ "test/core/slice/slice_test.c"
+ ],
+ "third_party": false,
+ "type": "target"
+ },
+ {
+ "deps": [
+ "gpr",
+ "gpr_test_util",
+ "grpc",
+ "grpc_test_util"
+ ],
+ "headers": [],
+ "is_filegroup": false,
+ "language": "c",
"name": "sockaddr_resolver_test",
"src": [
"test/core/client_channel/resolvers/sockaddr_resolver_test.c"
@@ -4757,7 +4780,7 @@
"language": "c",
"name": "percent_decode_fuzzer_one_entry",
"src": [
- "test/core/support/percent_decode_fuzzer.c",
+ "test/core/slice/percent_decode_fuzzer.c",
"test/core/util/one_corpus_entry_fuzzer.c"
],
"third_party": false,
@@ -4775,7 +4798,7 @@
"language": "c",
"name": "percent_encode_fuzzer_one_entry",
"src": [
- "test/core/support/percent_encode_fuzzer.c",
+ "test/core/slice/percent_encode_fuzzer.c",
"test/core/util/one_corpus_entry_fuzzer.c"
],
"third_party": false,
@@ -6407,8 +6430,6 @@
"include/grpc/support/log.h",
"include/grpc/support/log_windows.h",
"include/grpc/support/port_platform.h",
- "include/grpc/support/slice.h",
- "include/grpc/support/slice_buffer.h",
"include/grpc/support/string_util.h",
"include/grpc/support/subprocess.h",
"include/grpc/support/sync.h",
@@ -6428,7 +6449,6 @@
"src/core/lib/support/env.h",
"src/core/lib/support/mpscq.h",
"src/core/lib/support/murmur_hash.h",
- "src/core/lib/support/percent_encoding.h",
"src/core/lib/support/stack_lockfree.h",
"src/core/lib/support/string.h",
"src/core/lib/support/string_windows.h",
@@ -6453,8 +6473,6 @@
"include/grpc/support/log.h",
"include/grpc/support/log_windows.h",
"include/grpc/support/port_platform.h",
- "include/grpc/support/slice.h",
- "include/grpc/support/slice_buffer.h",
"include/grpc/support/string_util.h",
"include/grpc/support/subprocess.h",
"include/grpc/support/sync.h",
@@ -6496,10 +6514,6 @@
"src/core/lib/support/mpscq.h",
"src/core/lib/support/murmur_hash.c",
"src/core/lib/support/murmur_hash.h",
- "src/core/lib/support/percent_encoding.c",
- "src/core/lib/support/percent_encoding.h",
- "src/core/lib/support/slice.c",
- "src/core/lib/support/slice_buffer.c",
"src/core/lib/support/stack_lockfree.c",
"src/core/lib/support/stack_lockfree.h",
"src/core/lib/support/string.c",
@@ -6578,6 +6592,8 @@
"include/grpc/grpc.h",
"include/grpc/grpc_posix.h",
"include/grpc/grpc_security_constants.h",
+ "include/grpc/slice.h",
+ "include/grpc/slice_buffer.h",
"include/grpc/status.h",
"src/core/lib/channel/channel_args.h",
"src/core/lib/channel/channel_stack.h",
@@ -6652,6 +6668,8 @@
"src/core/lib/json/json_common.h",
"src/core/lib/json/json_reader.h",
"src/core/lib/json/json_writer.h",
+ "src/core/lib/slice/percent_encoding.h",
+ "src/core/lib/slice/slice_string_helpers.h",
"src/core/lib/surface/api_trace.h",
"src/core/lib/surface/call.h",
"src/core/lib/surface/call_test_only.h",
@@ -6685,6 +6703,8 @@
"include/grpc/grpc.h",
"include/grpc/grpc_posix.h",
"include/grpc/grpc_security_constants.h",
+ "include/grpc/slice.h",
+ "include/grpc/slice_buffer.h",
"include/grpc/status.h",
"src/core/lib/channel/channel_args.c",
"src/core/lib/channel/channel_args.h",
@@ -6838,6 +6858,12 @@
"src/core/lib/json/json_string.c",
"src/core/lib/json/json_writer.c",
"src/core/lib/json/json_writer.h",
+ "src/core/lib/slice/percent_encoding.c",
+ "src/core/lib/slice/percent_encoding.h",
+ "src/core/lib/slice/slice.c",
+ "src/core/lib/slice/slice_buffer.c",
+ "src/core/lib/slice/slice_string_helpers.c",
+ "src/core/lib/slice/slice_string_helpers.h",
"src/core/lib/surface/alarm.c",
"src/core/lib/surface/api_trace.c",
"src/core/lib/surface/api_trace.h",
diff --git a/tools/run_tests/tests.json b/tools/run_tests/tests.json
index 87a965409f..3a9b711130 100644
--- a/tools/run_tests/tests.json
+++ b/tools/run_tests/tests.json
@@ -845,72 +845,6 @@
"posix",
"windows"
],
- "cpu_cost": 1.0,
- "exclude_configs": [],
- "exclude_iomgrs": [],
- "flaky": false,
- "gtest": false,
- "language": "c",
- "name": "gpr_percent_encoding_test",
- "platforms": [
- "linux",
- "mac",
- "posix",
- "windows"
- ]
- },
- {
- "args": [],
- "ci_platforms": [
- "linux",
- "mac",
- "posix",
- "windows"
- ],
- "cpu_cost": 1.0,
- "exclude_configs": [],
- "exclude_iomgrs": [],
- "flaky": false,
- "gtest": false,
- "language": "c",
- "name": "gpr_slice_buffer_test",
- "platforms": [
- "linux",
- "mac",
- "posix",
- "windows"
- ]
- },
- {
- "args": [],
- "ci_platforms": [
- "linux",
- "mac",
- "posix",
- "windows"
- ],
- "cpu_cost": 1.0,
- "exclude_configs": [],
- "exclude_iomgrs": [],
- "flaky": false,
- "gtest": false,
- "language": "c",
- "name": "gpr_slice_test",
- "platforms": [
- "linux",
- "mac",
- "posix",
- "windows"
- ]
- },
- {
- "args": [],
- "ci_platforms": [
- "linux",
- "mac",
- "posix",
- "windows"
- ],
"cpu_cost": 7,
"exclude_configs": [],
"exclude_iomgrs": [],
@@ -1751,6 +1685,28 @@
],
"cpu_cost": 1.0,
"exclude_configs": [],
+ "exclude_iomgrs": [],
+ "flaky": false,
+ "gtest": false,
+ "language": "c",
+ "name": "percent_encoding_test",
+ "platforms": [
+ "linux",
+ "mac",
+ "posix",
+ "windows"
+ ]
+ },
+ {
+ "args": [],
+ "ci_platforms": [
+ "linux",
+ "mac",
+ "posix",
+ "windows"
+ ],
+ "cpu_cost": 1.0,
+ "exclude_configs": [],
"exclude_iomgrs": [
"uv"
],
@@ -1939,6 +1895,72 @@
"flaky": false,
"gtest": false,
"language": "c",
+ "name": "slice_buffer_test",
+ "platforms": [
+ "linux",
+ "mac",
+ "posix",
+ "windows"
+ ]
+ },
+ {
+ "args": [],
+ "ci_platforms": [
+ "linux",
+ "mac",
+ "posix",
+ "windows"
+ ],
+ "cpu_cost": 1.0,
+ "exclude_configs": [],
+ "exclude_iomgrs": [],
+ "flaky": false,
+ "gtest": false,
+ "language": "c",
+ "name": "slice_string_helpers_test",
+ "platforms": [
+ "linux",
+ "mac",
+ "posix",
+ "windows"
+ ]
+ },
+ {
+ "args": [],
+ "ci_platforms": [
+ "linux",
+ "mac",
+ "posix",
+ "windows"
+ ],
+ "cpu_cost": 1.0,
+ "exclude_configs": [],
+ "exclude_iomgrs": [],
+ "flaky": false,
+ "gtest": false,
+ "language": "c",
+ "name": "slice_test",
+ "platforms": [
+ "linux",
+ "mac",
+ "posix",
+ "windows"
+ ]
+ },
+ {
+ "args": [],
+ "ci_platforms": [
+ "linux",
+ "mac",
+ "posix",
+ "windows"
+ ],
+ "cpu_cost": 1.0,
+ "exclude_configs": [],
+ "exclude_iomgrs": [],
+ "flaky": false,
+ "gtest": false,
+ "language": "c",
"name": "sockaddr_resolver_test",
"platforms": [
"linux",
@@ -118353,7 +118375,7 @@
},
{
"args": [
- "test/core/support/percent_decode_corpus/04cb8ccc553f9b2f5e52c421aff6d1c954d3dae6"
+ "test/core/slice/percent_decode_corpus/04cb8ccc553f9b2f5e52c421aff6d1c954d3dae6"
],
"ci_platforms": [
"linux"
@@ -118375,7 +118397,7 @@
},
{
"args": [
- "test/core/support/percent_decode_corpus/0dd8f3a63745b3a2d39791559b5c1b311447b537"
+ "test/core/slice/percent_decode_corpus/0dd8f3a63745b3a2d39791559b5c1b311447b537"
],
"ci_platforms": [
"linux"
@@ -118397,7 +118419,7 @@
},
{
"args": [
- "test/core/support/percent_decode_corpus/17eeaca784409adbe43365c32ac87915d736bba3"
+ "test/core/slice/percent_decode_corpus/17eeaca784409adbe43365c32ac87915d736bba3"
],
"ci_platforms": [
"linux"
@@ -118419,7 +118441,7 @@
},
{
"args": [
- "test/core/support/percent_decode_corpus/2040c1ff65f52a7ae668c2c8f324de5dacc9d695"
+ "test/core/slice/percent_decode_corpus/2040c1ff65f52a7ae668c2c8f324de5dacc9d695"
],
"ci_platforms": [
"linux"
@@ -118441,7 +118463,7 @@
},
{
"args": [
- "test/core/support/percent_decode_corpus/26b0d1da23027ae54db96e125e4a9e98842d77fb"
+ "test/core/slice/percent_decode_corpus/26b0d1da23027ae54db96e125e4a9e98842d77fb"
],
"ci_platforms": [
"linux"
@@ -118463,7 +118485,7 @@
},
{
"args": [
- "test/core/support/percent_decode_corpus/2a089c0db45acdb4c6ed8e7ff81ca7235792c0b9"
+ "test/core/slice/percent_decode_corpus/2a089c0db45acdb4c6ed8e7ff81ca7235792c0b9"
],
"ci_platforms": [
"linux"
@@ -118485,7 +118507,7 @@
},
{
"args": [
- "test/core/support/percent_decode_corpus/35b7b3bc3a740d5c3abca0d75b53f0e1e1ee998a"
+ "test/core/slice/percent_decode_corpus/35b7b3bc3a740d5c3abca0d75b53f0e1e1ee998a"
],
"ci_platforms": [
"linux"
@@ -118507,7 +118529,7 @@
},
{
"args": [
- "test/core/support/percent_decode_corpus/36367ba1adba47a1cbc3a88707fde8cc7abdc248"
+ "test/core/slice/percent_decode_corpus/36367ba1adba47a1cbc3a88707fde8cc7abdc248"
],
"ci_platforms": [
"linux"
@@ -118529,7 +118551,7 @@
},
{
"args": [
- "test/core/support/percent_decode_corpus/39c2ba51548a0beaf0d6d1164531f1447dc311b5"
+ "test/core/slice/percent_decode_corpus/39c2ba51548a0beaf0d6d1164531f1447dc311b5"
],
"ci_platforms": [
"linux"
@@ -118551,7 +118573,7 @@
},
{
"args": [
- "test/core/support/percent_decode_corpus/56d08fea787c041395c6697ce26cfbc0decbe688"
+ "test/core/slice/percent_decode_corpus/56d08fea787c041395c6697ce26cfbc0decbe688"
],
"ci_platforms": [
"linux"
@@ -118573,7 +118595,7 @@
},
{
"args": [
- "test/core/support/percent_decode_corpus/678d981fdabb9f0d6640235cf1719dd1e1e66ae9"
+ "test/core/slice/percent_decode_corpus/678d981fdabb9f0d6640235cf1719dd1e1e66ae9"
],
"ci_platforms": [
"linux"
@@ -118595,7 +118617,7 @@
},
{
"args": [
- "test/core/support/percent_decode_corpus/68751961609ec010565de0aa87521dcbf0722c5d"
+ "test/core/slice/percent_decode_corpus/68751961609ec010565de0aa87521dcbf0722c5d"
],
"ci_platforms": [
"linux"
@@ -118617,7 +118639,7 @@
},
{
"args": [
- "test/core/support/percent_decode_corpus/7875c06c6f03c9aa2f8e9c59f8d8957c8a32e759"
+ "test/core/slice/percent_decode_corpus/7875c06c6f03c9aa2f8e9c59f8d8957c8a32e759"
],
"ci_platforms": [
"linux"
@@ -118639,7 +118661,7 @@
},
{
"args": [
- "test/core/support/percent_decode_corpus/7b302090e090a5829b6d1dd7be30bd4e36a7e60f"
+ "test/core/slice/percent_decode_corpus/7b302090e090a5829b6d1dd7be30bd4e36a7e60f"
],
"ci_platforms": [
"linux"
@@ -118661,7 +118683,7 @@
},
{
"args": [
- "test/core/support/percent_decode_corpus/875e1022169c9e4c541a9ad894e69e989df22ba1"
+ "test/core/slice/percent_decode_corpus/875e1022169c9e4c541a9ad894e69e989df22ba1"
],
"ci_platforms": [
"linux"
@@ -118683,7 +118705,7 @@
},
{
"args": [
- "test/core/support/percent_decode_corpus/8c1051ce066f5a26de9a9d133180621d0da957b4"
+ "test/core/slice/percent_decode_corpus/8c1051ce066f5a26de9a9d133180621d0da957b4"
],
"ci_platforms": [
"linux"
@@ -118705,7 +118727,7 @@
},
{
"args": [
- "test/core/support/percent_decode_corpus/8e084e628ab83a18ac7ca7cb3506525263655c63"
+ "test/core/slice/percent_decode_corpus/8e084e628ab83a18ac7ca7cb3506525263655c63"
],
"ci_platforms": [
"linux"
@@ -118727,7 +118749,7 @@
},
{
"args": [
- "test/core/support/percent_decode_corpus/9d316c4675f40ddccaf8f1cc7aea94170b1e4223"
+ "test/core/slice/percent_decode_corpus/9d316c4675f40ddccaf8f1cc7aea94170b1e4223"
],
"ci_platforms": [
"linux"
@@ -118749,7 +118771,7 @@
},
{
"args": [
- "test/core/support/percent_decode_corpus/ad1c7c11d18a7d116e2c2ef4d4c5afb1270836ae"
+ "test/core/slice/percent_decode_corpus/ad1c7c11d18a7d116e2c2ef4d4c5afb1270836ae"
],
"ci_platforms": [
"linux"
@@ -118771,7 +118793,7 @@
},
{
"args": [
- "test/core/support/percent_decode_corpus/b471f94aa4facf502e622e4a248f1ba4063ae681"
+ "test/core/slice/percent_decode_corpus/b471f94aa4facf502e622e4a248f1ba4063ae681"
],
"ci_platforms": [
"linux"
@@ -118793,7 +118815,7 @@
},
{
"args": [
- "test/core/support/percent_decode_corpus/bf52ece030f16136d46e0dc97f58d60a0d8a1f0b"
+ "test/core/slice/percent_decode_corpus/bf52ece030f16136d46e0dc97f58d60a0d8a1f0b"
],
"ci_platforms": [
"linux"
@@ -118815,7 +118837,7 @@
},
{
"args": [
- "test/core/support/percent_decode_corpus/d5b2a7177339ba2b7ce2f60e5f4459bef1e72758"
+ "test/core/slice/percent_decode_corpus/d5b2a7177339ba2b7ce2f60e5f4459bef1e72758"
],
"ci_platforms": [
"linux"
@@ -118837,7 +118859,7 @@
},
{
"args": [
- "test/core/support/percent_decode_corpus/de867b64c54a7ed773dc611fc5cd2f17c5433113"
+ "test/core/slice/percent_decode_corpus/de867b64c54a7ed773dc611fc5cd2f17c5433113"
],
"ci_platforms": [
"linux"
@@ -118859,7 +118881,7 @@
},
{
"args": [
- "test/core/support/percent_decode_corpus/e3948dbe004950591630dd5c52f4e0fcbd5e388a"
+ "test/core/slice/percent_decode_corpus/e3948dbe004950591630dd5c52f4e0fcbd5e388a"
],
"ci_platforms": [
"linux"
@@ -118881,7 +118903,7 @@
},
{
"args": [
- "test/core/support/percent_decode_corpus/e7064f0b80f61dbc65915311032d27baa569ae2a"
+ "test/core/slice/percent_decode_corpus/e7064f0b80f61dbc65915311032d27baa569ae2a"
],
"ci_platforms": [
"linux"
@@ -118903,7 +118925,7 @@
},
{
"args": [
- "test/core/support/percent_decode_corpus/xyz"
+ "test/core/slice/percent_decode_corpus/xyz"
],
"ci_platforms": [
"linux"
@@ -118925,7 +118947,7 @@
},
{
"args": [
- "test/core/support/percent_encode_corpus/0d3ee7fa54e6c66103965fd4409b044ba7db6c3f"
+ "test/core/slice/percent_encode_corpus/0d3ee7fa54e6c66103965fd4409b044ba7db6c3f"
],
"ci_platforms": [
"linux"
@@ -118947,7 +118969,7 @@
},
{
"args": [
- "test/core/support/percent_encode_corpus/2e7ccf75e27b9501e3b28cf1c50ed0c45ab7c226"
+ "test/core/slice/percent_encode_corpus/2e7ccf75e27b9501e3b28cf1c50ed0c45ab7c226"
],
"ci_platforms": [
"linux"
@@ -118969,7 +118991,7 @@
},
{
"args": [
- "test/core/support/percent_encode_corpus/55bb859f3942c462b03b7cbcf22ab4a0ac9705cf"
+ "test/core/slice/percent_encode_corpus/55bb859f3942c462b03b7cbcf22ab4a0ac9705cf"
],
"ci_platforms": [
"linux"
@@ -118991,7 +119013,7 @@
},
{
"args": [
- "test/core/support/percent_encode_corpus/56070cecd54c845b6d4334953b17b712eb000d93"
+ "test/core/slice/percent_encode_corpus/56070cecd54c845b6d4334953b17b712eb000d93"
],
"ci_platforms": [
"linux"
@@ -119013,7 +119035,7 @@
},
{
"args": [
- "test/core/support/percent_encode_corpus/61f50e891bf7ff5eb7a7af206f1e25d77f8756e7"
+ "test/core/slice/percent_encode_corpus/61f50e891bf7ff5eb7a7af206f1e25d77f8756e7"
],
"ci_platforms": [
"linux"
@@ -119035,7 +119057,7 @@
},
{
"args": [
- "test/core/support/percent_encode_corpus/6e0c60cefc704c7940e475a87dd9ae423061cb5a"
+ "test/core/slice/percent_encode_corpus/6e0c60cefc704c7940e475a87dd9ae423061cb5a"
],
"ci_platforms": [
"linux"
@@ -119057,7 +119079,7 @@
},
{
"args": [
- "test/core/support/percent_encode_corpus/7271ebcc6d22a0f186f7bc3c1973a7ed1bec8d8e"
+ "test/core/slice/percent_encode_corpus/7271ebcc6d22a0f186f7bc3c1973a7ed1bec8d8e"
],
"ci_platforms": [
"linux"
@@ -119079,7 +119101,7 @@
},
{
"args": [
- "test/core/support/percent_encode_corpus/74c83ece3e2920a67593a9be9c82468f16cbb969"
+ "test/core/slice/percent_encode_corpus/74c83ece3e2920a67593a9be9c82468f16cbb969"
],
"ci_platforms": [
"linux"
@@ -119101,7 +119123,7 @@
},
{
"args": [
- "test/core/support/percent_encode_corpus/98e004fd2a9f141a7a019720820080e12d637c06"
+ "test/core/slice/percent_encode_corpus/98e004fd2a9f141a7a019720820080e12d637c06"
],
"ci_platforms": [
"linux"
@@ -119123,7 +119145,7 @@
},
{
"args": [
- "test/core/support/percent_encode_corpus/ba2c1e98227aa21ea3bb2ca4d0e504119717da8b"
+ "test/core/slice/percent_encode_corpus/ba2c1e98227aa21ea3bb2ca4d0e504119717da8b"
],
"ci_platforms": [
"linux"
@@ -119145,7 +119167,7 @@
},
{
"args": [
- "test/core/support/percent_encode_corpus/c16b9fd45370d4afb5d3ebd307a6e263c25ffd45"
+ "test/core/slice/percent_encode_corpus/c16b9fd45370d4afb5d3ebd307a6e263c25ffd45"
],
"ci_platforms": [
"linux"
@@ -119167,7 +119189,7 @@
},
{
"args": [
- "test/core/support/percent_encode_corpus/d58c3cd4eab9b6d2343abfa1c25c90a383fe0ec3"
+ "test/core/slice/percent_encode_corpus/d58c3cd4eab9b6d2343abfa1c25c90a383fe0ec3"
],
"ci_platforms": [
"linux"
@@ -119189,7 +119211,7 @@
},
{
"args": [
- "test/core/support/percent_encode_corpus/e2619218ede30d2b7b8ecd601a9f0ae754b728b4"
+ "test/core/slice/percent_encode_corpus/e2619218ede30d2b7b8ecd601a9f0ae754b728b4"
],
"ci_platforms": [
"linux"
@@ -119211,7 +119233,7 @@
},
{
"args": [
- "test/core/support/percent_encode_corpus/f93b3653e453f0e3eea3198001be6ce46e64bd21"
+ "test/core/slice/percent_encode_corpus/f93b3653e453f0e3eea3198001be6ce46e64bd21"
],
"ci_platforms": [
"linux"
@@ -119233,7 +119255,7 @@
},
{
"args": [
- "test/core/support/percent_encode_corpus/fd41d029c7682ad3d1c40a9fd017a4c85b673a54"
+ "test/core/slice/percent_encode_corpus/fd41d029c7682ad3d1c40a9fd017a4c85b673a54"
],
"ci_platforms": [
"linux"
@@ -119255,7 +119277,7 @@
},
{
"args": [
- "test/core/support/percent_encode_corpus/xyz"
+ "test/core/slice/percent_encode_corpus/xyz"
],
"ci_platforms": [
"linux"
diff --git a/vsprojects/buildtests_c.sln b/vsprojects/buildtests_c.sln
index ad5c8f2640..d08a47aa86 100644
--- a/vsprojects/buildtests_c.sln
+++ b/vsprojects/buildtests_c.sln
@@ -424,33 +424,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gpr_mpscq_test", "vcxproj\t
{B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}
EndProjectSection
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gpr_percent_encoding_test", "vcxproj\test\gpr_percent_encoding_test\gpr_percent_encoding_test.vcxproj", "{8313AE17-FCFA-8110-95C7-7AF2F814D188}"
- ProjectSection(myProperties) = preProject
- lib = "False"
- EndProjectSection
- ProjectSection(ProjectDependencies) = postProject
- {EAB0A629-17A9-44DB-B5FF-E91A721FE037} = {EAB0A629-17A9-44DB-B5FF-E91A721FE037}
- {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gpr_slice_buffer_test", "vcxproj\test\gpr_slice_buffer_test\gpr_slice_buffer_test.vcxproj", "{E679773D-DE89-AEBB-9787-59019989B825}"
- ProjectSection(myProperties) = preProject
- lib = "False"
- EndProjectSection
- ProjectSection(ProjectDependencies) = postProject
- {EAB0A629-17A9-44DB-B5FF-E91A721FE037} = {EAB0A629-17A9-44DB-B5FF-E91A721FE037}
- {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gpr_slice_test", "vcxproj\test\gpr_slice_test\gpr_slice_test.vcxproj", "{7F2D1623-AF04-DD98-BCE6-61ADB9A52366}"
- ProjectSection(myProperties) = preProject
- lib = "False"
- EndProjectSection
- ProjectSection(ProjectDependencies) = postProject
- {EAB0A629-17A9-44DB-B5FF-E91A721FE037} = {EAB0A629-17A9-44DB-B5FF-E91A721FE037}
- {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}
- EndProjectSection
-EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gpr_stack_lockfree_test", "vcxproj\test\gpr_stack_lockfree_test\gpr_stack_lockfree_test.vcxproj", "{AD06B5CD-8D5C-A365-C46B-3CF32237A4F7}"
ProjectSection(myProperties) = preProject
lib = "False"
@@ -1282,6 +1255,17 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "no_server_test", "vcxproj\t
{B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}
EndProjectSection
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "percent_encoding_test", "vcxproj\test\percent_encoding_test\percent_encoding_test.vcxproj", "{CCFC6A58-623D-9013-BFEB-C809809E2429}"
+ ProjectSection(myProperties) = preProject
+ lib = "False"
+ EndProjectSection
+ ProjectSection(ProjectDependencies) = postProject
+ {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B} = {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}
+ {29D16885-7228-4C31-81ED-5F9187C7F2A9} = {29D16885-7228-4C31-81ED-5F9187C7F2A9}
+ {EAB0A629-17A9-44DB-B5FF-E91A721FE037} = {EAB0A629-17A9-44DB-B5FF-E91A721FE037}
+ {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}
+ EndProjectSection
+EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "resolve_address_test", "vcxproj\test\resolve_address_test\resolve_address_test.vcxproj", "{8279AF6C-9584-67F3-1547-B204864FCCA7}"
ProjectSection(myProperties) = preProject
lib = "False"
@@ -1395,6 +1379,39 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "simple_request_bad_client_t
{B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}
EndProjectSection
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "slice_buffer_test", "vcxproj\test\slice_buffer_test\slice_buffer_test.vcxproj", "{F0FA4A41-5695-580A-DCDA-EC719CB041B0}"
+ ProjectSection(myProperties) = preProject
+ lib = "False"
+ EndProjectSection
+ ProjectSection(ProjectDependencies) = postProject
+ {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B} = {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}
+ {29D16885-7228-4C31-81ED-5F9187C7F2A9} = {29D16885-7228-4C31-81ED-5F9187C7F2A9}
+ {EAB0A629-17A9-44DB-B5FF-E91A721FE037} = {EAB0A629-17A9-44DB-B5FF-E91A721FE037}
+ {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "slice_string_helpers_test", "vcxproj\test\slice_string_helpers_test\slice_string_helpers_test.vcxproj", "{419167BB-C3F5-DDEA-403A-394D1902DE65}"
+ ProjectSection(myProperties) = preProject
+ lib = "False"
+ EndProjectSection
+ ProjectSection(ProjectDependencies) = postProject
+ {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B} = {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}
+ {29D16885-7228-4C31-81ED-5F9187C7F2A9} = {29D16885-7228-4C31-81ED-5F9187C7F2A9}
+ {EAB0A629-17A9-44DB-B5FF-E91A721FE037} = {EAB0A629-17A9-44DB-B5FF-E91A721FE037}
+ {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "slice_test", "vcxproj\test\slice_test\slice_test.vcxproj", "{D6DC2CF8-F263-49B1-DE13-D44D94BCF337}"
+ ProjectSection(myProperties) = preProject
+ lib = "False"
+ EndProjectSection
+ ProjectSection(ProjectDependencies) = postProject
+ {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B} = {17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}
+ {29D16885-7228-4C31-81ED-5F9187C7F2A9} = {29D16885-7228-4C31-81ED-5F9187C7F2A9}
+ {EAB0A629-17A9-44DB-B5FF-E91A721FE037} = {EAB0A629-17A9-44DB-B5FF-E91A721FE037}
+ {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792} = {B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}
+ EndProjectSection
+EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sockaddr_resolver_test", "vcxproj\test\sockaddr_resolver_test\sockaddr_resolver_test.vcxproj", "{9889A80C-F1D7-99C9-FE7E-657724BEDC62}"
ProjectSection(myProperties) = preProject
lib = "False"
@@ -2224,54 +2241,6 @@ Global
{B3D7760B-8BEA-2EF6-F1D4-9F9020E166D6}.Release-DLL|Win32.Build.0 = Release|Win32
{B3D7760B-8BEA-2EF6-F1D4-9F9020E166D6}.Release-DLL|x64.ActiveCfg = Release|x64
{B3D7760B-8BEA-2EF6-F1D4-9F9020E166D6}.Release-DLL|x64.Build.0 = Release|x64
- {8313AE17-FCFA-8110-95C7-7AF2F814D188}.Debug|Win32.ActiveCfg = Debug|Win32
- {8313AE17-FCFA-8110-95C7-7AF2F814D188}.Debug|x64.ActiveCfg = Debug|x64
- {8313AE17-FCFA-8110-95C7-7AF2F814D188}.Release|Win32.ActiveCfg = Release|Win32
- {8313AE17-FCFA-8110-95C7-7AF2F814D188}.Release|x64.ActiveCfg = Release|x64
- {8313AE17-FCFA-8110-95C7-7AF2F814D188}.Debug|Win32.Build.0 = Debug|Win32
- {8313AE17-FCFA-8110-95C7-7AF2F814D188}.Debug|x64.Build.0 = Debug|x64
- {8313AE17-FCFA-8110-95C7-7AF2F814D188}.Release|Win32.Build.0 = Release|Win32
- {8313AE17-FCFA-8110-95C7-7AF2F814D188}.Release|x64.Build.0 = Release|x64
- {8313AE17-FCFA-8110-95C7-7AF2F814D188}.Debug-DLL|Win32.ActiveCfg = Debug|Win32
- {8313AE17-FCFA-8110-95C7-7AF2F814D188}.Debug-DLL|Win32.Build.0 = Debug|Win32
- {8313AE17-FCFA-8110-95C7-7AF2F814D188}.Debug-DLL|x64.ActiveCfg = Debug|x64
- {8313AE17-FCFA-8110-95C7-7AF2F814D188}.Debug-DLL|x64.Build.0 = Debug|x64
- {8313AE17-FCFA-8110-95C7-7AF2F814D188}.Release-DLL|Win32.ActiveCfg = Release|Win32
- {8313AE17-FCFA-8110-95C7-7AF2F814D188}.Release-DLL|Win32.Build.0 = Release|Win32
- {8313AE17-FCFA-8110-95C7-7AF2F814D188}.Release-DLL|x64.ActiveCfg = Release|x64
- {8313AE17-FCFA-8110-95C7-7AF2F814D188}.Release-DLL|x64.Build.0 = Release|x64
- {E679773D-DE89-AEBB-9787-59019989B825}.Debug|Win32.ActiveCfg = Debug|Win32
- {E679773D-DE89-AEBB-9787-59019989B825}.Debug|x64.ActiveCfg = Debug|x64
- {E679773D-DE89-AEBB-9787-59019989B825}.Release|Win32.ActiveCfg = Release|Win32
- {E679773D-DE89-AEBB-9787-59019989B825}.Release|x64.ActiveCfg = Release|x64
- {E679773D-DE89-AEBB-9787-59019989B825}.Debug|Win32.Build.0 = Debug|Win32
- {E679773D-DE89-AEBB-9787-59019989B825}.Debug|x64.Build.0 = Debug|x64
- {E679773D-DE89-AEBB-9787-59019989B825}.Release|Win32.Build.0 = Release|Win32
- {E679773D-DE89-AEBB-9787-59019989B825}.Release|x64.Build.0 = Release|x64
- {E679773D-DE89-AEBB-9787-59019989B825}.Debug-DLL|Win32.ActiveCfg = Debug|Win32
- {E679773D-DE89-AEBB-9787-59019989B825}.Debug-DLL|Win32.Build.0 = Debug|Win32
- {E679773D-DE89-AEBB-9787-59019989B825}.Debug-DLL|x64.ActiveCfg = Debug|x64
- {E679773D-DE89-AEBB-9787-59019989B825}.Debug-DLL|x64.Build.0 = Debug|x64
- {E679773D-DE89-AEBB-9787-59019989B825}.Release-DLL|Win32.ActiveCfg = Release|Win32
- {E679773D-DE89-AEBB-9787-59019989B825}.Release-DLL|Win32.Build.0 = Release|Win32
- {E679773D-DE89-AEBB-9787-59019989B825}.Release-DLL|x64.ActiveCfg = Release|x64
- {E679773D-DE89-AEBB-9787-59019989B825}.Release-DLL|x64.Build.0 = Release|x64
- {7F2D1623-AF04-DD98-BCE6-61ADB9A52366}.Debug|Win32.ActiveCfg = Debug|Win32
- {7F2D1623-AF04-DD98-BCE6-61ADB9A52366}.Debug|x64.ActiveCfg = Debug|x64
- {7F2D1623-AF04-DD98-BCE6-61ADB9A52366}.Release|Win32.ActiveCfg = Release|Win32
- {7F2D1623-AF04-DD98-BCE6-61ADB9A52366}.Release|x64.ActiveCfg = Release|x64
- {7F2D1623-AF04-DD98-BCE6-61ADB9A52366}.Debug|Win32.Build.0 = Debug|Win32
- {7F2D1623-AF04-DD98-BCE6-61ADB9A52366}.Debug|x64.Build.0 = Debug|x64
- {7F2D1623-AF04-DD98-BCE6-61ADB9A52366}.Release|Win32.Build.0 = Release|Win32
- {7F2D1623-AF04-DD98-BCE6-61ADB9A52366}.Release|x64.Build.0 = Release|x64
- {7F2D1623-AF04-DD98-BCE6-61ADB9A52366}.Debug-DLL|Win32.ActiveCfg = Debug|Win32
- {7F2D1623-AF04-DD98-BCE6-61ADB9A52366}.Debug-DLL|Win32.Build.0 = Debug|Win32
- {7F2D1623-AF04-DD98-BCE6-61ADB9A52366}.Debug-DLL|x64.ActiveCfg = Debug|x64
- {7F2D1623-AF04-DD98-BCE6-61ADB9A52366}.Debug-DLL|x64.Build.0 = Debug|x64
- {7F2D1623-AF04-DD98-BCE6-61ADB9A52366}.Release-DLL|Win32.ActiveCfg = Release|Win32
- {7F2D1623-AF04-DD98-BCE6-61ADB9A52366}.Release-DLL|Win32.Build.0 = Release|Win32
- {7F2D1623-AF04-DD98-BCE6-61ADB9A52366}.Release-DLL|x64.ActiveCfg = Release|x64
- {7F2D1623-AF04-DD98-BCE6-61ADB9A52366}.Release-DLL|x64.Build.0 = Release|x64
{AD06B5CD-8D5C-A365-C46B-3CF32237A4F7}.Debug|Win32.ActiveCfg = Debug|Win32
{AD06B5CD-8D5C-A365-C46B-3CF32237A4F7}.Debug|x64.ActiveCfg = Debug|x64
{AD06B5CD-8D5C-A365-C46B-3CF32237A4F7}.Release|Win32.ActiveCfg = Release|Win32
@@ -3488,6 +3457,22 @@ Global
{A66AC548-E2B9-74CD-293C-43526EE51DCE}.Release-DLL|Win32.Build.0 = Release|Win32
{A66AC548-E2B9-74CD-293C-43526EE51DCE}.Release-DLL|x64.ActiveCfg = Release|x64
{A66AC548-E2B9-74CD-293C-43526EE51DCE}.Release-DLL|x64.Build.0 = Release|x64
+ {CCFC6A58-623D-9013-BFEB-C809809E2429}.Debug|Win32.ActiveCfg = Debug|Win32
+ {CCFC6A58-623D-9013-BFEB-C809809E2429}.Debug|x64.ActiveCfg = Debug|x64
+ {CCFC6A58-623D-9013-BFEB-C809809E2429}.Release|Win32.ActiveCfg = Release|Win32
+ {CCFC6A58-623D-9013-BFEB-C809809E2429}.Release|x64.ActiveCfg = Release|x64
+ {CCFC6A58-623D-9013-BFEB-C809809E2429}.Debug|Win32.Build.0 = Debug|Win32
+ {CCFC6A58-623D-9013-BFEB-C809809E2429}.Debug|x64.Build.0 = Debug|x64
+ {CCFC6A58-623D-9013-BFEB-C809809E2429}.Release|Win32.Build.0 = Release|Win32
+ {CCFC6A58-623D-9013-BFEB-C809809E2429}.Release|x64.Build.0 = Release|x64
+ {CCFC6A58-623D-9013-BFEB-C809809E2429}.Debug-DLL|Win32.ActiveCfg = Debug|Win32
+ {CCFC6A58-623D-9013-BFEB-C809809E2429}.Debug-DLL|Win32.Build.0 = Debug|Win32
+ {CCFC6A58-623D-9013-BFEB-C809809E2429}.Debug-DLL|x64.ActiveCfg = Debug|x64
+ {CCFC6A58-623D-9013-BFEB-C809809E2429}.Debug-DLL|x64.Build.0 = Debug|x64
+ {CCFC6A58-623D-9013-BFEB-C809809E2429}.Release-DLL|Win32.ActiveCfg = Release|Win32
+ {CCFC6A58-623D-9013-BFEB-C809809E2429}.Release-DLL|Win32.Build.0 = Release|Win32
+ {CCFC6A58-623D-9013-BFEB-C809809E2429}.Release-DLL|x64.ActiveCfg = Release|x64
+ {CCFC6A58-623D-9013-BFEB-C809809E2429}.Release-DLL|x64.Build.0 = Release|x64
{8279AF6C-9584-67F3-1547-B204864FCCA7}.Debug|Win32.ActiveCfg = Debug|Win32
{8279AF6C-9584-67F3-1547-B204864FCCA7}.Debug|x64.ActiveCfg = Debug|x64
{8279AF6C-9584-67F3-1547-B204864FCCA7}.Release|Win32.ActiveCfg = Release|Win32
@@ -3648,6 +3633,54 @@ Global
{63422647-93FA-46BB-4827-95473D9D503C}.Release-DLL|Win32.Build.0 = Release|Win32
{63422647-93FA-46BB-4827-95473D9D503C}.Release-DLL|x64.ActiveCfg = Release|x64
{63422647-93FA-46BB-4827-95473D9D503C}.Release-DLL|x64.Build.0 = Release|x64
+ {F0FA4A41-5695-580A-DCDA-EC719CB041B0}.Debug|Win32.ActiveCfg = Debug|Win32
+ {F0FA4A41-5695-580A-DCDA-EC719CB041B0}.Debug|x64.ActiveCfg = Debug|x64
+ {F0FA4A41-5695-580A-DCDA-EC719CB041B0}.Release|Win32.ActiveCfg = Release|Win32
+ {F0FA4A41-5695-580A-DCDA-EC719CB041B0}.Release|x64.ActiveCfg = Release|x64
+ {F0FA4A41-5695-580A-DCDA-EC719CB041B0}.Debug|Win32.Build.0 = Debug|Win32
+ {F0FA4A41-5695-580A-DCDA-EC719CB041B0}.Debug|x64.Build.0 = Debug|x64
+ {F0FA4A41-5695-580A-DCDA-EC719CB041B0}.Release|Win32.Build.0 = Release|Win32
+ {F0FA4A41-5695-580A-DCDA-EC719CB041B0}.Release|x64.Build.0 = Release|x64
+ {F0FA4A41-5695-580A-DCDA-EC719CB041B0}.Debug-DLL|Win32.ActiveCfg = Debug|Win32
+ {F0FA4A41-5695-580A-DCDA-EC719CB041B0}.Debug-DLL|Win32.Build.0 = Debug|Win32
+ {F0FA4A41-5695-580A-DCDA-EC719CB041B0}.Debug-DLL|x64.ActiveCfg = Debug|x64
+ {F0FA4A41-5695-580A-DCDA-EC719CB041B0}.Debug-DLL|x64.Build.0 = Debug|x64
+ {F0FA4A41-5695-580A-DCDA-EC719CB041B0}.Release-DLL|Win32.ActiveCfg = Release|Win32
+ {F0FA4A41-5695-580A-DCDA-EC719CB041B0}.Release-DLL|Win32.Build.0 = Release|Win32
+ {F0FA4A41-5695-580A-DCDA-EC719CB041B0}.Release-DLL|x64.ActiveCfg = Release|x64
+ {F0FA4A41-5695-580A-DCDA-EC719CB041B0}.Release-DLL|x64.Build.0 = Release|x64
+ {419167BB-C3F5-DDEA-403A-394D1902DE65}.Debug|Win32.ActiveCfg = Debug|Win32
+ {419167BB-C3F5-DDEA-403A-394D1902DE65}.Debug|x64.ActiveCfg = Debug|x64
+ {419167BB-C3F5-DDEA-403A-394D1902DE65}.Release|Win32.ActiveCfg = Release|Win32
+ {419167BB-C3F5-DDEA-403A-394D1902DE65}.Release|x64.ActiveCfg = Release|x64
+ {419167BB-C3F5-DDEA-403A-394D1902DE65}.Debug|Win32.Build.0 = Debug|Win32
+ {419167BB-C3F5-DDEA-403A-394D1902DE65}.Debug|x64.Build.0 = Debug|x64
+ {419167BB-C3F5-DDEA-403A-394D1902DE65}.Release|Win32.Build.0 = Release|Win32
+ {419167BB-C3F5-DDEA-403A-394D1902DE65}.Release|x64.Build.0 = Release|x64
+ {419167BB-C3F5-DDEA-403A-394D1902DE65}.Debug-DLL|Win32.ActiveCfg = Debug|Win32
+ {419167BB-C3F5-DDEA-403A-394D1902DE65}.Debug-DLL|Win32.Build.0 = Debug|Win32
+ {419167BB-C3F5-DDEA-403A-394D1902DE65}.Debug-DLL|x64.ActiveCfg = Debug|x64
+ {419167BB-C3F5-DDEA-403A-394D1902DE65}.Debug-DLL|x64.Build.0 = Debug|x64
+ {419167BB-C3F5-DDEA-403A-394D1902DE65}.Release-DLL|Win32.ActiveCfg = Release|Win32
+ {419167BB-C3F5-DDEA-403A-394D1902DE65}.Release-DLL|Win32.Build.0 = Release|Win32
+ {419167BB-C3F5-DDEA-403A-394D1902DE65}.Release-DLL|x64.ActiveCfg = Release|x64
+ {419167BB-C3F5-DDEA-403A-394D1902DE65}.Release-DLL|x64.Build.0 = Release|x64
+ {D6DC2CF8-F263-49B1-DE13-D44D94BCF337}.Debug|Win32.ActiveCfg = Debug|Win32
+ {D6DC2CF8-F263-49B1-DE13-D44D94BCF337}.Debug|x64.ActiveCfg = Debug|x64
+ {D6DC2CF8-F263-49B1-DE13-D44D94BCF337}.Release|Win32.ActiveCfg = Release|Win32
+ {D6DC2CF8-F263-49B1-DE13-D44D94BCF337}.Release|x64.ActiveCfg = Release|x64
+ {D6DC2CF8-F263-49B1-DE13-D44D94BCF337}.Debug|Win32.Build.0 = Debug|Win32
+ {D6DC2CF8-F263-49B1-DE13-D44D94BCF337}.Debug|x64.Build.0 = Debug|x64
+ {D6DC2CF8-F263-49B1-DE13-D44D94BCF337}.Release|Win32.Build.0 = Release|Win32
+ {D6DC2CF8-F263-49B1-DE13-D44D94BCF337}.Release|x64.Build.0 = Release|x64
+ {D6DC2CF8-F263-49B1-DE13-D44D94BCF337}.Debug-DLL|Win32.ActiveCfg = Debug|Win32
+ {D6DC2CF8-F263-49B1-DE13-D44D94BCF337}.Debug-DLL|Win32.Build.0 = Debug|Win32
+ {D6DC2CF8-F263-49B1-DE13-D44D94BCF337}.Debug-DLL|x64.ActiveCfg = Debug|x64
+ {D6DC2CF8-F263-49B1-DE13-D44D94BCF337}.Debug-DLL|x64.Build.0 = Debug|x64
+ {D6DC2CF8-F263-49B1-DE13-D44D94BCF337}.Release-DLL|Win32.ActiveCfg = Release|Win32
+ {D6DC2CF8-F263-49B1-DE13-D44D94BCF337}.Release-DLL|Win32.Build.0 = Release|Win32
+ {D6DC2CF8-F263-49B1-DE13-D44D94BCF337}.Release-DLL|x64.ActiveCfg = Release|x64
+ {D6DC2CF8-F263-49B1-DE13-D44D94BCF337}.Release-DLL|x64.Build.0 = Release|x64
{9889A80C-F1D7-99C9-FE7E-657724BEDC62}.Debug|Win32.ActiveCfg = Debug|Win32
{9889A80C-F1D7-99C9-FE7E-657724BEDC62}.Debug|x64.ActiveCfg = Debug|x64
{9889A80C-F1D7-99C9-FE7E-657724BEDC62}.Release|Win32.ActiveCfg = Release|Win32
diff --git a/vsprojects/vcxproj/gpr/gpr.vcxproj b/vsprojects/vcxproj/gpr/gpr.vcxproj
index 60772c7eaf..ce593473c0 100644
--- a/vsprojects/vcxproj/gpr/gpr.vcxproj
+++ b/vsprojects/vcxproj/gpr/gpr.vcxproj
@@ -160,8 +160,6 @@
<ClInclude Include="$(SolutionDir)\..\include\grpc\support\log.h" />
<ClInclude Include="$(SolutionDir)\..\include\grpc\support\log_windows.h" />
<ClInclude Include="$(SolutionDir)\..\include\grpc\support\port_platform.h" />
- <ClInclude Include="$(SolutionDir)\..\include\grpc\support\slice.h" />
- <ClInclude Include="$(SolutionDir)\..\include\grpc\support\slice_buffer.h" />
<ClInclude Include="$(SolutionDir)\..\include\grpc\support\string_util.h" />
<ClInclude Include="$(SolutionDir)\..\include\grpc\support\subprocess.h" />
<ClInclude Include="$(SolutionDir)\..\include\grpc\support\sync.h" />
@@ -194,7 +192,6 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\support\env.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\support\mpscq.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\support\murmur_hash.h" />
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\support\percent_encoding.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\support\stack_lockfree.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\support\string.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\support\string_windows.h" />
@@ -247,12 +244,6 @@
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\support\murmur_hash.c">
</ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\support\percent_encoding.c">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\support\slice.c">
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\support\slice_buffer.c">
- </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\support\stack_lockfree.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\support\string.c">
diff --git a/vsprojects/vcxproj/gpr/gpr.vcxproj.filters b/vsprojects/vcxproj/gpr/gpr.vcxproj.filters
index f2db937579..a50a9f4200 100644
--- a/vsprojects/vcxproj/gpr/gpr.vcxproj.filters
+++ b/vsprojects/vcxproj/gpr/gpr.vcxproj.filters
@@ -67,15 +67,6 @@
<ClCompile Include="$(SolutionDir)\..\src\core\lib\support\murmur_hash.c">
<Filter>src\core\lib\support</Filter>
</ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\support\percent_encoding.c">
- <Filter>src\core\lib\support</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\support\slice.c">
- <Filter>src\core\lib\support</Filter>
- </ClCompile>
- <ClCompile Include="$(SolutionDir)\..\src\core\lib\support\slice_buffer.c">
- <Filter>src\core\lib\support</Filter>
- </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\support\stack_lockfree.c">
<Filter>src\core\lib\support</Filter>
</ClCompile>
@@ -183,12 +174,6 @@
<ClInclude Include="$(SolutionDir)\..\include\grpc\support\port_platform.h">
<Filter>include\grpc\support</Filter>
</ClInclude>
- <ClInclude Include="$(SolutionDir)\..\include\grpc\support\slice.h">
- <Filter>include\grpc\support</Filter>
- </ClInclude>
- <ClInclude Include="$(SolutionDir)\..\include\grpc\support\slice_buffer.h">
- <Filter>include\grpc\support</Filter>
- </ClInclude>
<ClInclude Include="$(SolutionDir)\..\include\grpc\support\string_util.h">
<Filter>include\grpc\support</Filter>
</ClInclude>
@@ -281,9 +266,6 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\support\murmur_hash.h">
<Filter>src\core\lib\support</Filter>
</ClInclude>
- <ClInclude Include="$(SolutionDir)\..\src\core\lib\support\percent_encoding.h">
- <Filter>src\core\lib\support</Filter>
- </ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\lib\support\stack_lockfree.h">
<Filter>src\core\lib\support</Filter>
</ClInclude>
diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj b/vsprojects/vcxproj/grpc/grpc.vcxproj
index 138246668f..c608cb8943 100644
--- a/vsprojects/vcxproj/grpc/grpc.vcxproj
+++ b/vsprojects/vcxproj/grpc/grpc.vcxproj
@@ -273,6 +273,8 @@
<ClInclude Include="$(SolutionDir)\..\include\grpc\grpc.h" />
<ClInclude Include="$(SolutionDir)\..\include\grpc\grpc_posix.h" />
<ClInclude Include="$(SolutionDir)\..\include\grpc\grpc_security_constants.h" />
+ <ClInclude Include="$(SolutionDir)\..\include\grpc\slice.h" />
+ <ClInclude Include="$(SolutionDir)\..\include\grpc\slice_buffer.h" />
<ClInclude Include="$(SolutionDir)\..\include\grpc\status.h" />
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\byte_buffer_reader.h" />
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\compression_types.h" />
@@ -368,6 +370,8 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\json\json_common.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\json\json_reader.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\json\json_writer.h" />
+ <ClInclude Include="$(SolutionDir)\..\src\core\lib\slice\percent_encoding.h" />
+ <ClInclude Include="$(SolutionDir)\..\src\core\lib\slice\slice_string_helpers.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\surface\api_trace.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\surface\call.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\surface\call_test_only.h" />
@@ -632,6 +636,14 @@
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\json\json_writer.c">
</ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\percent_encoding.c">
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\slice.c">
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\slice_buffer.c">
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\slice_string_helpers.c">
+ </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\alarm.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\api_trace.c">
diff --git a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters
index c7b9b6664a..c6ca85cab6 100644
--- a/vsprojects/vcxproj/grpc/grpc.vcxproj.filters
+++ b/vsprojects/vcxproj/grpc/grpc.vcxproj.filters
@@ -241,6 +241,18 @@
<ClCompile Include="$(SolutionDir)\..\src\core\lib\json\json_writer.c">
<Filter>src\core\lib\json</Filter>
</ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\percent_encoding.c">
+ <Filter>src\core\lib\slice</Filter>
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\slice.c">
+ <Filter>src\core\lib\slice</Filter>
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\slice_buffer.c">
+ <Filter>src\core\lib\slice</Filter>
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\slice_string_helpers.c">
+ <Filter>src\core\lib\slice</Filter>
+ </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\alarm.c">
<Filter>src\core\lib\surface</Filter>
</ClCompile>
@@ -648,6 +660,12 @@
<ClInclude Include="$(SolutionDir)\..\include\grpc\grpc_security_constants.h">
<Filter>include\grpc</Filter>
</ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\include\grpc\slice.h">
+ <Filter>include\grpc</Filter>
+ </ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\include\grpc\slice_buffer.h">
+ <Filter>include\grpc</Filter>
+ </ClInclude>
<ClInclude Include="$(SolutionDir)\..\include\grpc\status.h">
<Filter>include\grpc</Filter>
</ClInclude>
@@ -929,6 +947,12 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\json\json_writer.h">
<Filter>src\core\lib\json</Filter>
</ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\src\core\lib\slice\percent_encoding.h">
+ <Filter>src\core\lib\slice</Filter>
+ </ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\src\core\lib\slice\slice_string_helpers.h">
+ <Filter>src\core\lib\slice</Filter>
+ </ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\lib\surface\api_trace.h">
<Filter>src\core\lib\surface</Filter>
</ClInclude>
@@ -1397,6 +1421,9 @@
<Filter Include="src\core\lib\security\util">
<UniqueIdentifier>{fcd7b397-aadd-556a-8aae-0cb7c893fbe0}</UniqueIdentifier>
</Filter>
+ <Filter Include="src\core\lib\slice">
+ <UniqueIdentifier>{aed4de18-0b8a-0fed-6f5b-41ea3442310d}</UniqueIdentifier>
+ </Filter>
<Filter Include="src\core\lib\surface">
<UniqueIdentifier>{a21971fb-304f-da08-b1b2-7bd8df8ac373}</UniqueIdentifier>
</Filter>
diff --git a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj
index 40ec6cc816..764f4615b6 100644
--- a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj
+++ b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj
@@ -153,6 +153,8 @@
<ClInclude Include="$(SolutionDir)\..\include\grpc\grpc.h" />
<ClInclude Include="$(SolutionDir)\..\include\grpc\grpc_posix.h" />
<ClInclude Include="$(SolutionDir)\..\include\grpc\grpc_security_constants.h" />
+ <ClInclude Include="$(SolutionDir)\..\include\grpc\slice.h" />
+ <ClInclude Include="$(SolutionDir)\..\include\grpc\slice_buffer.h" />
<ClInclude Include="$(SolutionDir)\..\include\grpc\status.h" />
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\byte_buffer_reader.h" />
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\compression_types.h" />
@@ -261,6 +263,8 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\json\json_common.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\json\json_reader.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\json\json_writer.h" />
+ <ClInclude Include="$(SolutionDir)\..\src\core\lib\slice\percent_encoding.h" />
+ <ClInclude Include="$(SolutionDir)\..\src\core\lib\slice\slice_string_helpers.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\surface\api_trace.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\surface\call.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\surface\call_test_only.h" />
@@ -483,6 +487,14 @@
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\json\json_writer.c">
</ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\percent_encoding.c">
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\slice.c">
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\slice_buffer.c">
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\slice_string_helpers.c">
+ </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\alarm.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\api_trace.c">
diff --git a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters
index 3a973616ec..2b72043001 100644
--- a/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters
+++ b/vsprojects/vcxproj/grpc_test_util/grpc_test_util.vcxproj.filters
@@ -298,6 +298,18 @@
<ClCompile Include="$(SolutionDir)\..\src\core\lib\json\json_writer.c">
<Filter>src\core\lib\json</Filter>
</ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\percent_encoding.c">
+ <Filter>src\core\lib\slice</Filter>
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\slice.c">
+ <Filter>src\core\lib\slice</Filter>
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\slice_buffer.c">
+ <Filter>src\core\lib\slice</Filter>
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\slice_string_helpers.c">
+ <Filter>src\core\lib\slice</Filter>
+ </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\alarm.c">
<Filter>src\core\lib\surface</Filter>
</ClCompile>
@@ -405,6 +417,12 @@
<ClInclude Include="$(SolutionDir)\..\include\grpc\grpc_security_constants.h">
<Filter>include\grpc</Filter>
</ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\include\grpc\slice.h">
+ <Filter>include\grpc</Filter>
+ </ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\include\grpc\slice_buffer.h">
+ <Filter>include\grpc</Filter>
+ </ClInclude>
<ClInclude Include="$(SolutionDir)\..\include\grpc\status.h">
<Filter>include\grpc</Filter>
</ClInclude>
@@ -725,6 +743,12 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\json\json_writer.h">
<Filter>src\core\lib\json</Filter>
</ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\src\core\lib\slice\percent_encoding.h">
+ <Filter>src\core\lib\slice</Filter>
+ </ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\src\core\lib\slice\slice_string_helpers.h">
+ <Filter>src\core\lib\slice</Filter>
+ </ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\lib\surface\api_trace.h">
<Filter>src\core\lib\surface</Filter>
</ClInclude>
@@ -833,6 +857,9 @@
<Filter Include="src\core\lib\json">
<UniqueIdentifier>{89bc8f83-e29a-ddab-8f6b-22df11cdc867}</UniqueIdentifier>
</Filter>
+ <Filter Include="src\core\lib\slice">
+ <UniqueIdentifier>{4d172bbc-20c4-6e7d-872a-2d287b589aa0}</UniqueIdentifier>
+ </Filter>
<Filter Include="src\core\lib\surface">
<UniqueIdentifier>{7f2b7dca-395f-94dd-c9ad-9a286bd9751e}</UniqueIdentifier>
</Filter>
diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj
index 5573fc5cde..ed68f03ad5 100644
--- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj
+++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj
@@ -264,6 +264,8 @@
<ClInclude Include="$(SolutionDir)\..\include\grpc\grpc.h" />
<ClInclude Include="$(SolutionDir)\..\include\grpc\grpc_posix.h" />
<ClInclude Include="$(SolutionDir)\..\include\grpc\grpc_security_constants.h" />
+ <ClInclude Include="$(SolutionDir)\..\include\grpc\slice.h" />
+ <ClInclude Include="$(SolutionDir)\..\include\grpc\slice_buffer.h" />
<ClInclude Include="$(SolutionDir)\..\include\grpc\status.h" />
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\byte_buffer_reader.h" />
<ClInclude Include="$(SolutionDir)\..\include\grpc\impl\codegen\compression_types.h" />
@@ -358,6 +360,8 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\json\json_common.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\json\json_reader.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\json\json_writer.h" />
+ <ClInclude Include="$(SolutionDir)\..\src\core\lib\slice\percent_encoding.h" />
+ <ClInclude Include="$(SolutionDir)\..\src\core\lib\slice\slice_string_helpers.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\surface\api_trace.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\surface\call.h" />
<ClInclude Include="$(SolutionDir)\..\src\core\lib\surface\call_test_only.h" />
@@ -600,6 +604,14 @@
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\json\json_writer.c">
</ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\percent_encoding.c">
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\slice.c">
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\slice_buffer.c">
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\slice_string_helpers.c">
+ </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\alarm.c">
</ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\api_trace.c">
diff --git a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters
index 985abf7610..e8c16e531f 100644
--- a/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters
+++ b/vsprojects/vcxproj/grpc_unsecure/grpc_unsecure.vcxproj.filters
@@ -244,6 +244,18 @@
<ClCompile Include="$(SolutionDir)\..\src\core\lib\json\json_writer.c">
<Filter>src\core\lib\json</Filter>
</ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\percent_encoding.c">
+ <Filter>src\core\lib\slice</Filter>
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\slice.c">
+ <Filter>src\core\lib\slice</Filter>
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\slice_buffer.c">
+ <Filter>src\core\lib\slice</Filter>
+ </ClCompile>
+ <ClCompile Include="$(SolutionDir)\..\src\core\lib\slice\slice_string_helpers.c">
+ <Filter>src\core\lib\slice</Filter>
+ </ClCompile>
<ClCompile Include="$(SolutionDir)\..\src\core\lib\surface\alarm.c">
<Filter>src\core\lib\surface</Filter>
</ClCompile>
@@ -564,6 +576,12 @@
<ClInclude Include="$(SolutionDir)\..\include\grpc\grpc_security_constants.h">
<Filter>include\grpc</Filter>
</ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\include\grpc\slice.h">
+ <Filter>include\grpc</Filter>
+ </ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\include\grpc\slice_buffer.h">
+ <Filter>include\grpc</Filter>
+ </ClInclude>
<ClInclude Include="$(SolutionDir)\..\include\grpc\status.h">
<Filter>include\grpc</Filter>
</ClInclude>
@@ -842,6 +860,12 @@
<ClInclude Include="$(SolutionDir)\..\src\core\lib\json\json_writer.h">
<Filter>src\core\lib\json</Filter>
</ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\src\core\lib\slice\percent_encoding.h">
+ <Filter>src\core\lib\slice</Filter>
+ </ClInclude>
+ <ClInclude Include="$(SolutionDir)\..\src\core\lib\slice\slice_string_helpers.h">
+ <Filter>src\core\lib\slice</Filter>
+ </ClInclude>
<ClInclude Include="$(SolutionDir)\..\src\core\lib\surface\api_trace.h">
<Filter>src\core\lib\surface</Filter>
</ClInclude>
@@ -1193,6 +1217,9 @@
<Filter Include="src\core\lib\json">
<UniqueIdentifier>{681cdaeb-c47f-8853-d985-bf13c2873947}</UniqueIdentifier>
</Filter>
+ <Filter Include="src\core\lib\slice">
+ <UniqueIdentifier>{74c81ab7-e329-a362-3890-4c41b90f0511}</UniqueIdentifier>
+ </Filter>
<Filter Include="src\core\lib\surface">
<UniqueIdentifier>{506dc3b3-d884-2b59-0dfa-57ed6affa2d3}</UniqueIdentifier>
</Filter>
diff --git a/vsprojects/vcxproj/test/gpr_percent_encoding_test/gpr_percent_encoding_test.vcxproj b/vsprojects/vcxproj/test/percent_encoding_test/percent_encoding_test.vcxproj
index 1a943e4e8e..b858849325 100644
--- a/vsprojects/vcxproj/test/gpr_percent_encoding_test/gpr_percent_encoding_test.vcxproj
+++ b/vsprojects/vcxproj/test/percent_encoding_test/percent_encoding_test.vcxproj
@@ -20,7 +20,7 @@
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
- <ProjectGuid>{8313AE17-FCFA-8110-95C7-7AF2F814D188}</ProjectGuid>
+ <ProjectGuid>{CCFC6A58-623D-9013-BFEB-C809809E2429}</ProjectGuid>
<IgnoreWarnIntDirInTempDetected>true</IgnoreWarnIntDirInTempDetected>
<IntDir>$(SolutionDir)IntDir\$(MSBuildProjectName)\</IntDir>
</PropertyGroup>
@@ -60,14 +60,14 @@
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
- <TargetName>gpr_percent_encoding_test</TargetName>
+ <TargetName>percent_encoding_test</TargetName>
<Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib>
<Configuration-grpc_dependencies_zlib>Debug</Configuration-grpc_dependencies_zlib>
<Linkage-grpc_dependencies_openssl>static</Linkage-grpc_dependencies_openssl>
<Configuration-grpc_dependencies_openssl>Debug</Configuration-grpc_dependencies_openssl>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
- <TargetName>gpr_percent_encoding_test</TargetName>
+ <TargetName>percent_encoding_test</TargetName>
<Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib>
<Configuration-grpc_dependencies_zlib>Release</Configuration-grpc_dependencies_zlib>
<Linkage-grpc_dependencies_openssl>static</Linkage-grpc_dependencies_openssl>
@@ -158,10 +158,16 @@
</ItemDefinitionGroup>
<ItemGroup>
- <ClCompile Include="$(SolutionDir)\..\test\core\support\percent_encoding_test.c">
+ <ClCompile Include="$(SolutionDir)\..\test\core\slice\percent_encoding_test.c">
</ClCompile>
</ItemGroup>
<ItemGroup>
+ <ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc_test_util\grpc_test_util.vcxproj">
+ <Project>{17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}</Project>
+ </ProjectReference>
+ <ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc\grpc.vcxproj">
+ <Project>{29D16885-7228-4C31-81ED-5F9187C7F2A9}</Project>
+ </ProjectReference>
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\gpr_test_util\gpr_test_util.vcxproj">
<Project>{EAB0A629-17A9-44DB-B5FF-E91A721FE037}</Project>
</ProjectReference>
diff --git a/vsprojects/vcxproj/test/gpr_slice_buffer_test/gpr_slice_buffer_test.vcxproj.filters b/vsprojects/vcxproj/test/percent_encoding_test/percent_encoding_test.vcxproj.filters
index c41df894e4..c782da7b16 100644
--- a/vsprojects/vcxproj/test/gpr_slice_buffer_test/gpr_slice_buffer_test.vcxproj.filters
+++ b/vsprojects/vcxproj/test/percent_encoding_test/percent_encoding_test.vcxproj.filters
@@ -1,20 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
- <ClCompile Include="$(SolutionDir)\..\test\core\support\slice_buffer_test.c">
- <Filter>test\core\support</Filter>
+ <ClCompile Include="$(SolutionDir)\..\test\core\slice\percent_encoding_test.c">
+ <Filter>test\core\slice</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Filter Include="test">
- <UniqueIdentifier>{b015cdf6-6916-d262-31a5-7a40ebdd3a54}</UniqueIdentifier>
+ <UniqueIdentifier>{cae06dad-e2f9-b0e5-9c5d-5458ef09f6f8}</UniqueIdentifier>
</Filter>
<Filter Include="test\core">
- <UniqueIdentifier>{9eaba135-13ef-103d-b5ed-7b338862ee45}</UniqueIdentifier>
+ <UniqueIdentifier>{e20d1fc3-2955-f28e-ce2f-e5a96cb7b348}</UniqueIdentifier>
</Filter>
- <Filter Include="test\core\support">
- <UniqueIdentifier>{7ebad66c-189e-0e23-27fd-775aa5539d60}</UniqueIdentifier>
+ <Filter Include="test\core\slice">
+ <UniqueIdentifier>{429586ce-a996-f897-05f9-990e7c664eb1}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>
diff --git a/vsprojects/vcxproj/test/gpr_slice_test/gpr_slice_test.vcxproj b/vsprojects/vcxproj/test/slice_buffer_test/slice_buffer_test.vcxproj
index bb2badc35c..ace1a3fab5 100644
--- a/vsprojects/vcxproj/test/gpr_slice_test/gpr_slice_test.vcxproj
+++ b/vsprojects/vcxproj/test/slice_buffer_test/slice_buffer_test.vcxproj
@@ -20,7 +20,7 @@
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
- <ProjectGuid>{7F2D1623-AF04-DD98-BCE6-61ADB9A52366}</ProjectGuid>
+ <ProjectGuid>{F0FA4A41-5695-580A-DCDA-EC719CB041B0}</ProjectGuid>
<IgnoreWarnIntDirInTempDetected>true</IgnoreWarnIntDirInTempDetected>
<IntDir>$(SolutionDir)IntDir\$(MSBuildProjectName)\</IntDir>
</PropertyGroup>
@@ -60,14 +60,14 @@
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
- <TargetName>gpr_slice_test</TargetName>
+ <TargetName>slice_buffer_test</TargetName>
<Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib>
<Configuration-grpc_dependencies_zlib>Debug</Configuration-grpc_dependencies_zlib>
<Linkage-grpc_dependencies_openssl>static</Linkage-grpc_dependencies_openssl>
<Configuration-grpc_dependencies_openssl>Debug</Configuration-grpc_dependencies_openssl>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
- <TargetName>gpr_slice_test</TargetName>
+ <TargetName>slice_buffer_test</TargetName>
<Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib>
<Configuration-grpc_dependencies_zlib>Release</Configuration-grpc_dependencies_zlib>
<Linkage-grpc_dependencies_openssl>static</Linkage-grpc_dependencies_openssl>
@@ -158,10 +158,16 @@
</ItemDefinitionGroup>
<ItemGroup>
- <ClCompile Include="$(SolutionDir)\..\test\core\support\slice_test.c">
+ <ClCompile Include="$(SolutionDir)\..\test\core\slice\slice_buffer_test.c">
</ClCompile>
</ItemGroup>
<ItemGroup>
+ <ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc_test_util\grpc_test_util.vcxproj">
+ <Project>{17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}</Project>
+ </ProjectReference>
+ <ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc\grpc.vcxproj">
+ <Project>{29D16885-7228-4C31-81ED-5F9187C7F2A9}</Project>
+ </ProjectReference>
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\gpr_test_util\gpr_test_util.vcxproj">
<Project>{EAB0A629-17A9-44DB-B5FF-E91A721FE037}</Project>
</ProjectReference>
diff --git a/vsprojects/vcxproj/test/gpr_percent_encoding_test/gpr_percent_encoding_test.vcxproj.filters b/vsprojects/vcxproj/test/slice_buffer_test/slice_buffer_test.vcxproj.filters
index e25b1ad656..faf98f86c0 100644
--- a/vsprojects/vcxproj/test/gpr_percent_encoding_test/gpr_percent_encoding_test.vcxproj.filters
+++ b/vsprojects/vcxproj/test/slice_buffer_test/slice_buffer_test.vcxproj.filters
@@ -1,20 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
- <ClCompile Include="$(SolutionDir)\..\test\core\support\percent_encoding_test.c">
- <Filter>test\core\support</Filter>
+ <ClCompile Include="$(SolutionDir)\..\test\core\slice\slice_buffer_test.c">
+ <Filter>test\core\slice</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Filter Include="test">
- <UniqueIdentifier>{c2ea1ce7-c916-11e7-6477-92a18d988d54}</UniqueIdentifier>
+ <UniqueIdentifier>{03de0a72-2873-4cc6-9a73-b7faed0f32fb}</UniqueIdentifier>
</Filter>
<Filter Include="test\core">
- <UniqueIdentifier>{14fa1f36-5dea-ee3f-d3fa-a137176b235f}</UniqueIdentifier>
+ <UniqueIdentifier>{4a2e8cf6-61b1-6a4d-7f9d-298ef88b720d}</UniqueIdentifier>
</Filter>
- <Filter Include="test\core\support">
- <UniqueIdentifier>{e245dffe-593f-f63e-8dc8-3c9de4d00697}</UniqueIdentifier>
+ <Filter Include="test\core\slice">
+ <UniqueIdentifier>{f486a4fe-0740-de07-63ea-00126063ee59}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>
diff --git a/vsprojects/vcxproj/test/slice_string_helpers_test/slice_string_helpers_test.vcxproj b/vsprojects/vcxproj/test/slice_string_helpers_test/slice_string_helpers_test.vcxproj
new file mode 100644
index 0000000000..81a3cfc095
--- /dev/null
+++ b/vsprojects/vcxproj/test/slice_string_helpers_test/slice_string_helpers_test.vcxproj
@@ -0,0 +1,199 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.props" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\1.0.204.1.props')" />
+ <ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|Win32">
+ <Configuration>Debug</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Debug|x64">
+ <Configuration>Debug</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|Win32">
+ <Configuration>Release</Configuration>
+ <Platform>Win32</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|x64">
+ <Configuration>Release</Configuration>
+ <Platform>x64</Platform>
+ </ProjectConfiguration>
+ </ItemGroup>
+ <PropertyGroup Label="Globals">
+ <ProjectGuid>{419167BB-C3F5-DDEA-403A-394D1902DE65}</ProjectGuid>
+ <IgnoreWarnIntDirInTempDetected>true</IgnoreWarnIntDirInTempDetected>
+ <IntDir>$(SolutionDir)IntDir\$(MSBuildProjectName)\</IntDir>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+ <PropertyGroup Condition="'$(VisualStudioVersion)' == '10.0'" Label="Configuration">
+ <PlatformToolset>v100</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(VisualStudioVersion)' == '11.0'" Label="Configuration">
+ <PlatformToolset>v110</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(VisualStudioVersion)' == '12.0'" Label="Configuration">
+ <PlatformToolset>v120</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(VisualStudioVersion)' == '14.0'" Label="Configuration">
+ <PlatformToolset>v140</PlatformToolset>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
+ <ConfigurationType>Application</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <WholeProgramOptimization>true</WholeProgramOptimization>
+ <CharacterSet>Unicode</CharacterSet>
+ </PropertyGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+ <ImportGroup Label="ExtensionSettings">
+ </ImportGroup>
+ <ImportGroup Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+ <Import Project="$(SolutionDir)\..\vsprojects\global.props" />
+ <Import Project="$(SolutionDir)\..\vsprojects\openssl.props" />
+ <Import Project="$(SolutionDir)\..\vsprojects\winsock.props" />
+ <Import Project="$(SolutionDir)\..\vsprojects\zlib.props" />
+ </ImportGroup>
+ <PropertyGroup Label="UserMacros" />
+ <PropertyGroup Condition="'$(Configuration)'=='Debug'">
+ <TargetName>slice_string_helpers_test</TargetName>
+ <Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib>
+ <Configuration-grpc_dependencies_zlib>Debug</Configuration-grpc_dependencies_zlib>
+ <Linkage-grpc_dependencies_openssl>static</Linkage-grpc_dependencies_openssl>
+ <Configuration-grpc_dependencies_openssl>Debug</Configuration-grpc_dependencies_openssl>
+ </PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)'=='Release'">
+ <TargetName>slice_string_helpers_test</TargetName>
+ <Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib>
+ <Configuration-grpc_dependencies_zlib>Release</Configuration-grpc_dependencies_zlib>
+ <Linkage-grpc_dependencies_openssl>static</Linkage-grpc_dependencies_openssl>
+ <Configuration-grpc_dependencies_openssl>Release</Configuration-grpc_dependencies_openssl>
+ </PropertyGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <SDLCheck>true</SDLCheck>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat>
+ <MinimalRebuild Condition="$(Jenkins)">false</MinimalRebuild>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation>
+ <GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+ <ClCompile>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>Disabled</Optimization>
+ <PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <SDLCheck>true</SDLCheck>
+ <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat>
+ <MinimalRebuild Condition="$(Jenkins)">false</MinimalRebuild>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation>
+ <GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation>
+ </Link>
+ </ItemDefinitionGroup>
+
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
+ <ClCompile>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat>
+ <MinimalRebuild Condition="$(Jenkins)">false</MinimalRebuild>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation>
+ <GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+ <ClCompile>
+ <PrecompiledHeader>NotUsing</PrecompiledHeader>
+ <WarningLevel>Level3</WarningLevel>
+ <Optimization>MaxSpeed</Optimization>
+ <PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <FunctionLevelLinking>true</FunctionLevelLinking>
+ <IntrinsicFunctions>true</IntrinsicFunctions>
+ <SDLCheck>true</SDLCheck>
+ <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+ <TreatWarningAsError>true</TreatWarningAsError>
+ <DebugInformationFormat Condition="$(Jenkins)">None</DebugInformationFormat>
+ <MinimalRebuild Condition="$(Jenkins)">false</MinimalRebuild>
+ </ClCompile>
+ <Link>
+ <SubSystem>Console</SubSystem>
+ <GenerateDebugInformation Condition="!$(Jenkins)">true</GenerateDebugInformation>
+ <GenerateDebugInformation Condition="$(Jenkins)">false</GenerateDebugInformation>
+ <EnableCOMDATFolding>true</EnableCOMDATFolding>
+ <OptimizeReferences>true</OptimizeReferences>
+ </Link>
+ </ItemDefinitionGroup>
+
+ <ItemGroup>
+ <ClCompile Include="$(SolutionDir)\..\test\core\slice\slice_string_helpers_test.c">
+ </ClCompile>
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc_test_util\grpc_test_util.vcxproj">
+ <Project>{17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}</Project>
+ </ProjectReference>
+ <ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc\grpc.vcxproj">
+ <Project>{29D16885-7228-4C31-81ED-5F9187C7F2A9}</Project>
+ </ProjectReference>
+ <ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\gpr_test_util\gpr_test_util.vcxproj">
+ <Project>{EAB0A629-17A9-44DB-B5FF-E91A721FE037}</Project>
+ </ProjectReference>
+ <ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\gpr\gpr.vcxproj">
+ <Project>{B23D3D1A-9438-4EDA-BEB6-9A0A03D17792}</Project>
+ </ProjectReference>
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="packages.config" />
+ </ItemGroup>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+ <ImportGroup Label="ExtensionTargets">
+ <Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.redist.1.2.8.10\build\native\grpc.dependencies.zlib.redist.targets" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.redist.1.2.8.10\build\native\grpc.dependencies\grpc.dependencies.zlib.targets')" />
+ <Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.1.2.8.10\build\native\grpc.dependencies.zlib.targets" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.1.2.8.10\build\native\grpc.dependencies\grpc.dependencies.zlib.targets')" />
+ <Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.redist.1.0.204.1\build\native\grpc.dependencies.openssl.redist.targets" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.redist.1.0.204.1\build\native\grpc.dependencies\grpc.dependencies.openssl.targets')" />
+ <Import Project="$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.targets" Condition="Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies\grpc.dependencies.openssl.targets')" />
+ </ImportGroup>
+ <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
+ <PropertyGroup>
+ <ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
+ </PropertyGroup>
+ <Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.redist.1.2.8.10\build\native\grpc.dependencies.zlib.redist.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.redist.1.2.8.10\build\native\grpc.dependencies.zlib.redist.targets')" />
+ <Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.1.2.8.10\build\native\grpc.dependencies.zlib.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.zlib.1.2.8.10\build\native\grpc.dependencies.zlib.targets')" />
+ <Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.redist.1.0.204.1\build\native\grpc.dependencies.openssl.redist.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.redist.1.0.204.1\build\native\grpc.dependencies.openssl.redist.targets')" />
+ <Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.props')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.props')" />
+ <Error Condition="!Exists('$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\..\vsprojects\packages\grpc.dependencies.openssl.1.0.204.1\build\native\grpc.dependencies.openssl.targets')" />
+ </Target>
+</Project>
+
diff --git a/vsprojects/vcxproj/test/slice_string_helpers_test/slice_string_helpers_test.vcxproj.filters b/vsprojects/vcxproj/test/slice_string_helpers_test/slice_string_helpers_test.vcxproj.filters
new file mode 100644
index 0000000000..0efa96e007
--- /dev/null
+++ b/vsprojects/vcxproj/test/slice_string_helpers_test/slice_string_helpers_test.vcxproj.filters
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <ItemGroup>
+ <ClCompile Include="$(SolutionDir)\..\test\core\slice\slice_string_helpers_test.c">
+ <Filter>test\core\slice</Filter>
+ </ClCompile>
+ </ItemGroup>
+
+ <ItemGroup>
+ <Filter Include="test">
+ <UniqueIdentifier>{28e4a72c-aa96-0c05-4846-5cf3fc783de6}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="test\core">
+ <UniqueIdentifier>{2b4c98dc-c5e9-dbd2-65f2-cdb15beee76b}</UniqueIdentifier>
+ </Filter>
+ <Filter Include="test\core\slice">
+ <UniqueIdentifier>{c638007b-824d-9d7e-dd56-a732dadf7730}</UniqueIdentifier>
+ </Filter>
+ </ItemGroup>
+</Project>
+
diff --git a/vsprojects/vcxproj/test/gpr_slice_buffer_test/gpr_slice_buffer_test.vcxproj b/vsprojects/vcxproj/test/slice_test/slice_test.vcxproj
index 33926ff116..4cc854350d 100644
--- a/vsprojects/vcxproj/test/gpr_slice_buffer_test/gpr_slice_buffer_test.vcxproj
+++ b/vsprojects/vcxproj/test/slice_test/slice_test.vcxproj
@@ -20,7 +20,7 @@
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
- <ProjectGuid>{E679773D-DE89-AEBB-9787-59019989B825}</ProjectGuid>
+ <ProjectGuid>{D6DC2CF8-F263-49B1-DE13-D44D94BCF337}</ProjectGuid>
<IgnoreWarnIntDirInTempDetected>true</IgnoreWarnIntDirInTempDetected>
<IntDir>$(SolutionDir)IntDir\$(MSBuildProjectName)\</IntDir>
</PropertyGroup>
@@ -60,14 +60,14 @@
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
- <TargetName>gpr_slice_buffer_test</TargetName>
+ <TargetName>slice_test</TargetName>
<Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib>
<Configuration-grpc_dependencies_zlib>Debug</Configuration-grpc_dependencies_zlib>
<Linkage-grpc_dependencies_openssl>static</Linkage-grpc_dependencies_openssl>
<Configuration-grpc_dependencies_openssl>Debug</Configuration-grpc_dependencies_openssl>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
- <TargetName>gpr_slice_buffer_test</TargetName>
+ <TargetName>slice_test</TargetName>
<Linkage-grpc_dependencies_zlib>static</Linkage-grpc_dependencies_zlib>
<Configuration-grpc_dependencies_zlib>Release</Configuration-grpc_dependencies_zlib>
<Linkage-grpc_dependencies_openssl>static</Linkage-grpc_dependencies_openssl>
@@ -158,10 +158,16 @@
</ItemDefinitionGroup>
<ItemGroup>
- <ClCompile Include="$(SolutionDir)\..\test\core\support\slice_buffer_test.c">
+ <ClCompile Include="$(SolutionDir)\..\test\core\slice\slice_test.c">
</ClCompile>
</ItemGroup>
<ItemGroup>
+ <ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc_test_util\grpc_test_util.vcxproj">
+ <Project>{17BCAFC0-5FDC-4C94-AEB9-95F3E220614B}</Project>
+ </ProjectReference>
+ <ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\grpc\grpc.vcxproj">
+ <Project>{29D16885-7228-4C31-81ED-5F9187C7F2A9}</Project>
+ </ProjectReference>
<ProjectReference Include="$(SolutionDir)\..\vsprojects\vcxproj\.\gpr_test_util\gpr_test_util.vcxproj">
<Project>{EAB0A629-17A9-44DB-B5FF-E91A721FE037}</Project>
</ProjectReference>
diff --git a/vsprojects/vcxproj/test/gpr_slice_test/gpr_slice_test.vcxproj.filters b/vsprojects/vcxproj/test/slice_test/slice_test.vcxproj.filters
index 1e150f9d2d..1528a62664 100644
--- a/vsprojects/vcxproj/test/gpr_slice_test/gpr_slice_test.vcxproj.filters
+++ b/vsprojects/vcxproj/test/slice_test/slice_test.vcxproj.filters
@@ -1,20 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
- <ClCompile Include="$(SolutionDir)\..\test\core\support\slice_test.c">
- <Filter>test\core\support</Filter>
+ <ClCompile Include="$(SolutionDir)\..\test\core\slice\slice_test.c">
+ <Filter>test\core\slice</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<Filter Include="test">
- <UniqueIdentifier>{ac299488-eb50-af3d-a3cb-8db7c4997bc3}</UniqueIdentifier>
+ <UniqueIdentifier>{44997359-29c9-6a9f-598c-af6ad75b2b38}</UniqueIdentifier>
</Filter>
<Filter Include="test\core">
- <UniqueIdentifier>{962461d7-b980-51ed-090c-2426cfb05f33}</UniqueIdentifier>
+ <UniqueIdentifier>{5b21ab34-9275-45b8-8dda-63b54fa77d69}</UniqueIdentifier>
</Filter>
- <Filter Include="test\core\support">
- <UniqueIdentifier>{bc52b905-4fa4-f3f8-8a45-3b51fdb226dc}</UniqueIdentifier>
+ <Filter Include="test\core\slice">
+ <UniqueIdentifier>{341de3f3-3ccb-deb9-0d33-8c6f6a36efc6}</UniqueIdentifier>
</Filter>
</ItemGroup>
</Project>