Only use static on string literals

pull/10109/head
Noah Eisen 8 years ago committed by ncteisen
parent 6fd36b575b
commit 3005ce8dda
  1. 2
      src/core/ext/transport/cronet/transport/cronet_transport.c
  2. 2
      src/core/lib/channel/http_server_filter.c
  3. 2
      src/core/lib/iomgr/ev_epoll_linux.c
  4. 2
      src/core/lib/security/transport/server_auth_filter.c
  5. 2
      src/core/lib/surface/validate_metadata.c
  6. 2
      src/core/lib/transport/metadata_batch.c
  7. 5
      test/core/iomgr/tcp_client_uv_test.c
  8. 3
      test/core/iomgr/tcp_server_uv_test.c

@ -288,7 +288,7 @@ static void maybe_flush_read(stream_obj *s) {
} }
static grpc_error *make_error_with_desc(int error_code, const char *desc) { static grpc_error *make_error_with_desc(int error_code, const char *desc) {
grpc_error *error = GRPC_ERROR_CREATE_FROM_STATIC_STRING(desc); grpc_error *error = GRPC_ERROR_CREATE_FROM_COPIED_STRING(desc);
error = grpc_error_set_int(error, GRPC_ERROR_INT_GRPC_STATUS, error_code); error = grpc_error_set_int(error, GRPC_ERROR_INT_GRPC_STATUS, error_code);
return error; return error;
} }

@ -101,7 +101,7 @@ static void add_error(const char *error_name, grpc_error **cumulative,
grpc_error *new) { grpc_error *new) {
if (new == GRPC_ERROR_NONE) return; if (new == GRPC_ERROR_NONE) return;
if (*cumulative == GRPC_ERROR_NONE) { if (*cumulative == GRPC_ERROR_NONE) {
*cumulative = GRPC_ERROR_CREATE_FROM_STATIC_STRING(error_name); *cumulative = GRPC_ERROR_CREATE_FROM_COPIED_STRING(error_name);
} }
*cumulative = grpc_error_add_child(*cumulative, new); *cumulative = grpc_error_add_child(*cumulative, new);
} }

@ -321,7 +321,7 @@ static bool append_error(grpc_error **composite, grpc_error *error,
const char *desc) { const char *desc) {
if (error == GRPC_ERROR_NONE) return true; if (error == GRPC_ERROR_NONE) return true;
if (*composite == GRPC_ERROR_NONE) { if (*composite == GRPC_ERROR_NONE) {
*composite = GRPC_ERROR_CREATE_FROM_STATIC_STRING(desc); *composite = GRPC_ERROR_CREATE_FROM_COPIED_STRING(desc);
} }
*composite = grpc_error_add_child(*composite, error); *composite = grpc_error_add_child(*composite, error);
return false; return false;

@ -146,7 +146,7 @@ static void on_md_processing_done(
calld->transport_op->send_trailing_metadata = NULL; calld->transport_op->send_trailing_metadata = NULL;
grpc_closure_sched( grpc_closure_sched(
&exec_ctx, calld->on_done_recv, &exec_ctx, calld->on_done_recv,
grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING(error_details), grpc_error_set_int(GRPC_ERROR_CREATE_FROM_COPIED_STRING(error_details),
GRPC_ERROR_INT_GRPC_STATUS, status)); GRPC_ERROR_INT_GRPC_STATUS, status));
} }

@ -53,7 +53,7 @@ static grpc_error *conforms_to(grpc_slice slice, const uint8_t *legal_bits,
if ((legal_bits[byte] & (1 << bit)) == 0) { if ((legal_bits[byte] & (1 << bit)) == 0) {
char *dump = grpc_dump_slice(slice, GPR_DUMP_HEX | GPR_DUMP_ASCII); char *dump = grpc_dump_slice(slice, GPR_DUMP_HEX | GPR_DUMP_ASCII);
grpc_error *error = grpc_error_set_str( grpc_error *error = grpc_error_set_str(
grpc_error_set_int(GRPC_ERROR_CREATE_FROM_STATIC_STRING(err_desc), grpc_error_set_int(GRPC_ERROR_CREATE_FROM_COPIED_STRING(err_desc),
GRPC_ERROR_INT_OFFSET, GRPC_ERROR_INT_OFFSET,
p - GRPC_SLICE_START_PTR(slice)), p - GRPC_SLICE_START_PTR(slice)),
GRPC_ERROR_STR_RAW_BYTES, grpc_slice_from_copied_string(dump)); GRPC_ERROR_STR_RAW_BYTES, grpc_slice_from_copied_string(dump));

@ -301,7 +301,7 @@ static void add_error(grpc_error **composite, grpc_error *error,
const char *composite_error_string) { const char *composite_error_string) {
if (error == GRPC_ERROR_NONE) return; if (error == GRPC_ERROR_NONE) return;
if (*composite == GRPC_ERROR_NONE) { if (*composite == GRPC_ERROR_NONE) {
*composite = GRPC_ERROR_CREATE_FROM_STATIC_STRING(composite_error_string); *composite = GRPC_ERROR_CREATE_FROM_COPIED_STRING(composite_error_string);
} }
*composite = grpc_error_add_child(*composite, error); *composite = grpc_error_add_child(*composite, error);
} }

@ -73,8 +73,9 @@ static void must_succeed(grpc_exec_ctx *exec_ctx, void *arg,
grpc_error *error) { grpc_error *error) {
GPR_ASSERT(g_connecting != NULL); GPR_ASSERT(g_connecting != NULL);
GPR_ASSERT(error == GRPC_ERROR_NONE); GPR_ASSERT(error == GRPC_ERROR_NONE);
grpc_endpoint_shutdown(exec_ctx, g_connecting, grpc_endpoint_shutdown(
GRPC_ERROR_CREATE("must_succeed called")); exec_ctx, g_connecting,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("must_succeed called"));
grpc_endpoint_destroy(exec_ctx, g_connecting); grpc_endpoint_destroy(exec_ctx, g_connecting);
g_connecting = NULL; g_connecting = NULL;
finish_connection(); finish_connection();

@ -115,7 +115,8 @@ static void server_weak_ref_set(server_weak_ref *weak_ref,
static void on_connect(grpc_exec_ctx *exec_ctx, void *arg, grpc_endpoint *tcp, static void on_connect(grpc_exec_ctx *exec_ctx, void *arg, grpc_endpoint *tcp,
grpc_pollset *pollset, grpc_pollset *pollset,
grpc_tcp_server_acceptor *acceptor) { grpc_tcp_server_acceptor *acceptor) {
grpc_endpoint_shutdown(exec_ctx, tcp, GRPC_ERROR_CREATE("Connected")); grpc_endpoint_shutdown(exec_ctx, tcp,
GRPC_ERROR_CREATE_FROM_STATIC_STRING("Connected"));
grpc_endpoint_destroy(exec_ctx, tcp); grpc_endpoint_destroy(exec_ctx, tcp);
on_connect_result temp_result; on_connect_result temp_result;

Loading…
Cancel
Save