aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/client_config/lb_policy_registry.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/client_config/lb_policy_registry.c')
-rw-r--r--src/core/client_config/lb_policy_registry.c58
1 files changed, 35 insertions, 23 deletions
diff --git a/src/core/client_config/lb_policy_registry.c b/src/core/client_config/lb_policy_registry.c
index fc302e82d7..4d7cc7c128 100644
--- a/src/core/client_config/lb_policy_registry.c
+++ b/src/core/client_config/lb_policy_registry.c
@@ -42,47 +42,59 @@ static int g_number_of_lb_policies = 0;
static grpc_lb_policy_factory *g_default_lb_policy_factory;
-void grpc_lb_policy_registry_init(grpc_lb_policy_factory *default_factory) {
+void
+grpc_lb_policy_registry_init (grpc_lb_policy_factory * default_factory)
+{
g_number_of_lb_policies = 0;
g_default_lb_policy_factory = default_factory;
}
-void grpc_lb_policy_registry_shutdown(void) {
+void
+grpc_lb_policy_registry_shutdown (void)
+{
int i;
- for (i = 0; i < g_number_of_lb_policies; i++) {
- grpc_lb_policy_factory_unref(g_all_of_the_lb_policies[i]);
- }
+ for (i = 0; i < g_number_of_lb_policies; i++)
+ {
+ grpc_lb_policy_factory_unref (g_all_of_the_lb_policies[i]);
+ }
}
-void grpc_register_lb_policy(grpc_lb_policy_factory *factory) {
+void
+grpc_register_lb_policy (grpc_lb_policy_factory * factory)
+{
int i;
- for (i = 0; i < g_number_of_lb_policies; i++) {
- GPR_ASSERT(0 != strcmp(factory->vtable->name,
- g_all_of_the_lb_policies[i]->vtable->name));
- }
- GPR_ASSERT(g_number_of_lb_policies != MAX_POLICIES);
- grpc_lb_policy_factory_ref(factory);
+ for (i = 0; i < g_number_of_lb_policies; i++)
+ {
+ GPR_ASSERT (0 != strcmp (factory->vtable->name, g_all_of_the_lb_policies[i]->vtable->name));
+ }
+ GPR_ASSERT (g_number_of_lb_policies != MAX_POLICIES);
+ grpc_lb_policy_factory_ref (factory);
g_all_of_the_lb_policies[g_number_of_lb_policies++] = factory;
}
-static grpc_lb_policy_factory *lookup_factory(const char *name) {
+static grpc_lb_policy_factory *
+lookup_factory (const char *name)
+{
int i;
- if (name == NULL) return NULL;
+ if (name == NULL)
+ return NULL;
- for (i = 0; i < g_number_of_lb_policies; i++) {
- if (0 == strcmp(name, g_all_of_the_lb_policies[i]->vtable->name)) {
- return g_all_of_the_lb_policies[i];
+ for (i = 0; i < g_number_of_lb_policies; i++)
+ {
+ if (0 == strcmp (name, g_all_of_the_lb_policies[i]->vtable->name))
+ {
+ return g_all_of_the_lb_policies[i];
+ }
}
- }
return NULL;
}
-grpc_lb_policy *grpc_lb_policy_create(const char *name,
- grpc_lb_policy_args *args) {
- grpc_lb_policy_factory *factory = lookup_factory(name);
- grpc_lb_policy *lb_policy =
- grpc_lb_policy_factory_create_lb_policy(factory, args);
+grpc_lb_policy *
+grpc_lb_policy_create (const char *name, grpc_lb_policy_args * args)
+{
+ grpc_lb_policy_factory *factory = lookup_factory (name);
+ grpc_lb_policy *lb_policy = grpc_lb_policy_factory_create_lb_policy (factory, args);
return lb_policy;
}