diff options
Diffstat (limited to 'src')
79 files changed, 319 insertions, 211 deletions
diff --git a/src/core/ext/filters/client_channel/client_channel.cc b/src/core/ext/filters/client_channel/client_channel.cc index 6b93644430..e16f9e4c8f 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 d76c8069d5..3ec1b6f9fe 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 @@ -31,7 +31,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..0d38feb242 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/avl/avl.h" + // // server_retry_throttle_data // @@ -152,7 +153,7 @@ static void* copy_server_retry_throttle_data(void* value, void* unused) { static void destroy_server_name(void* key, void* unused) { gpr_free(key); } -static const gpr_avl_vtable avl_vtable = { +static const grpc_avl_vtable avl_vtable = { destroy_server_name, copy_server_name, compare_server_name, destroy_server_retry_throttle_data, copy_server_retry_throttle_data}; @@ -161,29 +162,29 @@ static const gpr_avl_vtable avl_vtable = { // static gpr_mu g_mu; -static gpr_avl g_avl; +static grpc_avl g_avl; void grpc_retry_throttle_map_init() { gpr_mu_init(&g_mu); - g_avl = gpr_avl_create(&avl_vtable); + g_avl = grpc_avl_create(&avl_vtable); } void grpc_retry_throttle_map_shutdown() { gpr_mu_destroy(&g_mu); - gpr_avl_unref(g_avl, nullptr); + grpc_avl_unref(g_avl, nullptr); } grpc_server_retry_throttle_data* grpc_retry_throttle_map_get_data_for_server( const char* server_name, int max_milli_tokens, int milli_token_ratio) { gpr_mu_lock(&g_mu); grpc_server_retry_throttle_data* throttle_data = - (grpc_server_retry_throttle_data*)gpr_avl_get(g_avl, (char*)server_name, - nullptr); + (grpc_server_retry_throttle_data*)grpc_avl_get(g_avl, (char*)server_name, + nullptr); if (throttle_data == nullptr) { // Entry not found. Create a new one. throttle_data = grpc_server_retry_throttle_data_create( max_milli_tokens, milli_token_ratio, nullptr); - g_avl = gpr_avl_add(g_avl, (char*)server_name, throttle_data, nullptr); + g_avl = grpc_avl_add(g_avl, (char*)server_name, throttle_data, nullptr); } else { if (throttle_data->max_milli_tokens != max_milli_tokens || throttle_data->milli_token_ratio != milli_token_ratio) { @@ -191,7 +192,7 @@ grpc_server_retry_throttle_data* grpc_retry_throttle_map_get_data_for_server( // the original one. throttle_data = grpc_server_retry_throttle_data_create( max_milli_tokens, milli_token_ratio, throttle_data); - g_avl = gpr_avl_add(g_avl, (char*)server_name, throttle_data, nullptr); + g_avl = grpc_avl_add(g_avl, (char*)server_name, throttle_data, nullptr); } else { // Entry found. Increase refcount. grpc_server_retry_throttle_data_ref(throttle_data); diff --git a/src/core/ext/filters/client_channel/subchannel.cc b/src/core/ext/filters/client_channel/subchannel.cc index 6bf710c948..6d4c4f931e 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..42647ea325 100644 --- a/src/core/ext/filters/client_channel/subchannel_index.cc +++ b/src/core/ext/filters/client_channel/subchannel_index.cc @@ -22,15 +22,15 @@ #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/avl/avl.h" #include "src/core/lib/channel/channel_args.h" // a map of subchannel_key --> subchannel, used for detecting connections // to the same destination in order to share them -static gpr_avl g_subchannel_index; +static grpc_avl g_subchannel_index; static gpr_mu g_mu; @@ -109,7 +109,7 @@ static void* scv_avl_copy(void* p, void* unused) { return p; } -static const gpr_avl_vtable subchannel_avl_vtable = { +static const grpc_avl_vtable subchannel_avl_vtable = { sck_avl_destroy, // destroy_key sck_avl_copy, // copy_key sck_avl_compare, // compare_keys @@ -118,7 +118,7 @@ static const gpr_avl_vtable subchannel_avl_vtable = { }; void grpc_subchannel_index_init(void) { - g_subchannel_index = gpr_avl_create(&subchannel_avl_vtable); + g_subchannel_index = grpc_avl_create(&subchannel_avl_vtable); gpr_mu_init(&g_mu); gpr_ref_init(&g_refcount, 1); } @@ -133,7 +133,7 @@ void grpc_subchannel_index_shutdown(void) { void grpc_subchannel_index_unref(void) { if (gpr_unref(&g_refcount)) { gpr_mu_destroy(&g_mu); - gpr_avl_unref(g_subchannel_index, grpc_core::ExecCtx::Get()); + grpc_avl_unref(g_subchannel_index, grpc_core::ExecCtx::Get()); } } @@ -143,13 +143,13 @@ grpc_subchannel* grpc_subchannel_index_find(grpc_subchannel_key* key) { // Lock, and take a reference to the subchannel index. // We don't need to do the search under a lock as avl's are immutable. gpr_mu_lock(&g_mu); - gpr_avl index = gpr_avl_ref(g_subchannel_index, grpc_core::ExecCtx::Get()); + grpc_avl index = grpc_avl_ref(g_subchannel_index, grpc_core::ExecCtx::Get()); gpr_mu_unlock(&g_mu); grpc_subchannel* c = GRPC_SUBCHANNEL_REF_FROM_WEAK_REF( - (grpc_subchannel*)gpr_avl_get(index, key, grpc_core::ExecCtx::Get()), + (grpc_subchannel*)grpc_avl_get(index, key, grpc_core::ExecCtx::Get()), "index_find"); - gpr_avl_unref(index, grpc_core::ExecCtx::Get()); + grpc_avl_unref(index, grpc_core::ExecCtx::Get()); return c; } @@ -165,11 +165,12 @@ grpc_subchannel* grpc_subchannel_index_register(grpc_subchannel_key* key, // Compare and swap loop: // - take a reference to the current index gpr_mu_lock(&g_mu); - gpr_avl index = gpr_avl_ref(g_subchannel_index, grpc_core::ExecCtx::Get()); + grpc_avl index = + grpc_avl_ref(g_subchannel_index, grpc_core::ExecCtx::Get()); gpr_mu_unlock(&g_mu); // - Check to see if a subchannel already exists - c = (grpc_subchannel*)gpr_avl_get(index, key, grpc_core::ExecCtx::Get()); + c = (grpc_subchannel*)grpc_avl_get(index, key, grpc_core::ExecCtx::Get()); if (c != nullptr) { c = GRPC_SUBCHANNEL_REF_FROM_WEAK_REF(c, "index_register"); } @@ -178,25 +179,25 @@ grpc_subchannel* grpc_subchannel_index_register(grpc_subchannel_key* key, need_to_unref_constructed = true; } else { // no -> update the avl and compare/swap - gpr_avl updated = - gpr_avl_add(gpr_avl_ref(index, grpc_core::ExecCtx::Get()), - subchannel_key_copy(key), - GRPC_SUBCHANNEL_WEAK_REF(constructed, "index_register"), - grpc_core::ExecCtx::Get()); + grpc_avl updated = + grpc_avl_add(grpc_avl_ref(index, grpc_core::ExecCtx::Get()), + subchannel_key_copy(key), + GRPC_SUBCHANNEL_WEAK_REF(constructed, "index_register"), + grpc_core::ExecCtx::Get()); // it may happen (but it's expected to be unlikely) // that some other thread has changed the index: // compare/swap here to check that, and retry as necessary gpr_mu_lock(&g_mu); if (index.root == g_subchannel_index.root) { - GPR_SWAP(gpr_avl, updated, g_subchannel_index); + GPR_SWAP(grpc_avl, updated, g_subchannel_index); c = constructed; } gpr_mu_unlock(&g_mu); - gpr_avl_unref(updated, grpc_core::ExecCtx::Get()); + grpc_avl_unref(updated, grpc_core::ExecCtx::Get()); } - gpr_avl_unref(index, grpc_core::ExecCtx::Get()); + grpc_avl_unref(index, grpc_core::ExecCtx::Get()); } if (need_to_unref_constructed) { @@ -213,33 +214,34 @@ void grpc_subchannel_index_unregister(grpc_subchannel_key* key, // Compare and swap loop: // - take a reference to the current index gpr_mu_lock(&g_mu); - gpr_avl index = gpr_avl_ref(g_subchannel_index, grpc_core::ExecCtx::Get()); + grpc_avl index = + grpc_avl_ref(g_subchannel_index, grpc_core::ExecCtx::Get()); gpr_mu_unlock(&g_mu); // Check to see if this key still refers to the previously // registered subchannel grpc_subchannel* c = - (grpc_subchannel*)gpr_avl_get(index, key, grpc_core::ExecCtx::Get()); + (grpc_subchannel*)grpc_avl_get(index, key, grpc_core::ExecCtx::Get()); if (c != constructed) { - gpr_avl_unref(index, grpc_core::ExecCtx::Get()); + grpc_avl_unref(index, grpc_core::ExecCtx::Get()); break; } // compare and swap the update (some other thread may have // mutated the index behind us) - gpr_avl updated = - gpr_avl_remove(gpr_avl_ref(index, grpc_core::ExecCtx::Get()), key, - grpc_core::ExecCtx::Get()); + grpc_avl updated = + grpc_avl_remove(grpc_avl_ref(index, grpc_core::ExecCtx::Get()), key, + grpc_core::ExecCtx::Get()); gpr_mu_lock(&g_mu); if (index.root == g_subchannel_index.root) { - GPR_SWAP(gpr_avl, updated, g_subchannel_index); + GPR_SWAP(grpc_avl, updated, g_subchannel_index); done = true; } gpr_mu_unlock(&g_mu); - gpr_avl_unref(updated, grpc_core::ExecCtx::Get()); - gpr_avl_unref(index, grpc_core::ExecCtx::Get()); + grpc_avl_unref(updated, grpc_core::ExecCtx::Get()); + grpc_avl_unref(index, grpc_core::ExecCtx::Get()); } } 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 6301d69faf..e23c07f16c 100644 --- a/src/core/ext/transport/cronet/transport/cronet_transport.cc +++ b/src/core/ext/transport/cronet/transport/cronet_transport.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/incoming_metadata.h" #include "src/core/ext/transport/cronet/transport/cronet_transport.h" diff --git a/src/core/lib/gpr/avl.cc b/src/core/lib/avl/avl.cc index 0b67a21f2f..acc0432af7 100644 --- a/src/core/lib/gpr/avl.cc +++ b/src/core/lib/avl/avl.cc @@ -16,30 +16,31 @@ * */ -#include <grpc/support/avl.h> +#include "src/core/lib/avl/avl.h" #include <assert.h> #include <stdlib.h> #include <grpc/support/alloc.h> #include <grpc/support/string_util.h> -#include <grpc/support/useful.h> -gpr_avl gpr_avl_create(const gpr_avl_vtable* vtable) { - gpr_avl out; +#include "src/core/lib/gpr/useful.h" + +grpc_avl grpc_avl_create(const grpc_avl_vtable* vtable) { + grpc_avl out; out.vtable = vtable; out.root = nullptr; return out; } -static gpr_avl_node* ref_node(gpr_avl_node* node) { +static grpc_avl_node* ref_node(grpc_avl_node* node) { if (node) { gpr_ref(&node->refs); } return node; } -static void unref_node(const gpr_avl_vtable* vtable, gpr_avl_node* node, +static void unref_node(const grpc_avl_vtable* vtable, grpc_avl_node* node, void* user_data) { if (node == nullptr) { return; @@ -53,18 +54,18 @@ static void unref_node(const gpr_avl_vtable* vtable, gpr_avl_node* node, } } -static long node_height(gpr_avl_node* node) { +static long node_height(grpc_avl_node* node) { return node == nullptr ? 0 : node->height; } #ifndef NDEBUG -static long calculate_height(gpr_avl_node* node) { +static long calculate_height(grpc_avl_node* node) { return node == nullptr ? 0 : 1 + GPR_MAX(calculate_height(node->left), calculate_height(node->right)); } -static gpr_avl_node* assert_invariants(gpr_avl_node* n) { +static grpc_avl_node* assert_invariants(grpc_avl_node* n) { if (n == nullptr) return nullptr; assert_invariants(n->left); assert_invariants(n->right); @@ -73,12 +74,12 @@ static gpr_avl_node* assert_invariants(gpr_avl_node* n) { return n; } #else -static gpr_avl_node* assert_invariants(gpr_avl_node* n) { return n; } +static grpc_avl_node* assert_invariants(grpc_avl_node* n) { return n; } #endif -gpr_avl_node* new_node(void* key, void* value, gpr_avl_node* left, - gpr_avl_node* right) { - gpr_avl_node* node = (gpr_avl_node*)gpr_malloc(sizeof(*node)); +grpc_avl_node* new_node(void* key, void* value, grpc_avl_node* left, + grpc_avl_node* right) { + grpc_avl_node* node = (grpc_avl_node*)gpr_malloc(sizeof(*node)); gpr_ref_init(&node->refs, 1); node->key = key; node->value = value; @@ -88,8 +89,8 @@ gpr_avl_node* new_node(void* key, void* value, gpr_avl_node* left, return node; } -static gpr_avl_node* get(const gpr_avl_vtable* vtable, gpr_avl_node* node, - void* key, void* user_data) { +static grpc_avl_node* get(const grpc_avl_vtable* vtable, grpc_avl_node* node, + void* key, void* user_data) { long cmp; if (node == nullptr) { @@ -106,13 +107,13 @@ static gpr_avl_node* get(const gpr_avl_vtable* vtable, gpr_avl_node* node, } } -void* gpr_avl_get(gpr_avl avl, void* key, void* user_data) { - gpr_avl_node* node = get(avl.vtable, avl.root, key, user_data); +void* grpc_avl_get(grpc_avl avl, void* key, void* user_data) { + grpc_avl_node* node = get(avl.vtable, avl.root, key, user_data); return node ? node->value : nullptr; } -int gpr_avl_maybe_get(gpr_avl avl, void* key, void** value, void* user_data) { - gpr_avl_node* node = get(avl.vtable, avl.root, key, user_data); +int grpc_avl_maybe_get(grpc_avl avl, void* key, void** value, void* user_data) { + grpc_avl_node* node = get(avl.vtable, avl.root, key, user_data); if (node != nullptr) { *value = node->value; return 1; @@ -120,21 +121,21 @@ int gpr_avl_maybe_get(gpr_avl avl, void* key, void** value, void* user_data) { return 0; } -static gpr_avl_node* rotate_left(const gpr_avl_vtable* vtable, void* key, - void* value, gpr_avl_node* left, - gpr_avl_node* right, void* user_data) { - gpr_avl_node* n = new_node(vtable->copy_key(right->key, user_data), - vtable->copy_value(right->value, user_data), - new_node(key, value, left, ref_node(right->left)), - ref_node(right->right)); +static grpc_avl_node* rotate_left(const grpc_avl_vtable* vtable, void* key, + void* value, grpc_avl_node* left, + grpc_avl_node* right, void* user_data) { + grpc_avl_node* n = new_node(vtable->copy_key(right->key, user_data), + vtable->copy_value(right->value, user_data), + new_node(key, value, left, ref_node(right->left)), + ref_node(right->right)); unref_node(vtable, right, user_data); return n; } -static gpr_avl_node* rotate_right(const gpr_avl_vtable* vtable, void* key, - void* value, gpr_avl_node* left, - gpr_avl_node* right, void* user_data) { - gpr_avl_node* n = +static grpc_avl_node* rotate_right(const grpc_avl_vtable* vtable, void* key, + void* value, grpc_avl_node* left, + grpc_avl_node* right, void* user_data) { + grpc_avl_node* n = new_node(vtable->copy_key(left->key, user_data), vtable->copy_value(left->value, user_data), ref_node(left->left), new_node(key, value, ref_node(left->right), right)); @@ -142,11 +143,12 @@ static gpr_avl_node* rotate_right(const gpr_avl_vtable* vtable, void* key, return n; } -static gpr_avl_node* rotate_left_right(const gpr_avl_vtable* vtable, void* key, - void* value, gpr_avl_node* left, - gpr_avl_node* right, void* user_data) { +static grpc_avl_node* rotate_left_right(const grpc_avl_vtable* vtable, + void* key, void* value, + grpc_avl_node* left, + grpc_avl_node* right, void* user_data) { /* rotate_right(..., rotate_left(left), right) */ - gpr_avl_node* n = + grpc_avl_node* n = new_node(vtable->copy_key(left->right->key, user_data), vtable->copy_value(left->right->value, user_data), new_node(vtable->copy_key(left->key, user_data), @@ -157,11 +159,12 @@ static gpr_avl_node* rotate_left_right(const gpr_avl_vtable* vtable, void* key, return n; } -static gpr_avl_node* rotate_right_left(const gpr_avl_vtable* vtable, void* key, - void* value, gpr_avl_node* left, - gpr_avl_node* right, void* user_data) { +static grpc_avl_node* rotate_right_left(const grpc_avl_vtable* vtable, + void* key, void* value, + grpc_avl_node* left, + grpc_avl_node* right, void* user_data) { /* rotate_left(..., left, rotate_right(right)) */ - gpr_avl_node* n = + grpc_avl_node* n = new_node(vtable->copy_key(right->left->key, user_data), vtable->copy_value(right->left->value, user_data), new_node(key, value, left, ref_node(right->left->left)), @@ -172,9 +175,9 @@ static gpr_avl_node* rotate_right_left(const gpr_avl_vtable* vtable, void* key, return n; } -static gpr_avl_node* rebalance(const gpr_avl_vtable* vtable, void* key, - void* value, gpr_avl_node* left, - gpr_avl_node* right, void* user_data) { +static grpc_avl_node* rebalance(const grpc_avl_vtable* vtable, void* key, + void* value, grpc_avl_node* left, + grpc_avl_node* right, void* user_data) { switch (node_height(left) - node_height(right)) { case 2: if (node_height(left->left) - node_height(left->right) == -1) { @@ -197,8 +200,9 @@ static gpr_avl_node* rebalance(const gpr_avl_vtable* vtable, void* key, } } -static gpr_avl_node* add_key(const gpr_avl_vtable* vtable, gpr_avl_node* node, - void* key, void* value, void* user_data) { +static grpc_avl_node* add_key(const grpc_avl_vtable* vtable, + grpc_avl_node* node, void* key, void* value, + void* user_data) { long cmp; if (node == nullptr) { return new_node(key, value, nullptr, nullptr); @@ -219,31 +223,31 @@ static gpr_avl_node* add_key(const gpr_avl_vtable* vtable, gpr_avl_node* node, } } -gpr_avl gpr_avl_add(gpr_avl avl, void* key, void* value, void* user_data) { - gpr_avl_node* old_root = avl.root; +grpc_avl grpc_avl_add(grpc_avl avl, void* key, void* value, void* user_data) { + grpc_avl_node* old_root = avl.root; avl.root = add_key(avl.vtable, avl.root, key, value, user_data); assert_invariants(avl.root); unref_node(avl.vtable, old_root, user_data); return avl; } -static gpr_avl_node* in_order_head(gpr_avl_node* node) { +static grpc_avl_node* in_order_head(grpc_avl_node* node) { while (node->left != nullptr) { node = node->left; } return node; } -static gpr_avl_node* in_order_tail(gpr_avl_node* node) { +static grpc_avl_node* in_order_tail(grpc_avl_node* node) { while (node->right != nullptr) { node = node->right; } return node; } -static gpr_avl_node* remove_key(const gpr_avl_vtable* vtable, - gpr_avl_node* node, void* key, - void* user_data) { +static grpc_avl_node* remove_key(const grpc_avl_vtable* vtable, + grpc_avl_node* node, void* key, + void* user_data) { long cmp; if (node == nullptr) { return nullptr; @@ -255,13 +259,13 @@ static gpr_avl_node* remove_key(const gpr_avl_vtable* vtable, } else if (node->right == nullptr) { return ref_node(node->left); } else if (node->left->height < node->right->height) { - gpr_avl_node* h = in_order_head(node->right); + grpc_avl_node* h = in_order_head(node->right); return rebalance( vtable, vtable->copy_key(h->key, user_data), vtable->copy_value(h->value, user_data), ref_node(node->left), remove_key(vtable, node->right, h->key, user_data), user_data); } else { - gpr_avl_node* h = in_order_tail(node->left); + grpc_avl_node* h = in_order_tail(node->left); return rebalance(vtable, vtable->copy_key(h->key, user_data), vtable->copy_value(h->value, user_data), remove_key(vtable, node->left, h->key, user_data), @@ -280,21 +284,21 @@ static gpr_avl_node* remove_key(const gpr_avl_vtable* vtable, } } -gpr_avl gpr_avl_remove(gpr_avl avl, void* key, void* user_data) { - gpr_avl_node* old_root = avl.root; +grpc_avl grpc_avl_remove(grpc_avl avl, void* key, void* user_data) { + grpc_avl_node* old_root = avl.root; avl.root = remove_key(avl.vtable, avl.root, key, user_data); assert_invariants(avl.root); unref_node(avl.vtable, old_root, user_data); return avl; } -gpr_avl gpr_avl_ref(gpr_avl avl, void* user_data) { +grpc_avl grpc_avl_ref(grpc_avl avl, void* user_data) { ref_node(avl.root); return avl; } -void gpr_avl_unref(gpr_avl avl, void* user_data) { +void grpc_avl_unref(grpc_avl avl, void* user_data) { unref_node(avl.vtable, avl.root, user_data); } -int gpr_avl_is_empty(gpr_avl avl) { return avl.root == nullptr; } +int grpc_avl_is_empty(grpc_avl avl) { return avl.root == nullptr; } diff --git a/src/core/lib/avl/avl.h b/src/core/lib/avl/avl.h new file mode 100644 index 0000000000..03d9bfd7bd --- /dev/null +++ b/src/core/lib/avl/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_GRPC_AVL_H +#define GRPC_CORE_LIB_GRPC_AVL_H + +#include <grpc/support/sync.h> + +/** internal node of an AVL tree */ +typedef struct grpc_avl_node { + gpr_refcount refs; + void* key; + void* value; + struct grpc_avl_node* left; + struct grpc_avl_node* right; + long height; +} grpc_avl_node; + +/** vtable for the AVL tree + * The optional user_data is propagated from the top level grpc_avl_XXX API. + * From the same API call, multiple vtable functions may be called multiple + * times. + */ +typedef struct grpc_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); +} grpc_avl_vtable; + +/** "pointer" to an AVL tree - this is a reference + counted object - use grpc_avl_ref to add a reference, + grpc_avl_unref when done with a reference */ +typedef struct grpc_avl { + const grpc_avl_vtable* vtable; + grpc_avl_node* root; +} grpc_avl; + +/** Create an immutable AVL tree. */ +grpc_avl grpc_avl_create(const grpc_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. */ +grpc_avl grpc_avl_ref(grpc_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 grpc_avl_unref(grpc_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. */ +grpc_avl grpc_avl_add(grpc_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. */ +grpc_avl grpc_avl_remove(grpc_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* grpc_avl_get(grpc_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 grpc_avl_maybe_get(grpc_avl avl, void* key, void** value, void* user_data); +/** Return 1 if avl is empty, 0 otherwise */ +int grpc_avl_is_empty(grpc_avl avl); + +#endif /* GRPC_CORE_LIB_GRPC_AVL_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 167e90fd26..69d70ea941 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 1b7ead3301..4bbaca2f98 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/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/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 30c7a89824..7697a85f2e 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 8ccc256222..179512b373 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 7ed2862903..3eea709ce4 100644 --- a/src/core/lib/iomgr/resolve_address_posix.cc +++ b/src/core/lib/iomgr/resolve_address_posix.cc @@ -31,10 +31,10 @@ #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/host_port.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 7252555bd0..6eb6fe3af5 100644 --- a/src/core/lib/iomgr/resolve_address_uv.cc +++ b/src/core/lib/iomgr/resolve_address_uv.cc @@ -24,9 +24,9 @@ #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/host_port.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 b538cc0212..a7b932b46d 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> diff --git a/src/cpp/client/channel_cc.cc b/src/cpp/client/channel_cc.cc index 362dff642c..e4ed3490fd 100644 --- a/src/cpp/client/channel_cc.cc +++ b/src/cpp/client/channel_cc.cc @@ -41,7 +41,6 @@ #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/env.h" #include "src/core/lib/gpr/string.h" #include "src/core/lib/profiling/timers.h" diff --git a/src/cpp/server/server_builder.cc b/src/cpp/server/server_builder.cc index 200e477822..790095e1f6 100644 --- a/src/cpp/server/server_builder.cc +++ b/src/cpp/server/server_builder.cc @@ -23,8 +23,8 @@ #include <grpc++/server.h> #include <grpc/support/cpu.h> #include <grpc/support/log.h> -#include <grpc/support/useful.h> +#include "src/core/lib/gpr/useful.h" #include "src/cpp/server/thread_pool_interface.h" namespace grpc { diff --git a/src/python/grpcio/grpc_core_dependencies.py b/src/python/grpcio/grpc_core_dependencies.py index 3d8ee10443..284c79b6ff 100644 --- a/src/python/grpcio/grpc_core_dependencies.py +++ b/src/python/grpcio/grpc_core_dependencies.py @@ -18,7 +18,6 @@ CORE_SOURCE_FILES = [ 'src/core/lib/gpr/alloc.cc', 'src/core/lib/gpr/arena.cc', 'src/core/lib/gpr/atm.cc', - 'src/core/lib/gpr/avl.cc', 'src/core/lib/gpr/cmdline.cc', 'src/core/lib/gpr/cpu_iphone.cc', 'src/core/lib/gpr/cpu_linux.cc', @@ -60,6 +59,7 @@ CORE_SOURCE_FILES = [ 'src/core/lib/profiling/basic_timers.cc', 'src/core/lib/profiling/stap_timers.cc', 'src/core/lib/surface/init.cc', + 'src/core/lib/avl/avl.cc', 'src/core/lib/backoff/backoff.cc', 'src/core/lib/channel/channel_args.cc', 'src/core/lib/channel/channel_stack.cc', diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.c b/src/ruby/ext/grpc/rb_grpc_imports.generated.c index f77c8b6ea8..10bda74d18 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.c +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.c @@ -199,14 +199,6 @@ gpr_malloc_aligned_type gpr_malloc_aligned_import; gpr_free_aligned_type gpr_free_aligned_import; gpr_set_allocation_functions_type gpr_set_allocation_functions_import; gpr_get_allocation_functions_type gpr_get_allocation_functions_import; -gpr_avl_create_type gpr_avl_create_import; -gpr_avl_ref_type gpr_avl_ref_import; -gpr_avl_unref_type gpr_avl_unref_import; -gpr_avl_add_type gpr_avl_add_import; -gpr_avl_remove_type gpr_avl_remove_import; -gpr_avl_get_type gpr_avl_get_import; -gpr_avl_maybe_get_type gpr_avl_maybe_get_import; -gpr_avl_is_empty_type gpr_avl_is_empty_import; gpr_cmdline_create_type gpr_cmdline_create_import; gpr_cmdline_add_int_type gpr_cmdline_add_int_import; gpr_cmdline_add_flag_type gpr_cmdline_add_flag_import; @@ -464,14 +456,6 @@ void grpc_rb_load_imports(HMODULE library) { gpr_free_aligned_import = (gpr_free_aligned_type) GetProcAddress(library, "gpr_free_aligned"); gpr_set_allocation_functions_import = (gpr_set_allocation_functions_type) GetProcAddress(library, "gpr_set_allocation_functions"); gpr_get_allocation_functions_import = (gpr_get_allocation_functions_type) GetProcAddress(library, "gpr_get_allocation_functions"); - gpr_avl_create_import = (gpr_avl_create_type) GetProcAddress(library, "gpr_avl_create"); - gpr_avl_ref_import = (gpr_avl_ref_type) GetProcAddress(library, "gpr_avl_ref"); - gpr_avl_unref_import = (gpr_avl_unref_type) GetProcAddress(library, "gpr_avl_unref"); - gpr_avl_add_import = (gpr_avl_add_type) GetProcAddress(library, "gpr_avl_add"); - gpr_avl_remove_import = (gpr_avl_remove_type) GetProcAddress(library, "gpr_avl_remove"); - gpr_avl_get_import = (gpr_avl_get_type) GetProcAddress(library, "gpr_avl_get"); - gpr_avl_maybe_get_import = (gpr_avl_maybe_get_type) GetProcAddress(library, "gpr_avl_maybe_get"); - gpr_avl_is_empty_import = (gpr_avl_is_empty_type) GetProcAddress(library, "gpr_avl_is_empty"); gpr_cmdline_create_import = (gpr_cmdline_create_type) GetProcAddress(library, "gpr_cmdline_create"); gpr_cmdline_add_int_import = (gpr_cmdline_add_int_type) GetProcAddress(library, "gpr_cmdline_add_int"); gpr_cmdline_add_flag_import = (gpr_cmdline_add_flag_type) GetProcAddress(library, "gpr_cmdline_add_flag"); diff --git a/src/ruby/ext/grpc/rb_grpc_imports.generated.h b/src/ruby/ext/grpc/rb_grpc_imports.generated.h index caa0591e05..ba0ba580c8 100644 --- a/src/ruby/ext/grpc/rb_grpc_imports.generated.h +++ b/src/ruby/ext/grpc/rb_grpc_imports.generated.h @@ -33,7 +33,6 @@ #include <grpc/slice.h> #include <grpc/slice_buffer.h> #include <grpc/support/alloc.h> -#include <grpc/support/avl.h> #include <grpc/support/cmdline.h> #include <grpc/support/cpu.h> #include <grpc/support/log.h> @@ -575,30 +574,6 @@ extern gpr_set_allocation_functions_type gpr_set_allocation_functions_import; typedef gpr_allocation_functions(*gpr_get_allocation_functions_type)(void); extern gpr_get_allocation_functions_type gpr_get_allocation_functions_import; #define gpr_get_allocation_functions gpr_get_allocation_functions_import -typedef gpr_avl(*gpr_avl_create_type)(const gpr_avl_vtable* vtable); -extern gpr_avl_create_type gpr_avl_create_import; -#define gpr_avl_create gpr_avl_create_import -typedef gpr_avl(*gpr_avl_ref_type)(gpr_avl avl, void* user_data); -extern gpr_avl_ref_type gpr_avl_ref_import; -#define gpr_avl_ref gpr_avl_ref_import -typedef void(*gpr_avl_unref_type)(gpr_avl avl, void* user_data); -extern gpr_avl_unref_type gpr_avl_unref_import; -#define gpr_avl_unref gpr_avl_unref_import -typedef gpr_avl(*gpr_avl_add_type)(gpr_avl avl, void* key, void* value, void* user_data); -extern gpr_avl_add_type gpr_avl_add_import; -#define gpr_avl_add gpr_avl_add_import -typedef gpr_avl(*gpr_avl_remove_type)(gpr_avl avl, void* key, void* user_data); -extern gpr_avl_remove_type gpr_avl_remove_import; -#define gpr_avl_remove gpr_avl_remove_import -typedef void*(*gpr_avl_get_type)(gpr_avl avl, void* key, void* user_data); -extern gpr_avl_get_type gpr_avl_get_import; -#define gpr_avl_get gpr_avl_get_import -typedef int(*gpr_avl_maybe_get_type)(gpr_avl avl, void* key, void** value, void* user_data); -extern gpr_avl_maybe_get_type gpr_avl_maybe_get_import; -#define gpr_avl_maybe_get gpr_avl_maybe_get_import -typedef int(*gpr_avl_is_empty_type)(gpr_avl avl); -extern gpr_avl_is_empty_type gpr_avl_is_empty_import; -#define gpr_avl_is_empty gpr_avl_is_empty_import typedef gpr_cmdline*(*gpr_cmdline_create_type)(const char* description); extern gpr_cmdline_create_type gpr_cmdline_create_import; #define gpr_cmdline_create gpr_cmdline_create_import |