diff options
Diffstat (limited to 'src/core/lib')
-rw-r--r-- | src/core/lib/json/json.c | 6 | ||||
-rw-r--r-- | src/core/lib/json/json.h | 22 | ||||
-rw-r--r-- | src/core/lib/support/string.c | 4 | ||||
-rw-r--r-- | src/core/lib/support/string.h | 2 | ||||
-rw-r--r-- | src/core/lib/transport/method_config.c | 8 |
5 files changed, 20 insertions, 22 deletions
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) { |