Const correct and clang

pull/11770/head
ncteisen 7 years ago
parent b9b376ccd4
commit 139072ff92
  1. 2
      src/core/lib/support/env.h
  2. 15
      src/core/lib/support/env_linux.c
  3. 2
      src/core/lib/support/env_posix.c
  4. 2
      src/core/lib/support/env_windows.c
  5. 5
      src/core/lib/support/log.c
  6. 1
      src/cpp/server/server_builder.cc

@ -40,7 +40,7 @@ void gpr_setenv(const char *name, const char *value);
use an insecure version of the function. It is ONLY to be used to solve the
problem in which we need to check an env variable to configure the verbosity
level of logging. So DO NOT USE THIS. */
char *gpr_getenv_silent(const char *name, char** dst);
const char *gpr_getenv_silent(const char *name, char **dst);
#ifdef __cplusplus
}

@ -38,10 +38,10 @@
#include "src/core/lib/support/string.h"
char *gpr_getenv_silent(const char *name, char** dst) {
char* insecure_func_used = NULL;
char* result = NULL;
#if defined(GPR_BACKWARDS_COMPATIBILITY_MODE)
const char *gpr_getenv_silent(const char *name, char **dst) {
const char *insecure_func_used = NULL;
char *result = NULL;
#if defined(GPR_BACKWARDS_COMPATIBILITY_MODE)
typedef char *(*getenv_type)(const char *);
static getenv_type getenv_func = NULL;
/* Check to see which getenv variant is supported (go from most
@ -65,11 +65,10 @@ char *gpr_getenv_silent(const char *name, char** dst) {
}
char *gpr_getenv(const char *name) {
char* result = NULL;
char* insecure_func_used = gpr_getenv_silent(name, &result);
char *result = NULL;
const char *insecure_func_used = gpr_getenv_silent(name, &result);
if (insecure_func_used != NULL) {
gpr_log(GPR_DEBUG,
"Warning: insecure environment read function '%s' used",
gpr_log(GPR_DEBUG, "Warning: insecure environment read function '%s' used",
insecure_func_used);
}
return result;

@ -29,7 +29,7 @@
#include <grpc/support/string_util.h>
#include "src/core/lib/support/string.h"
char *gpr_getenv_silent(const char *name, char **dst) {
const char *gpr_getenv_silent(const char *name, char **dst) {
*dst = gpr_getenv(name);
return NULL;
}

@ -30,7 +30,7 @@
#include <grpc/support/log.h>
#include <grpc/support/string_util.h>
char *gpr_getenv_silent(const char *name, char **dst) {
const char *gpr_getenv_silent(const char *name, char **dst) {
*dst = gpr_getenv(name);
return NULL;
}

@ -65,7 +65,7 @@ void gpr_set_log_verbosity(gpr_log_severity min_severity_to_print) {
void gpr_log_verbosity_init() {
char *verbosity = NULL;
char *insecure_getenv = gpr_getenv_silent("GRPC_VERBOSITY", &verbosity);
const char *insecure_getenv = gpr_getenv_silent("GRPC_VERBOSITY", &verbosity);
gpr_atm min_severity_to_print = GPR_LOG_SEVERITY_ERROR;
if (verbosity != NULL) {
@ -84,8 +84,7 @@ void gpr_log_verbosity_init() {
}
if (insecure_getenv != NULL) {
gpr_log(GPR_DEBUG,
"Warning: insecure environment read function '%s' used",
gpr_log(GPR_DEBUG, "Warning: insecure environment read function '%s' used",
insecure_getenv);
}
}

@ -250,7 +250,6 @@ std::unique_ptr<Server> ServerBuilder::BuildAndStart() {
has_sync_methods && num_frequently_polled_cqs > 0;
if (has_sync_methods) {
grpc_cq_polling_type polling_type =
is_hybrid_server ? GRPC_CQ_NON_POLLING : GRPC_CQ_DEFAULT_POLLING;

Loading…
Cancel
Save