aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/ext/client_channel/client_channel.c12
-rw-r--r--src/core/lib/json/json.c6
-rw-r--r--src/core/lib/json/json.h22
-rw-r--r--src/core/lib/support/string.c4
-rw-r--r--src/core/lib/support/string.h2
-rw-r--r--src/core/lib/transport/method_config.c8
6 files changed, 26 insertions, 28 deletions
diff --git a/src/core/ext/client_channel/client_channel.c b/src/core/ext/client_channel/client_channel.c
index d53265bc9c..4ca24c4dbc 100644
--- a/src/core/ext/client_channel/client_channel.c
+++ b/src/core/ext/client_channel/client_channel.c
@@ -86,21 +86,21 @@ static const grpc_mdstr_hash_table_vtable method_parameters_vtable = {
static void *method_parameters_create_from_json(const grpc_json *json) {
wait_for_ready_value wait_for_ready = WAIT_FOR_READY_UNSET;
- gpr_timespec timeout = { 0, 0, GPR_TIMESPAN };
- for (grpc_json* field = json->child; field != NULL; field = field->next) {
+ gpr_timespec timeout = {0, 0, GPR_TIMESPAN};
+ for (grpc_json *field = json->child; field != NULL; field = field->next) {
if (field->key == NULL) continue;
if (strcmp(field->key, "wait_for_ready") == 0) {
if (wait_for_ready != WAIT_FOR_READY_UNSET) return NULL; // Duplicate.
if (field->type != GRPC_JSON_TRUE && field->type != GRPC_JSON_FALSE) {
return NULL;
}
- wait_for_ready = field->type == GRPC_JSON_TRUE
- ? WAIT_FOR_READY_TRUE : WAIT_FOR_READY_FALSE;
+ wait_for_ready = field->type == GRPC_JSON_TRUE ? WAIT_FOR_READY_TRUE
+ : WAIT_FOR_READY_FALSE;
} else if (strcmp(field->key, "timeout") == 0) {
if (timeout.tv_sec > 0 || timeout.tv_nsec > 0) return NULL; // Duplicate.
if (field->type != GRPC_JSON_OBJECT) return NULL;
if (field->child == NULL) return NULL;
- for (grpc_json* subfield = field->child; subfield != NULL;
+ for (grpc_json *subfield = field->child; subfield != NULL;
subfield = subfield->next) {
if (subfield->key == NULL) return NULL;
if (strcmp(subfield->key, "seconds") == 0) {
@@ -303,7 +303,7 @@ static void on_resolver_result_changed(grpc_exec_ctx *exec_ctx, void *arg,
grpc_channel_args_find(lb_policy_args.args, GRPC_ARG_SERVICE_CONFIG);
if (channel_arg != NULL) {
GPR_ASSERT(channel_arg->type == GRPC_ARG_POINTER);
- grpc_json_tree* json_tree = channel_arg->value.pointer.p;
+ grpc_json_tree *json_tree = channel_arg->value.pointer.p;
method_params_table = grpc_method_config_table_create_from_json(
json_tree->root, method_parameters_create_from_json,
&method_parameters_vtable);
diff --git a/src/core/lib/json/json.c b/src/core/lib/json/json.c
index c1a99df6c3..9acf3b0438 100644
--- a/src/core/lib/json/json.c
+++ b/src/core/lib/json/json.c
@@ -39,15 +39,15 @@
#include "src/core/lib/json/json.h"
-grpc_json *grpc_json_create(grpc_json_type type) {
- grpc_json *json = gpr_malloc(sizeof(*json));
+grpc_json* grpc_json_create(grpc_json_type type) {
+ grpc_json* json = gpr_malloc(sizeof(*json));
memset(json, 0, sizeof(*json));
json->type = type;
return json;
}
-void grpc_json_destroy(grpc_json *json) {
+void grpc_json_destroy(grpc_json* json) {
while (json->child) {
grpc_json_destroy(json->child);
}
diff --git a/src/core/lib/json/json.h b/src/core/lib/json/json.h
index e18ace7547..1663c690e5 100644
--- a/src/core/lib/json/json.h
+++ b/src/core/lib/json/json.h
@@ -44,14 +44,14 @@
* are not owned by it.
*/
typedef struct grpc_json {
- struct grpc_json *next;
- struct grpc_json *prev;
- struct grpc_json *child;
- struct grpc_json *parent;
+ struct grpc_json* next;
+ struct grpc_json* prev;
+ struct grpc_json* child;
+ struct grpc_json* parent;
grpc_json_type type;
- const char *key;
- const char *value;
+ const char* key;
+ const char* value;
} grpc_json;
/* The next two functions are going to parse the input string, and
@@ -67,8 +67,8 @@ typedef struct grpc_json {
*
* Delete the allocated tree afterward using grpc_json_destroy().
*/
-grpc_json *grpc_json_parse_string_with_len(char *input, size_t size);
-grpc_json *grpc_json_parse_string(char *input);
+grpc_json* grpc_json_parse_string_with_len(char* input, size_t size);
+grpc_json* grpc_json_parse_string(char* input);
/* This function will create a new string using gpr_realloc, and will
* deserialize the grpc_json tree into it. It'll be zero-terminated,
@@ -78,14 +78,14 @@ grpc_json *grpc_json_parse_string(char *input);
* If indent is 0, then newlines will be suppressed as well, and the
* output will be condensed at its maximum.
*/
-char *grpc_json_dump_to_string(grpc_json *json, int indent);
+char* grpc_json_dump_to_string(grpc_json* json, int indent);
/* Use these to create or delete a grpc_json object.
* Deletion is recursive. We will not attempt to free any of the strings
* in any of the objects of that tree.
*/
-grpc_json *grpc_json_create(grpc_json_type type);
-void grpc_json_destroy(grpc_json *json);
+grpc_json* grpc_json_create(grpc_json_type type);
+void grpc_json_destroy(grpc_json* json);
/* Compares two JSON trees. */
int grpc_json_cmp(const grpc_json* json1, const grpc_json* json2);
diff --git a/src/core/lib/support/string.c b/src/core/lib/support/string.c
index 56f29492bf..165b3189a5 100644
--- a/src/core/lib/support/string.c
+++ b/src/core/lib/support/string.c
@@ -196,8 +196,8 @@ int int64_ttoa(int64_t value, char *string) {
return i;
}
-int gpr_parse_nonnegative_number(const char* value) {
- char* end;
+int gpr_parse_nonnegative_number(const char *value) {
+ char *end;
long result = strtol(value, &end, 0);
if (*end != '\0' || result < 0 || result > INT_MAX) return -1;
return (int)result;
diff --git a/src/core/lib/support/string.h b/src/core/lib/support/string.h
index 3a5a8ed826..34fd154a83 100644
--- a/src/core/lib/support/string.h
+++ b/src/core/lib/support/string.h
@@ -81,7 +81,7 @@ where long is 32bit is size.*/
int int64_ttoa(int64_t value, char *output);
// Parses a non-negative number from a value string. Returns -1 on error.
-int gpr_parse_nonnegative_number(const char* value);
+int gpr_parse_nonnegative_number(const char *value);
/* Reverse a run of bytes */
void gpr_reverse_bytes(char *str, int len);
diff --git a/src/core/lib/transport/method_config.c b/src/core/lib/transport/method_config.c
index a163af91d6..1ce43ca13f 100644
--- a/src/core/lib/transport/method_config.c
+++ b/src/core/lib/transport/method_config.c
@@ -80,10 +80,9 @@ static char* parse_json_method_name(grpc_json* json) {
// Parses the method config from \a json. Adds an entry to \a entries for
// each name found, incrementing \a idx for each entry added.
static bool parse_json_method_config(
- grpc_json* json,
- void* (*create_value)(const grpc_json* method_config_json),
+ grpc_json* json, void* (*create_value)(const grpc_json* method_config_json),
const grpc_mdstr_hash_table_vtable* vtable,
- grpc_mdstr_hash_table_entry* entries, size_t *idx) {
+ grpc_mdstr_hash_table_entry* entries, size_t* idx) {
// Construct value.
void* method_config = create_value(json);
if (method_config == NULL) return NULL;
@@ -135,8 +134,7 @@ grpc_mdstr_hash_table* grpc_method_config_table_create_from_json(
num_entries += count_names_in_method_config_json(method);
}
// Populate method config table entries.
- entries =
- gpr_malloc(num_entries * sizeof(grpc_mdstr_hash_table_entry));
+ entries = gpr_malloc(num_entries * sizeof(grpc_mdstr_hash_table_entry));
size_t idx = 0;
for (grpc_json* method = field->child; method != NULL;
method = method->next) {