aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2015-08-25 11:20:02 -0700
committerGravatar Craig Tiller <ctiller@google.com>2015-08-25 11:20:02 -0700
commitc9a3b0d55fc9bf29522699f4be8267b2eb2fdc24 (patch)
treefddedcbec290a6a4a7a6725f576c32a5039c7eff
parent775ec1decd597d9ecdf916e3d220b44283075ed9 (diff)
Respond to review
-rw-r--r--src/core/client_config/resolver_factory.c4
-rw-r--r--src/core/client_config/resolver_registry.c27
2 files changed, 17 insertions, 14 deletions
diff --git a/src/core/client_config/resolver_factory.c b/src/core/client_config/resolver_factory.c
index bf631cefd1..5b859a8d10 100644
--- a/src/core/client_config/resolver_factory.c
+++ b/src/core/client_config/resolver_factory.c
@@ -45,12 +45,12 @@ void grpc_resolver_factory_unref(grpc_resolver_factory *factory) {
grpc_resolver *grpc_resolver_factory_create_resolver(
grpc_resolver_factory *factory, grpc_uri *uri,
grpc_subchannel_factory *subchannel_factory) {
- if (!factory) return NULL;
+ if (factory == NULL) return NULL;
return factory->vtable->create_resolver(factory, uri, subchannel_factory);
}
char *grpc_resolver_factory_get_default_authority(
grpc_resolver_factory *factory, grpc_uri *uri) {
- if (!factory) return NULL;
+ if (factory == NULL) return NULL;
return factory->vtable->get_default_authority(factory, uri);
}
diff --git a/src/core/client_config/resolver_registry.c b/src/core/client_config/resolver_registry.c
index 3aff4630fb..af263df26a 100644
--- a/src/core/client_config/resolver_registry.c
+++ b/src/core/client_config/resolver_registry.c
@@ -92,20 +92,23 @@ static grpc_resolver_factory *resolve_factory(const char *target,
*uri = grpc_uri_parse(target, 1);
factory = lookup_factory(*uri);
- if (factory == NULL && g_default_resolver_prefix != NULL) {
- grpc_uri_destroy(*uri);
- gpr_asprintf(&tmp, "%s%s", g_default_resolver_prefix, target);
- *uri = grpc_uri_parse(tmp, 1);
- factory = lookup_factory(*uri);
- if (factory == NULL) {
+ if (factory == NULL) {
+ if (g_default_resolver_prefix != NULL) {
+ grpc_uri_destroy(*uri);
+ gpr_asprintf(&tmp, "%s%s", g_default_resolver_prefix, target);
+ *uri = grpc_uri_parse(tmp, 1);
+ factory = lookup_factory(*uri);
+ if (factory == NULL) {
+ grpc_uri_destroy(grpc_uri_parse(target, 0));
+ grpc_uri_destroy(grpc_uri_parse(tmp, 0));
+ gpr_log(GPR_ERROR, "don't know how to resolve '%s' or '%s'", target,
+ tmp);
+ }
+ gpr_free(tmp);
+ } else {
grpc_uri_destroy(grpc_uri_parse(target, 0));
- grpc_uri_destroy(grpc_uri_parse(tmp, 0));
- gpr_log(GPR_ERROR, "don't know how to resolve '%s' or '%s'", target, tmp);
+ gpr_log(GPR_ERROR, "don't know how to resolve '%s'", target);
}
- gpr_free(tmp);
- } else if (factory == NULL) {
- grpc_uri_destroy(grpc_uri_parse(target, 0));
- gpr_log(GPR_ERROR, "don't know how to resolve '%s'", target);
}
return factory;
}