diff options
Diffstat (limited to 'src/core')
75 files changed, 224 insertions, 79 deletions
diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc index 49522ef3e4..bca4ecbc25 100644 --- a/src/core/ext/filters/client_channel/client_channel.cc +++ b/src/core/ext/filters/client_channel/client_channel.cc @@ -29,7 +29,6 @@ #include <grpc/support/log.h> #include <grpc/support/string_util.h> #include <grpc/support/sync.h> -#include <grpc/support/useful.h> #include "src/core/ext/filters/client_channel/backup_poller.h" #include "src/core/ext/filters/client_channel/http_connect_handshaker.h" diff --git a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc index e19a6a71aa..45c9f17301 100644 --- a/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc +++ b/src/core/ext/filters/client_channel/lb_policy/grpclb/grpclb_client_stats.cc @@ -24,7 +24,6 @@ #include <grpc/support/atm.h> #include <grpc/support/string_util.h> #include <grpc/support/sync.h> -#include <grpc/support/useful.h> #include "src/core/lib/channel/channel_args.h" diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc index 2eb2a9b59d..2bf86f82b0 100644 --- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc +++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_posix.cc @@ -28,7 +28,6 @@ #include <grpc/support/log.h> #include <grpc/support/string_util.h> #include <grpc/support/time.h> -#include <grpc/support/useful.h> #include "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.h" #include "src/core/lib/gpr/string.h" #include "src/core/lib/iomgr/ev_posix.h" diff --git a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc index e05f9d2f2f..09dbe22a86 100644 --- a/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc +++ b/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc @@ -32,7 +32,6 @@ #include <grpc/support/log.h> #include <grpc/support/string_util.h> #include <grpc/support/time.h> -#include <grpc/support/useful.h> #include "src/core/ext/filters/client_channel/parse_address.h" #include "src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver.h" diff --git a/src/core/ext/filters/client_channel/retry_throttle.cc b/src/core/ext/filters/client_channel/retry_throttle.cc index 867d775151..20d7be1c21 100644 --- a/src/core/ext/filters/client_channel/retry_throttle.cc +++ b/src/core/ext/filters/client_channel/retry_throttle.cc @@ -23,10 +23,11 @@ #include <grpc/support/alloc.h> #include <grpc/support/atm.h> -#include <grpc/support/avl.h> #include <grpc/support/string_util.h> #include <grpc/support/sync.h> +#include "src/core/lib/gpr/avl.h" + // // server_retry_throttle_data // diff --git a/src/core/ext/filters/client_channel/subchannel.cc b/src/core/ext/filters/client_channel/subchannel.cc index dc1beee165..3d4771e9bf 100644 --- a/src/core/ext/filters/client_channel/subchannel.cc +++ b/src/core/ext/filters/client_channel/subchannel.cc @@ -25,7 +25,6 @@ #include <cstring> #include <grpc/support/alloc.h> -#include <grpc/support/avl.h> #include <grpc/support/string_util.h> #include "src/core/ext/filters/client_channel/client_channel.h" diff --git a/src/core/ext/filters/client_channel/subchannel_index.cc b/src/core/ext/filters/client_channel/subchannel_index.cc index 052b047f43..2d063973ca 100644 --- a/src/core/ext/filters/client_channel/subchannel_index.cc +++ b/src/core/ext/filters/client_channel/subchannel_index.cc @@ -22,11 +22,11 @@ #include <string.h> #include <grpc/support/alloc.h> -#include <grpc/support/avl.h> #include <grpc/support/string_util.h> #include <grpc/support/tls.h> #include "src/core/lib/channel/channel_args.h" +#include "src/core/lib/gpr/avl.h" // a map of subchannel_key --> subchannel, used for detecting connections // to the same destination in order to share them diff --git a/src/core/ext/transport/chttp2/alpn/alpn.cc b/src/core/ext/transport/chttp2/alpn/alpn.cc index 89892457d6..5c4bfd03fa 100644 --- a/src/core/ext/transport/chttp2/alpn/alpn.cc +++ b/src/core/ext/transport/chttp2/alpn/alpn.cc @@ -18,7 +18,8 @@ #include "src/core/ext/transport/chttp2/alpn/alpn.h" #include <grpc/support/log.h> -#include <grpc/support/useful.h> + +#include "src/core/lib/gpr/useful.h" /* in order of preference */ static const char* const supported_versions[] = {"grpc-exp", "h2"}; diff --git a/src/core/ext/transport/chttp2/server/chttp2_server.cc b/src/core/ext/transport/chttp2/server/chttp2_server.cc index 5669fa4090..bab46f8f30 100644 --- a/src/core/ext/transport/chttp2/server/chttp2_server.cc +++ b/src/core/ext/transport/chttp2/server/chttp2_server.cc @@ -28,7 +28,6 @@ #include <grpc/support/log.h> #include <grpc/support/string_util.h> #include <grpc/support/sync.h> -#include <grpc/support/useful.h> #include "src/core/ext/filters/http/server/http_server_filter.h" #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" diff --git a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc index fe05e43960..bc1762daad 100644 --- a/src/core/ext/transport/chttp2/transport/chttp2_transport.cc +++ b/src/core/ext/transport/chttp2/transport/chttp2_transport.cc @@ -30,7 +30,6 @@ #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/string_util.h> -#include <grpc/support/useful.h> #include "src/core/ext/transport/chttp2/transport/frame_data.h" #include "src/core/ext/transport/chttp2/transport/internal.h" diff --git a/src/core/ext/transport/chttp2/transport/flow_control.cc b/src/core/ext/transport/chttp2/transport/flow_control.cc index 581241d392..311fbd60b1 100644 --- a/src/core/ext/transport/chttp2/transport/flow_control.cc +++ b/src/core/ext/transport/chttp2/transport/flow_control.cc @@ -26,7 +26,6 @@ #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/string_util.h> -#include <grpc/support/useful.h> #include "src/core/ext/transport/chttp2/transport/internal.h" #include "src/core/lib/gpr/string.h" diff --git a/src/core/ext/transport/chttp2/transport/flow_control.h b/src/core/ext/transport/chttp2/transport/flow_control.h index 2ee1345260..19c189393f 100644 --- a/src/core/ext/transport/chttp2/transport/flow_control.h +++ b/src/core/ext/transport/chttp2/transport/flow_control.h @@ -22,8 +22,8 @@ #include <grpc/support/port_platform.h> #include <stdint.h> -#include <grpc/support/useful.h> #include "src/core/ext/transport/chttp2/transport/http2_settings.h" +#include "src/core/lib/gpr/useful.h" #include "src/core/lib/gprpp/abstract.h" #include "src/core/lib/gprpp/manual_constructor.h" #include "src/core/lib/transport/bdp_estimator.h" diff --git a/src/core/ext/transport/chttp2/transport/frame_data.cc b/src/core/ext/transport/chttp2/transport/frame_data.cc index 043b80a3cb..5ea495f2db 100644 --- a/src/core/ext/transport/chttp2/transport/frame_data.cc +++ b/src/core/ext/transport/chttp2/transport/frame_data.cc @@ -23,7 +23,6 @@ #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/string_util.h> -#include <grpc/support/useful.h> #include "src/core/ext/transport/chttp2/transport/internal.h" #include "src/core/lib/gpr/string.h" #include "src/core/lib/slice/slice_internal.h" diff --git a/src/core/ext/transport/chttp2/transport/frame_settings.cc b/src/core/ext/transport/chttp2/transport/frame_settings.cc index 0d245f4ba1..36d6b48f02 100644 --- a/src/core/ext/transport/chttp2/transport/frame_settings.cc +++ b/src/core/ext/transport/chttp2/transport/frame_settings.cc @@ -24,7 +24,6 @@ #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/string_util.h> -#include <grpc/support/useful.h> #include "src/core/ext/transport/chttp2/transport/chttp2_transport.h" #include "src/core/ext/transport/chttp2/transport/frame.h" diff --git a/src/core/ext/transport/chttp2/transport/hpack_encoder.cc b/src/core/ext/transport/chttp2/transport/hpack_encoder.cc index 3a5692a694..ba6b43b1dd 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_encoder.cc +++ b/src/core/ext/transport/chttp2/transport/hpack_encoder.cc @@ -28,7 +28,6 @@ #include <grpc/support/alloc.h> #include <grpc/support/log.h> -#include <grpc/support/useful.h> #include "src/core/ext/transport/chttp2/transport/bin_encoder.h" #include "src/core/ext/transport/chttp2/transport/hpack_table.h" diff --git a/src/core/ext/transport/chttp2/transport/hpack_parser.cc b/src/core/ext/transport/chttp2/transport/hpack_parser.cc index 8d1c57a9cb..66cc2884e1 100644 --- a/src/core/ext/transport/chttp2/transport/hpack_parser.cc +++ b/src/core/ext/transport/chttp2/transport/hpack_parser.cc @@ -27,7 +27,6 @@ #include <grpc/support/log.h> #include <grpc/support/port_platform.h> #include <grpc/support/string_util.h> -#include <grpc/support/useful.h> #include "src/core/ext/transport/chttp2/transport/bin_encoder.h" #include "src/core/lib/debug/stats.h" diff --git a/src/core/ext/transport/chttp2/transport/http2_settings.cc b/src/core/ext/transport/chttp2/transport/http2_settings.cc index 0aab864400..4248496f48 100644 --- a/src/core/ext/transport/chttp2/transport/http2_settings.cc +++ b/src/core/ext/transport/chttp2/transport/http2_settings.cc @@ -20,7 +20,7 @@ #include "src/core/ext/transport/chttp2/transport/http2_settings.h" -#include <grpc/support/useful.h> +#include "src/core/lib/gpr/useful.h" #include "src/core/lib/transport/http2_errors.h" const uint16_t grpc_setting_id_to_wire_id[] = {1, 2, 3, 4, 5, 6, 65027}; diff --git a/src/core/ext/transport/chttp2/transport/stream_map.cc b/src/core/ext/transport/chttp2/transport/stream_map.cc index e4f08f5a6c..d59ff405f5 100644 --- a/src/core/ext/transport/chttp2/transport/stream_map.cc +++ b/src/core/ext/transport/chttp2/transport/stream_map.cc @@ -22,7 +22,6 @@ #include <grpc/support/alloc.h> #include <grpc/support/log.h> -#include <grpc/support/useful.h> void grpc_chttp2_stream_map_init(grpc_chttp2_stream_map* map, size_t initial_capacity) { diff --git a/src/core/ext/transport/cronet/transport/cronet_transport.cc b/src/core/ext/transport/cronet/transport/cronet_transport.cc index 5b1c6ab3f9..7735c3de6e 100644 --- a/src/core/ext/transport/cronet/transport/cronet_transport.cc +++ b/src/core/ext/transport/cronet/transport/cronet_transport.cc @@ -24,7 +24,6 @@ #include <grpc/support/host_port.h> #include <grpc/support/log.h> #include <grpc/support/string_util.h> -#include <grpc/support/useful.h> #include "src/core/ext/transport/chttp2/transport/incoming_metadata.h" #include "src/core/ext/transport/cronet/transport/cronet_transport.h" diff --git a/src/core/lib/backoff/backoff.cc b/src/core/lib/backoff/backoff.cc index d561fc7460..9275fc2894 100644 --- a/src/core/lib/backoff/backoff.cc +++ b/src/core/lib/backoff/backoff.cc @@ -20,7 +20,7 @@ #include <algorithm> -#include <grpc/support/useful.h> +#include "src/core/lib/gpr/useful.h" namespace grpc_core { diff --git a/src/core/lib/channel/channel_args.cc b/src/core/lib/channel/channel_args.cc index 101a6fffbc..5cd158aff2 100644 --- a/src/core/lib/channel/channel_args.cc +++ b/src/core/lib/channel/channel_args.cc @@ -26,10 +26,10 @@ #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/channel/channel_args.h" #include "src/core/lib/gpr/string.h" +#include "src/core/lib/gpr/useful.h" static grpc_arg copy_arg(const grpc_arg* src) { grpc_arg dst; diff --git a/src/core/lib/compression/compression.cc b/src/core/lib/compression/compression.cc index 99e6014b23..be7febf380 100644 --- a/src/core/lib/compression/compression.cc +++ b/src/core/lib/compression/compression.cc @@ -20,10 +20,10 @@ #include <string.h> #include <grpc/compression.h> -#include <grpc/support/useful.h> #include "src/core/lib/compression/algorithm_metadata.h" #include "src/core/lib/compression/compression_internal.h" +#include "src/core/lib/gpr/useful.h" #include "src/core/lib/surface/api_trace.h" #include "src/core/lib/transport/static_metadata.h" diff --git a/src/core/lib/compression/compression_internal.cc b/src/core/lib/compression/compression_internal.cc index 263cdf06eb..0583705dc1 100644 --- a/src/core/lib/compression/compression_internal.cc +++ b/src/core/lib/compression/compression_internal.cc @@ -20,10 +20,10 @@ #include <string.h> #include <grpc/compression.h> -#include <grpc/support/useful.h> #include "src/core/lib/compression/algorithm_metadata.h" #include "src/core/lib/compression/compression_internal.h" +#include "src/core/lib/gpr/useful.h" #include "src/core/lib/surface/api_trace.h" #include "src/core/lib/transport/static_metadata.h" diff --git a/src/core/lib/compression/compression_ruby.cc b/src/core/lib/compression/compression_ruby.cc index 293062f5ed..4e2d01aab1 100644 --- a/src/core/lib/compression/compression_ruby.cc +++ b/src/core/lib/compression/compression_ruby.cc @@ -17,7 +17,6 @@ */ #include <grpc/compression_ruby.h> -#include <grpc/support/useful.h> #include "src/core/lib/surface/api_trace.h" #include "src/core/lib/transport/static_metadata.h" diff --git a/src/core/lib/debug/stats.cc b/src/core/lib/debug/stats.cc index 465c76114d..40355c2d45 100644 --- a/src/core/lib/debug/stats.cc +++ b/src/core/lib/debug/stats.cc @@ -23,9 +23,9 @@ #include <grpc/support/alloc.h> #include <grpc/support/string_util.h> -#include <grpc/support/useful.h> #include "src/core/lib/gpr/string.h" +#include "src/core/lib/gpr/useful.h" grpc_stats_data* grpc_stats_per_cpu_storage = nullptr; static size_t g_num_cores; diff --git a/src/core/lib/debug/stats_data.cc b/src/core/lib/debug/stats_data.cc index 996ed3de9a..e2d3a6d073 100644 --- a/src/core/lib/debug/stats_data.cc +++ b/src/core/lib/debug/stats_data.cc @@ -19,9 +19,10 @@ */ #include "src/core/lib/debug/stats_data.h" -#include <grpc/support/useful.h> #include "src/core/lib/debug/stats.h" +#include "src/core/lib/gpr/useful.h" #include "src/core/lib/iomgr/exec_ctx.h" + const char* grpc_stats_counter_name[GRPC_STATS_COUNTER_COUNT] = { "client_calls_created", "server_calls_created", diff --git a/src/core/lib/gpr/arena.cc b/src/core/lib/gpr/arena.cc index 687592a140..5a8d7ff6ec 100644 --- a/src/core/lib/gpr/arena.cc +++ b/src/core/lib/gpr/arena.cc @@ -23,7 +23,6 @@ #include <grpc/support/alloc.h> #include <grpc/support/atm.h> #include <grpc/support/log.h> -#include <grpc/support/useful.h> // TODO(roth): We currently assume that all callers need alignment of 16 // bytes, which may be wrong in some cases. As part of converting the diff --git a/src/core/lib/gpr/atm.cc b/src/core/lib/gpr/atm.cc index 15bfe52d64..3d0b430348 100644 --- a/src/core/lib/gpr/atm.cc +++ b/src/core/lib/gpr/atm.cc @@ -17,7 +17,8 @@ */ #include <grpc/support/atm.h> -#include <grpc/support/useful.h> + +#include "src/core/lib/gpr/useful.h" gpr_atm gpr_atm_no_barrier_clamped_add(gpr_atm* value, gpr_atm delta, gpr_atm min, gpr_atm max) { diff --git a/src/core/lib/gpr/avl.cc b/src/core/lib/gpr/avl.cc index 0b67a21f2f..9d3470fe0a 100644 --- a/src/core/lib/gpr/avl.cc +++ b/src/core/lib/gpr/avl.cc @@ -16,14 +16,15 @@ * */ -#include <grpc/support/avl.h> +#include "src/core/lib/gpr/avl.h" #include <assert.h> #include <stdlib.h> #include <grpc/support/alloc.h> #include <grpc/support/string_util.h> -#include <grpc/support/useful.h> + +#include "src/core/lib/gpr/useful.h" gpr_avl gpr_avl_create(const gpr_avl_vtable* vtable) { gpr_avl out; diff --git a/src/core/lib/gpr/avl.h b/src/core/lib/gpr/avl.h new file mode 100644 index 0000000000..f3ab202bb7 --- /dev/null +++ b/src/core/lib/gpr/avl.h @@ -0,0 +1,92 @@ +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPC_CORE_LIB_GPR_AVL_H +#define GRPC_CORE_LIB_GPR_AVL_H + +#include <grpc/support/sync.h> + +/** internal node of an AVL tree */ +typedef struct gpr_avl_node { + gpr_refcount refs; + void* key; + void* value; + struct gpr_avl_node* left; + struct gpr_avl_node* right; + long height; +} gpr_avl_node; + +/** vtable for the AVL tree + * The optional user_data is propagated from the top level gpr_avl_XXX API. + * From the same API call, multiple vtable functions may be called multiple + * times. + */ +typedef struct gpr_avl_vtable { + /** destroy a key */ + void (*destroy_key)(void* key, void* user_data); + /** copy a key, returning new value */ + void* (*copy_key)(void* key, void* user_data); + /** compare key1, key2; return <0 if key1 < key2, + >0 if key1 > key2, 0 if key1 == key2 */ + long (*compare_keys)(void* key1, void* key2, void* user_data); + /** destroy a value */ + void (*destroy_value)(void* value, void* user_data); + /** copy a value */ + void* (*copy_value)(void* value, void* user_data); +} gpr_avl_vtable; + +/** "pointer" to an AVL tree - this is a reference + counted object - use gpr_avl_ref to add a reference, + gpr_avl_unref when done with a reference */ +typedef struct gpr_avl { + const gpr_avl_vtable* vtable; + gpr_avl_node* root; +} gpr_avl; + +/** Create an immutable AVL tree. */ +gpr_avl gpr_avl_create(const gpr_avl_vtable* vtable); +/** Add a reference to an existing tree - returns + the tree as a convenience. The optional user_data will be passed to vtable + functions. */ +gpr_avl gpr_avl_ref(gpr_avl avl, void* user_data); +/** Remove a reference to a tree - destroying it if there + are no references left. The optional user_data will be passed to vtable + functions. */ +void gpr_avl_unref(gpr_avl avl, void* user_data); +/** Return a new tree with (key, value) added to avl. + implicitly unrefs avl to allow easy chaining. + if key exists in avl, the new tree's key entry updated + (i.e. a duplicate is not created). The optional user_data will be passed to + vtable functions. */ +gpr_avl gpr_avl_add(gpr_avl avl, void* key, void* value, void* user_data); +/** Return a new tree with key deleted + implicitly unrefs avl to allow easy chaining. The optional user_data will be + passed to vtable functions. */ +gpr_avl gpr_avl_remove(gpr_avl avl, void* key, void* user_data); +/** Lookup key, and return the associated value. + Does not mutate avl. + Returns NULL if key is not found. The optional user_data will be passed to + vtable functions.*/ +void* gpr_avl_get(gpr_avl avl, void* key, void* user_data); +/** Return 1 if avl contains key, 0 otherwise; if it has the key, sets *value to + its value. The optional user_data will be passed to vtable functions. */ +int gpr_avl_maybe_get(gpr_avl avl, void* key, void** value, void* user_data); +/** Return 1 if avl is empty, 0 otherwise */ +int gpr_avl_is_empty(gpr_avl avl); + +#endif /* GRPC_CORE_LIB_GPR_AVL_H */ diff --git a/src/core/lib/gpr/cpu_posix.cc b/src/core/lib/gpr/cpu_posix.cc index bca14a0c12..7a77f7ab64 100644 --- a/src/core/lib/gpr/cpu_posix.cc +++ b/src/core/lib/gpr/cpu_posix.cc @@ -29,7 +29,8 @@ #include <grpc/support/cpu.h> #include <grpc/support/log.h> #include <grpc/support/sync.h> -#include <grpc/support/useful.h> + +#include "src/core/lib/gpr/useful.h" static long ncpus = 0; diff --git a/src/core/lib/gpr/env_linux.cc b/src/core/lib/gpr/env_linux.cc index 17902c3d0b..fadc42f22f 100644 --- a/src/core/lib/gpr/env_linux.cc +++ b/src/core/lib/gpr/env_linux.cc @@ -34,9 +34,9 @@ #include <grpc/support/log.h> #include <grpc/support/string_util.h> -#include <grpc/support/useful.h> #include "src/core/lib/gpr/string.h" +#include "src/core/lib/gpr/useful.h" const char* gpr_getenv_silent(const char* name, char** dst) { const char* insecure_func_used = nullptr; diff --git a/src/core/lib/gpr/env_windows.cc b/src/core/lib/gpr/env_windows.cc index 9ca1e02d03..cf8ed60d8f 100644 --- a/src/core/lib/gpr/env_windows.cc +++ b/src/core/lib/gpr/env_windows.cc @@ -22,14 +22,14 @@ #include <windows.h> -#include "src/core/lib/gpr/env.h" -#include "src/core/lib/gpr/string.h" -#include "src/core/lib/gpr/string_windows.h" - #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/string_util.h> +#include "src/core/lib/gpr/env.h" +#include "src/core/lib/gpr/string.h" +#include "src/core/lib/gpr/string_windows.h" + const char* gpr_getenv_silent(const char* name, char** dst) { *dst = gpr_getenv(name); return NULL; diff --git a/src/core/lib/gpr/fork.cc b/src/core/lib/gpr/fork.cc index 92023f4350..4651d22595 100644 --- a/src/core/lib/gpr/fork.cc +++ b/src/core/lib/gpr/fork.cc @@ -21,9 +21,9 @@ #include <string.h> #include <grpc/support/alloc.h> -#include <grpc/support/useful.h> #include "src/core/lib/gpr/env.h" +#include "src/core/lib/gpr/useful.h" /* * NOTE: FORKING IS NOT GENERALLY SUPPORTED, THIS IS ONLY INTENDED TO WORK diff --git a/src/core/lib/gpr/string.cc b/src/core/lib/gpr/string.cc index 919d957d1b..6b360e4013 100644 --- a/src/core/lib/gpr/string.cc +++ b/src/core/lib/gpr/string.cc @@ -28,7 +28,8 @@ #include <grpc/support/log.h> #include <grpc/support/port_platform.h> #include <grpc/support/string_util.h> -#include <grpc/support/useful.h> + +#include "src/core/lib/gpr/useful.h" char* gpr_strdup(const char* src) { char* dst; diff --git a/src/core/lib/gpr/thd_posix.cc b/src/core/lib/gpr/thd_posix.cc index cfff0df6de..683fd4575e 100644 --- a/src/core/lib/gpr/thd_posix.cc +++ b/src/core/lib/gpr/thd_posix.cc @@ -26,12 +26,12 @@ #include <grpc/support/log.h> #include <grpc/support/sync.h> #include <grpc/support/thd.h> -#include <grpc/support/useful.h> #include <pthread.h> #include <stdlib.h> #include <string.h> #include "src/core/lib/gpr/fork.h" +#include "src/core/lib/gpr/useful.h" static gpr_mu g_mu; static gpr_cv g_cv; diff --git a/src/core/lib/gpr/useful.h b/src/core/lib/gpr/useful.h new file mode 100644 index 0000000000..a4e73b9a61 --- /dev/null +++ b/src/core/lib/gpr/useful.h @@ -0,0 +1,65 @@ +/* + * + * Copyright 2015 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +#ifndef GRPC_CORE_LIB_GPR_USEFUL_H +#define GRPC_CORE_LIB_GPR_USEFUL_H + +/** useful macros that don't belong anywhere else */ + +#define GPR_MIN(a, b) ((a) < (b) ? (a) : (b)) +#define GPR_MAX(a, b) ((a) > (b) ? (a) : (b)) +#define GPR_CLAMP(a, min, max) ((a) < (min) ? (min) : (a) > (max) ? (max) : (a)) +/** rotl, rotr assume x is unsigned */ +#define GPR_ROTL(x, n) (((x) << (n)) | ((x) >> (sizeof(x) * 8 - (n)))) +#define GPR_ROTR(x, n) (((x) >> (n)) | ((x) << (sizeof(x) * 8 - (n)))) + +#define GPR_ARRAY_SIZE(array) (sizeof(array) / sizeof(*(array))) + +#define GPR_SWAP(type, a, b) \ + do { \ + type x = a; \ + a = b; \ + b = x; \ + } while (0) + +/** Set the \a n-th bit of \a i (a mutable pointer). */ +#define GPR_BITSET(i, n) ((*(i)) |= (1u << (n))) + +/** Clear the \a n-th bit of \a i (a mutable pointer). */ +#define GPR_BITCLEAR(i, n) ((*(i)) &= ~(1u << (n))) + +/** Get the \a n-th bit of \a i */ +#define GPR_BITGET(i, n) (((i) & (1u << (n))) != 0) + +#define GPR_INTERNAL_HEXDIGIT_BITCOUNT(x) \ + ((x) - (((x) >> 1) & 0x77777777) - (((x) >> 2) & 0x33333333) - \ + (((x) >> 3) & 0x11111111)) + +/** Returns number of bits set in bitset \a i */ +#define GPR_BITCOUNT(i) \ + (((GPR_INTERNAL_HEXDIGIT_BITCOUNT(i) + \ + (GPR_INTERNAL_HEXDIGIT_BITCOUNT(i) >> 4)) & \ + 0x0f0f0f0f) % \ + 255) + +#define GPR_ICMP(a, b) ((a) < (b) ? -1 : ((a) > (b) ? 1 : 0)) + +#define GPR_HASH_POINTER(x, range) \ + ((((size_t)x) >> 4) ^ (((size_t)x) >> 9) ^ (((size_t)x) >> 14)) % (range) + +#endif /* GRPC_CORE_LIB_GPR_USEFUL_H */ diff --git a/src/core/lib/http/format_request.cc b/src/core/lib/http/format_request.cc index 473fa71790..884a70e550 100644 --- a/src/core/lib/http/format_request.cc +++ b/src/core/lib/http/format_request.cc @@ -25,7 +25,6 @@ #include <grpc/slice.h> #include <grpc/support/alloc.h> #include <grpc/support/string_util.h> -#include <grpc/support/useful.h> #include "src/core/lib/gpr/string.h" static void fill_common_header(const grpc_httpcli_request* request, diff --git a/src/core/lib/http/httpcli.cc b/src/core/lib/http/httpcli.cc index c43c92b57d..9775ed08ad 100644 --- a/src/core/lib/http/httpcli.cc +++ b/src/core/lib/http/httpcli.cc @@ -23,7 +23,6 @@ #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/channel/channel_args.h" #include "src/core/lib/gpr/string.h" diff --git a/src/core/lib/http/parser.cc b/src/core/lib/http/parser.cc index fb4eb234a7..ee6941fde3 100644 --- a/src/core/lib/http/parser.cc +++ b/src/core/lib/http/parser.cc @@ -23,7 +23,8 @@ #include <grpc/support/alloc.h> #include <grpc/support/log.h> -#include <grpc/support/useful.h> + +#include "src/core/lib/gpr/useful.h" grpc_core::TraceFlag grpc_http1_trace(false, "http1"); diff --git a/src/core/lib/iomgr/error.cc b/src/core/lib/iomgr/error.cc index 0e27ad427c..d5b5013269 100644 --- a/src/core/lib/iomgr/error.cc +++ b/src/core/lib/iomgr/error.cc @@ -26,13 +26,13 @@ #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/string_util.h> -#include <grpc/support/useful.h> #ifdef GPR_WINDOWS #include <grpc/support/log_windows.h> #endif #include "src/core/lib/debug/trace.h" +#include "src/core/lib/gpr/useful.h" #include "src/core/lib/iomgr/error_internal.h" #include "src/core/lib/profiling/timers.h" #include "src/core/lib/slice/slice_internal.h" diff --git a/src/core/lib/iomgr/ev_epoll1_linux.cc b/src/core/lib/iomgr/ev_epoll1_linux.cc index 1ef70d2f80..512905d683 100644 --- a/src/core/lib/iomgr/ev_epoll1_linux.cc +++ b/src/core/lib/iomgr/ev_epoll1_linux.cc @@ -40,10 +40,10 @@ #include <grpc/support/cpu.h> #include <grpc/support/string_util.h> #include <grpc/support/tls.h> -#include <grpc/support/useful.h> #include "src/core/lib/debug/stats.h" #include "src/core/lib/gpr/string.h" +#include "src/core/lib/gpr/useful.h" #include "src/core/lib/gprpp/manual_constructor.h" #include "src/core/lib/iomgr/block_annotate.h" #include "src/core/lib/iomgr/ev_posix.h" diff --git a/src/core/lib/iomgr/ev_epollex_linux.cc b/src/core/lib/iomgr/ev_epollex_linux.cc index 178ebd8977..aaace58dd5 100644 --- a/src/core/lib/iomgr/ev_epollex_linux.cc +++ b/src/core/lib/iomgr/ev_epollex_linux.cc @@ -38,10 +38,10 @@ #include <grpc/support/alloc.h> #include <grpc/support/string_util.h> #include <grpc/support/tls.h> -#include <grpc/support/useful.h> #include "src/core/lib/debug/stats.h" #include "src/core/lib/gpr/spinlock.h" +#include "src/core/lib/gpr/useful.h" #include "src/core/lib/gprpp/manual_constructor.h" #include "src/core/lib/iomgr/block_annotate.h" #include "src/core/lib/iomgr/iomgr_internal.h" diff --git a/src/core/lib/iomgr/ev_epollsig_linux.cc b/src/core/lib/iomgr/ev_epollsig_linux.cc index c8954894ec..b174615c83 100644 --- a/src/core/lib/iomgr/ev_epollsig_linux.cc +++ b/src/core/lib/iomgr/ev_epollsig_linux.cc @@ -40,9 +40,9 @@ #include <grpc/support/alloc.h> #include <grpc/support/string_util.h> #include <grpc/support/tls.h> -#include <grpc/support/useful.h> #include "src/core/lib/debug/stats.h" +#include "src/core/lib/gpr/useful.h" #include "src/core/lib/gprpp/manual_constructor.h" #include "src/core/lib/iomgr/block_annotate.h" #include "src/core/lib/iomgr/ev_posix.h" diff --git a/src/core/lib/iomgr/ev_poll_posix.cc b/src/core/lib/iomgr/ev_poll_posix.cc index ad92a93beb..84be1804a2 100644 --- a/src/core/lib/iomgr/ev_poll_posix.cc +++ b/src/core/lib/iomgr/ev_poll_posix.cc @@ -35,10 +35,10 @@ #include <grpc/support/string_util.h> #include <grpc/support/thd.h> #include <grpc/support/tls.h> -#include <grpc/support/useful.h> #include "src/core/lib/debug/stats.h" #include "src/core/lib/gpr/murmur_hash.h" +#include "src/core/lib/gpr/useful.h" #include "src/core/lib/iomgr/block_annotate.h" #include "src/core/lib/iomgr/iomgr_internal.h" #include "src/core/lib/iomgr/wakeup_fd_cv.h" diff --git a/src/core/lib/iomgr/ev_posix.cc b/src/core/lib/iomgr/ev_posix.cc index 8100bece8f..af5dfe5bf3 100644 --- a/src/core/lib/iomgr/ev_posix.cc +++ b/src/core/lib/iomgr/ev_posix.cc @@ -27,10 +27,10 @@ #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/debug/trace.h" #include "src/core/lib/gpr/env.h" +#include "src/core/lib/gpr/useful.h" #include "src/core/lib/iomgr/ev_epoll1_linux.h" #include "src/core/lib/iomgr/ev_epollex_linux.h" #include "src/core/lib/iomgr/ev_epollsig_linux.h" diff --git a/src/core/lib/iomgr/executor.cc b/src/core/lib/iomgr/executor.cc index 835dc9d0f7..ca67c043c1 100644 --- a/src/core/lib/iomgr/executor.cc +++ b/src/core/lib/iomgr/executor.cc @@ -26,10 +26,10 @@ #include <grpc/support/sync.h> #include <grpc/support/thd.h> #include <grpc/support/tls.h> -#include <grpc/support/useful.h> #include "src/core/lib/debug/stats.h" #include "src/core/lib/gpr/spinlock.h" +#include "src/core/lib/gpr/useful.h" #include "src/core/lib/iomgr/exec_ctx.h" #define MAX_DEPTH 2 diff --git a/src/core/lib/iomgr/fork_posix.cc b/src/core/lib/iomgr/fork_posix.cc index 9bfa79219a..c581dae1ae 100644 --- a/src/core/lib/iomgr/fork_posix.cc +++ b/src/core/lib/iomgr/fork_posix.cc @@ -25,7 +25,6 @@ #include <grpc/fork.h> #include <grpc/support/log.h> #include <grpc/support/thd.h> -#include <grpc/support/useful.h> #include "src/core/lib/gpr/env.h" #include "src/core/lib/gpr/fork.h" diff --git a/src/core/lib/iomgr/iocp_windows.cc b/src/core/lib/iomgr/iocp_windows.cc index 0b6e6823b3..d730ce4624 100644 --- a/src/core/lib/iomgr/iocp_windows.cc +++ b/src/core/lib/iomgr/iocp_windows.cc @@ -27,7 +27,6 @@ #include <grpc/support/log.h> #include <grpc/support/log_windows.h> #include <grpc/support/thd.h> -#include <grpc/support/useful.h> #include "src/core/lib/debug/stats.h" #include "src/core/lib/iomgr/iocp_windows.h" diff --git a/src/core/lib/iomgr/iomgr.cc b/src/core/lib/iomgr/iomgr.cc index 4cd0a4f1de..9e407a29a8 100644 --- a/src/core/lib/iomgr/iomgr.cc +++ b/src/core/lib/iomgr/iomgr.cc @@ -29,10 +29,10 @@ #include <grpc/support/string_util.h> #include <grpc/support/sync.h> #include <grpc/support/thd.h> -#include <grpc/support/useful.h> #include "src/core/lib/gpr/env.h" #include "src/core/lib/gpr/string.h" +#include "src/core/lib/gpr/useful.h" #include "src/core/lib/iomgr/exec_ctx.h" #include "src/core/lib/iomgr/executor.h" #include "src/core/lib/iomgr/iomgr_internal.h" diff --git a/src/core/lib/iomgr/resolve_address_posix.cc b/src/core/lib/iomgr/resolve_address_posix.cc index 176caee490..131a8de30a 100644 --- a/src/core/lib/iomgr/resolve_address_posix.cc +++ b/src/core/lib/iomgr/resolve_address_posix.cc @@ -32,8 +32,9 @@ #include <grpc/support/string_util.h> #include <grpc/support/thd.h> #include <grpc/support/time.h> -#include <grpc/support/useful.h> + #include "src/core/lib/gpr/string.h" +#include "src/core/lib/gpr/useful.h" #include "src/core/lib/iomgr/block_annotate.h" #include "src/core/lib/iomgr/executor.h" #include "src/core/lib/iomgr/iomgr_internal.h" diff --git a/src/core/lib/iomgr/resolve_address_uv.cc b/src/core/lib/iomgr/resolve_address_uv.cc index 3eab04f3de..886c06cdb7 100644 --- a/src/core/lib/iomgr/resolve_address_uv.cc +++ b/src/core/lib/iomgr/resolve_address_uv.cc @@ -25,8 +25,8 @@ #include <grpc/support/host_port.h> #include <grpc/support/log.h> #include <grpc/support/string_util.h> -#include <grpc/support/useful.h> +#include "src/core/lib/gpr/useful.h" #include "src/core/lib/iomgr/closure.h" #include "src/core/lib/iomgr/error.h" #include "src/core/lib/iomgr/exec_ctx.h" diff --git a/src/core/lib/iomgr/resource_quota.cc b/src/core/lib/iomgr/resource_quota.cc index eaf2f5d1b2..e64d772a7d 100644 --- a/src/core/lib/iomgr/resource_quota.cc +++ b/src/core/lib/iomgr/resource_quota.cc @@ -27,8 +27,8 @@ #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/gpr/useful.h" #include "src/core/lib/iomgr/combiner.h" grpc_core::TraceFlag grpc_resource_quota_trace(false, "resource_quota"); diff --git a/src/core/lib/iomgr/socket_factory_posix.cc b/src/core/lib/iomgr/socket_factory_posix.cc index bc7d0b12f3..1c1b2fb270 100644 --- a/src/core/lib/iomgr/socket_factory_posix.cc +++ b/src/core/lib/iomgr/socket_factory_posix.cc @@ -21,11 +21,11 @@ #ifdef GRPC_POSIX_SOCKET #include "src/core/lib/channel/channel_args.h" +#include "src/core/lib/gpr/useful.h" #include "src/core/lib/iomgr/socket_factory_posix.h" #include <grpc/impl/codegen/grpc_types.h> #include <grpc/support/sync.h> -#include <grpc/support/useful.h> void grpc_socket_factory_init(grpc_socket_factory* factory, const grpc_socket_factory_vtable* vtable) { diff --git a/src/core/lib/iomgr/socket_mutator.cc b/src/core/lib/iomgr/socket_mutator.cc index 9d30e46b6b..8c8f0e56e1 100644 --- a/src/core/lib/iomgr/socket_mutator.cc +++ b/src/core/lib/iomgr/socket_mutator.cc @@ -18,11 +18,11 @@ #include "src/core/lib/iomgr/socket_mutator.h" -#include "src/core/lib/channel/channel_args.h" - #include <grpc/impl/codegen/grpc_types.h> #include <grpc/support/sync.h> -#include <grpc/support/useful.h> + +#include "src/core/lib/channel/channel_args.h" +#include "src/core/lib/gpr/useful.h" void grpc_socket_mutator_init(grpc_socket_mutator* mutator, const grpc_socket_mutator_vtable* vtable) { diff --git a/src/core/lib/iomgr/tcp_client_windows.cc b/src/core/lib/iomgr/tcp_client_windows.cc index 97aa9237dc..d46569d7cc 100644 --- a/src/core/lib/iomgr/tcp_client_windows.cc +++ b/src/core/lib/iomgr/tcp_client_windows.cc @@ -28,7 +28,6 @@ #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/log_windows.h> -#include <grpc/support/useful.h> #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/iomgr/iocp_windows.h" diff --git a/src/core/lib/iomgr/tcp_posix.cc b/src/core/lib/iomgr/tcp_posix.cc index 07aed2d1fd..e78e19761a 100644 --- a/src/core/lib/iomgr/tcp_posix.cc +++ b/src/core/lib/iomgr/tcp_posix.cc @@ -37,12 +37,12 @@ #include <grpc/support/string_util.h> #include <grpc/support/sync.h> #include <grpc/support/time.h> -#include <grpc/support/useful.h> #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/debug/stats.h" #include "src/core/lib/debug/trace.h" #include "src/core/lib/gpr/string.h" +#include "src/core/lib/gpr/useful.h" #include "src/core/lib/iomgr/ev_posix.h" #include "src/core/lib/iomgr/executor.h" #include "src/core/lib/profiling/timers.h" diff --git a/src/core/lib/iomgr/tcp_server_posix.cc b/src/core/lib/iomgr/tcp_server_posix.cc index 2fa00a81d2..89d9160e02 100644 --- a/src/core/lib/iomgr/tcp_server_posix.cc +++ b/src/core/lib/iomgr/tcp_server_posix.cc @@ -42,7 +42,6 @@ #include <grpc/support/string_util.h> #include <grpc/support/sync.h> #include <grpc/support/time.h> -#include <grpc/support/useful.h> #include "src/core/lib/channel/channel_args.h" #include "src/core/lib/gpr/string.h" diff --git a/src/core/lib/iomgr/tcp_windows.cc b/src/core/lib/iomgr/tcp_windows.cc index 6d091b77bb..6777719785 100644 --- a/src/core/lib/iomgr/tcp_windows.cc +++ b/src/core/lib/iomgr/tcp_windows.cc @@ -30,8 +30,8 @@ #include <grpc/support/log.h> #include <grpc/support/log_windows.h> #include <grpc/support/string_util.h> -#include <grpc/support/useful.h> +#include "src/core/lib/gpr/useful.h" #include "src/core/lib/iomgr/iocp_windows.h" #include "src/core/lib/iomgr/sockaddr.h" #include "src/core/lib/iomgr/sockaddr_utils.h" diff --git a/src/core/lib/iomgr/timer_generic.cc b/src/core/lib/iomgr/timer_generic.cc index 177bdec8df..5d0fcdea4f 100644 --- a/src/core/lib/iomgr/timer_generic.cc +++ b/src/core/lib/iomgr/timer_generic.cc @@ -30,9 +30,10 @@ #include <grpc/support/string_util.h> #include <grpc/support/sync.h> #include <grpc/support/tls.h> -#include <grpc/support/useful.h> + #include "src/core/lib/debug/trace.h" #include "src/core/lib/gpr/spinlock.h" +#include "src/core/lib/gpr/useful.h" #include "src/core/lib/iomgr/time_averaged_stats.h" #include "src/core/lib/iomgr/timer_heap.h" diff --git a/src/core/lib/iomgr/timer_heap.cc b/src/core/lib/iomgr/timer_heap.cc index b350452c63..632928fafa 100644 --- a/src/core/lib/iomgr/timer_heap.cc +++ b/src/core/lib/iomgr/timer_heap.cc @@ -25,7 +25,8 @@ #include <string.h> #include <grpc/support/alloc.h> -#include <grpc/support/useful.h> + +#include "src/core/lib/gpr/useful.h" /* Adjusts a heap so as to move a hole at position i closer to the root, until a suitable position is found for element t. Then, copies t into that diff --git a/src/core/lib/iomgr/unix_sockets_posix.cc b/src/core/lib/iomgr/unix_sockets_posix.cc index af862c00dc..91b7cb1e59 100644 --- a/src/core/lib/iomgr/unix_sockets_posix.cc +++ b/src/core/lib/iomgr/unix_sockets_posix.cc @@ -30,7 +30,8 @@ #include <grpc/support/alloc.h> #include <grpc/support/log.h> -#include <grpc/support/useful.h> + +#include "src/core/lib/gpr/useful.h" void grpc_create_socketpair_if_unix(int sv[2]) { GPR_ASSERT(socketpair(AF_UNIX, SOCK_STREAM, 0, sv) == 0); diff --git a/src/core/lib/iomgr/wakeup_fd_cv.cc b/src/core/lib/iomgr/wakeup_fd_cv.cc index c785114212..4818cafe3d 100644 --- a/src/core/lib/iomgr/wakeup_fd_cv.cc +++ b/src/core/lib/iomgr/wakeup_fd_cv.cc @@ -30,7 +30,8 @@ #include <grpc/support/sync.h> #include <grpc/support/thd.h> #include <grpc/support/time.h> -#include <grpc/support/useful.h> + +#include "src/core/lib/gpr/useful.h" #define MAX_TABLE_RESIZE 256 diff --git a/src/core/lib/security/credentials/jwt/jwt_verifier.cc b/src/core/lib/security/credentials/jwt/jwt_verifier.cc index 860506df39..8b22307944 100644 --- a/src/core/lib/security/credentials/jwt/jwt_verifier.cc +++ b/src/core/lib/security/credentials/jwt/jwt_verifier.cc @@ -25,7 +25,6 @@ #include <grpc/support/log.h> #include <grpc/support/string_util.h> #include <grpc/support/sync.h> -#include <grpc/support/useful.h> extern "C" { #include <openssl/pem.h> diff --git a/src/core/lib/slice/b64.cc b/src/core/lib/slice/b64.cc index f36b13ef1b..5c6610c372 100644 --- a/src/core/lib/slice/b64.cc +++ b/src/core/lib/slice/b64.cc @@ -23,8 +23,8 @@ #include <grpc/support/alloc.h> #include <grpc/support/log.h> -#include <grpc/support/useful.h> +#include "src/core/lib/gpr/useful.h" #include "src/core/lib/slice/slice_internal.h" /* --- Constants. --- */ diff --git a/src/core/lib/slice/slice_buffer.cc b/src/core/lib/slice/slice_buffer.cc index 33ec2af683..178c7f9e94 100644 --- a/src/core/lib/slice/slice_buffer.cc +++ b/src/core/lib/slice/slice_buffer.cc @@ -23,8 +23,8 @@ #include <grpc/support/alloc.h> #include <grpc/support/log.h> -#include <grpc/support/useful.h> +#include "src/core/lib/gpr/useful.h" #include "src/core/lib/slice/slice_internal.h" /* grow a buffer; requires GRPC_SLICE_BUFFER_INLINE_ELEMENTS > 1 */ diff --git a/src/core/lib/surface/call.cc b/src/core/lib/surface/call.cc index f2096d8937..a77dc70ba0 100644 --- a/src/core/lib/surface/call.cc +++ b/src/core/lib/surface/call.cc @@ -28,13 +28,13 @@ #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/channel/channel_stack.h" #include "src/core/lib/compression/algorithm_metadata.h" #include "src/core/lib/debug/stats.h" #include "src/core/lib/gpr/arena.h" #include "src/core/lib/gpr/string.h" +#include "src/core/lib/gpr/useful.h" #include "src/core/lib/iomgr/timer.h" #include "src/core/lib/profiling/timers.h" #include "src/core/lib/slice/slice_internal.h" diff --git a/src/core/lib/surface/channel_init.cc b/src/core/lib/surface/channel_init.cc index 95cbbbd037..99690e63b4 100644 --- a/src/core/lib/surface/channel_init.cc +++ b/src/core/lib/surface/channel_init.cc @@ -19,7 +19,6 @@ #include "src/core/lib/surface/channel_init.h" #include <grpc/support/alloc.h> -#include <grpc/support/useful.h> typedef struct stage_slot { grpc_channel_init_stage fn; diff --git a/src/core/lib/surface/server.cc b/src/core/lib/surface/server.cc index c8c1db337f..1e59434aa5 100644 --- a/src/core/lib/surface/server.cc +++ b/src/core/lib/surface/server.cc @@ -25,7 +25,6 @@ #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/channel/channel_args.h" #include "src/core/lib/channel/connected_channel.h" diff --git a/src/core/lib/transport/bdp_estimator.cc b/src/core/lib/transport/bdp_estimator.cc index 5fcc62ec43..2ba1cfdaa6 100644 --- a/src/core/lib/transport/bdp_estimator.cc +++ b/src/core/lib/transport/bdp_estimator.cc @@ -21,7 +21,7 @@ #include <inttypes.h> #include <stdlib.h> -#include <grpc/support/useful.h> +#include "src/core/lib/gpr/useful.h" grpc_core::TraceFlag grpc_bdp_estimator_trace(false, "bdp_estimator"); diff --git a/src/core/lib/transport/metadata.h b/src/core/lib/transport/metadata.h index 78e6beff9b..82142ebed8 100644 --- a/src/core/lib/transport/metadata.h +++ b/src/core/lib/transport/metadata.h @@ -21,8 +21,8 @@ #include <grpc/grpc.h> #include <grpc/slice.h> -#include <grpc/support/useful.h> +#include "src/core/lib/gpr/useful.h" #include "src/core/lib/iomgr/exec_ctx.h" extern grpc_core::DebugOnlyTraceFlag grpc_trace_metadata; diff --git a/src/core/lib/transport/pid_controller.cc b/src/core/lib/transport/pid_controller.cc index e31cc85f76..b33ea63df6 100644 --- a/src/core/lib/transport/pid_controller.cc +++ b/src/core/lib/transport/pid_controller.cc @@ -17,7 +17,8 @@ */ #include "src/core/lib/transport/pid_controller.h" -#include <grpc/support/useful.h> + +#include "src/core/lib/gpr/useful.h" namespace grpc_core { diff --git a/src/core/lib/transport/transport_op_string.cc b/src/core/lib/transport/transport_op_string.cc index 58a21e9b60..6898da17ed 100644 --- a/src/core/lib/transport/transport_op_string.cc +++ b/src/core/lib/transport/transport_op_string.cc @@ -27,7 +27,6 @@ #include <grpc/support/alloc.h> #include <grpc/support/string_util.h> -#include <grpc/support/useful.h> #include "src/core/lib/gpr/string.h" #include "src/core/lib/slice/slice_string_helpers.h" #include "src/core/lib/transport/connectivity_state.h" diff --git a/src/core/tsi/fake_transport_security.cc b/src/core/tsi/fake_transport_security.cc index b907636f9d..7d5aaa7305 100644 --- a/src/core/tsi/fake_transport_security.cc +++ b/src/core/tsi/fake_transport_security.cc @@ -24,7 +24,8 @@ #include <grpc/support/alloc.h> #include <grpc/support/log.h> #include <grpc/support/port_platform.h> -#include <grpc/support/useful.h> + +#include "src/core/lib/gpr/useful.h" #include "src/core/lib/slice/slice_internal.h" #include "src/core/tsi/transport_security_grpc.h" diff --git a/src/core/tsi/ssl_transport_security.cc b/src/core/tsi/ssl_transport_security.cc index b396a621bd..6de02d4952 100644 --- a/src/core/tsi/ssl_transport_security.cc +++ b/src/core/tsi/ssl_transport_security.cc @@ -37,7 +37,6 @@ #include <grpc/support/log.h> #include <grpc/support/sync.h> #include <grpc/support/thd.h> -#include <grpc/support/useful.h> extern "C" { #include <openssl/bio.h> |