From 309830f6b8c09347db305acf3b05fca333030989 Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Fri, 5 Feb 2016 11:30:00 -0800 Subject: Replace 'long' with 'int64_t' in public core headers --- src/core/support/time.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'src/core/support/time.c') diff --git a/src/core/support/time.c b/src/core/support/time.c index ac8c3bcde5..2a1e40c633 100644 --- a/src/core/support/time.c +++ b/src/core/support/time.c @@ -83,12 +83,12 @@ gpr_timespec gpr_inf_past(gpr_clock_type type) { /* TODO(ctiller): consider merging _nanos, _micros, _millis into a single function for maintainability. Similarly for _seconds, _minutes, and _hours */ -gpr_timespec gpr_time_from_nanos(long ns, gpr_clock_type type) { +gpr_timespec gpr_time_from_nanos(int64_t ns, gpr_clock_type type) { gpr_timespec result; result.clock_type = type; - if (ns == LONG_MAX) { + if (ns == INT64_MAX) { result = gpr_inf_future(type); - } else if (ns == LONG_MIN) { + } else if (ns == INT64_MIN) { result = gpr_inf_past(type); } else if (ns >= 0) { result.tv_sec = ns / GPR_NS_PER_SEC; @@ -101,12 +101,12 @@ gpr_timespec gpr_time_from_nanos(long ns, gpr_clock_type type) { return result; } -gpr_timespec gpr_time_from_micros(long us, gpr_clock_type type) { +gpr_timespec gpr_time_from_micros(int64_t us, gpr_clock_type type) { gpr_timespec result; result.clock_type = type; - if (us == LONG_MAX) { + if (us == INT64_MAX) { result = gpr_inf_future(type); - } else if (us == LONG_MIN) { + } else if (us == INT64_MIN) { result = gpr_inf_past(type); } else if (us >= 0) { result.tv_sec = us / 1000000; @@ -119,12 +119,12 @@ gpr_timespec gpr_time_from_micros(long us, gpr_clock_type type) { return result; } -gpr_timespec gpr_time_from_millis(long ms, gpr_clock_type type) { +gpr_timespec gpr_time_from_millis(int64_t ms, gpr_clock_type type) { gpr_timespec result; result.clock_type = type; - if (ms == LONG_MAX) { + if (ms == INT64_MAX) { result = gpr_inf_future(type); - } else if (ms == LONG_MIN) { + } else if (ms == INT64_MIN) { result = gpr_inf_past(type); } else if (ms >= 0) { result.tv_sec = ms / 1000; @@ -137,12 +137,12 @@ gpr_timespec gpr_time_from_millis(long ms, gpr_clock_type type) { return result; } -gpr_timespec gpr_time_from_seconds(long s, gpr_clock_type type) { +gpr_timespec gpr_time_from_seconds(int64_t s, gpr_clock_type type) { gpr_timespec result; result.clock_type = type; - if (s == LONG_MAX) { + if (s == INT64_MAX) { result = gpr_inf_future(type); - } else if (s == LONG_MIN) { + } else if (s == INT64_MIN) { result = gpr_inf_past(type); } else { result.tv_sec = s; @@ -151,12 +151,12 @@ gpr_timespec gpr_time_from_seconds(long s, gpr_clock_type type) { return result; } -gpr_timespec gpr_time_from_minutes(long m, gpr_clock_type type) { +gpr_timespec gpr_time_from_minutes(int64_t m, gpr_clock_type type) { gpr_timespec result; result.clock_type = type; - if (m >= LONG_MAX / 60) { + if (m >= INT64_MAX / 60) { result = gpr_inf_future(type); - } else if (m <= LONG_MIN / 60) { + } else if (m <= INT64_MIN / 60) { result = gpr_inf_past(type); } else { result.tv_sec = m * 60; @@ -165,12 +165,12 @@ gpr_timespec gpr_time_from_minutes(long m, gpr_clock_type type) { return result; } -gpr_timespec gpr_time_from_hours(long h, gpr_clock_type type) { +gpr_timespec gpr_time_from_hours(int64_t h, gpr_clock_type type) { gpr_timespec result; result.clock_type = type; - if (h >= LONG_MAX / 3600) { + if (h >= INT64_MAX / 3600) { result = gpr_inf_future(type); - } else if (h <= LONG_MIN / 3600) { + } else if (h <= INT64_MIN / 3600) { result = gpr_inf_past(type); } else { result.tv_sec = h * 3600; -- cgit v1.2.3 From 7a55684a1305c73b0d7924d5cf04a52c093bd1bc Mon Sep 17 00:00:00 2001 From: murgatroid99 Date: Fri, 5 Feb 2016 11:33:30 -0800 Subject: Clang format and fix copyrights --- include/grpc/impl/codegen/time.h | 6 ++-- src/core/support/avl.c | 2 +- src/core/support/stack_lockfree.c | 2 +- src/core/support/time.c | 2 +- src/node/ext/timeval.cc | 2 +- src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi | 2 +- .../grpcio/grpc/_cython/_cygrpc/records.pyx.pxi | 2 +- src/python/grpcio/grpc/_cython/cygrpc.pyx | 2 +- test/core/statistics/census_log_tests.c | 6 ++-- test/core/support/sync_test.c | 2 +- test/core/support/time_test.c | 2 +- test/core/util/test_config.h | 14 ++++----- test/cpp/qps/client_async.cc | 34 +++++++++------------- test/cpp/qps/driver.h | 2 +- test/cpp/util/time_test.cc | 2 +- test/distrib/python/distribtest.py | 29 ++++++++++++++++++ tools/run_tests/build_artifact_python.sh | 2 +- 17 files changed, 69 insertions(+), 44 deletions(-) (limited to 'src/core/support/time.c') diff --git a/include/grpc/impl/codegen/time.h b/include/grpc/impl/codegen/time.h index 21fd9dedef..4ed1c3cbd8 100644 --- a/include/grpc/impl/codegen/time.h +++ b/include/grpc/impl/codegen/time.h @@ -107,8 +107,10 @@ GPR_API gpr_timespec gpr_time_sub(gpr_timespec a, gpr_timespec b); GPR_API gpr_timespec gpr_time_from_micros(int64_t x, gpr_clock_type clock_type); GPR_API gpr_timespec gpr_time_from_nanos(int64_t x, gpr_clock_type clock_type); GPR_API gpr_timespec gpr_time_from_millis(int64_t x, gpr_clock_type clock_type); -GPR_API gpr_timespec gpr_time_from_seconds(int64_t x, gpr_clock_type clock_type); -GPR_API gpr_timespec gpr_time_from_minutes(int64_t x, gpr_clock_type clock_type); +GPR_API gpr_timespec +gpr_time_from_seconds(int64_t x, gpr_clock_type clock_type); +GPR_API gpr_timespec +gpr_time_from_minutes(int64_t x, gpr_clock_type clock_type); GPR_API gpr_timespec gpr_time_from_hours(int64_t x, gpr_clock_type clock_type); GPR_API int32_t gpr_time_to_millis(gpr_timespec timespec); diff --git a/src/core/support/avl.c b/src/core/support/avl.c index 1767fc12b5..78746588f0 100644 --- a/src/core/support/avl.c +++ b/src/core/support/avl.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/core/support/stack_lockfree.c b/src/core/support/stack_lockfree.c index 2c97ee18be..9daecd2e18 100644 --- a/src/core/support/stack_lockfree.c +++ b/src/core/support/stack_lockfree.c @@ -99,7 +99,7 @@ gpr_stack_lockfree *gpr_stack_lockfree_create(size_t entries) { /* Point the head at reserved dummy entry */ stack->head.contents.index = INVALID_ENTRY_INDEX; - /* Fill in the pad and aba_ctr to avoid confusing memcheck tools */ +/* Fill in the pad and aba_ctr to avoid confusing memcheck tools */ #ifdef GPR_ARCH_64 stack->head.contents.pad = 0; #endif diff --git a/src/core/support/time.c b/src/core/support/time.c index 2a1e40c633..423d12ffc0 100644 --- a/src/core/support/time.c +++ b/src/core/support/time.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/node/ext/timeval.cc b/src/node/ext/timeval.cc index 9284db62ef..c8f8534cfa 100644 --- a/src/node/ext/timeval.cc +++ b/src/node/ext/timeval.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi index 9d6e017026..9c85e0ee1b 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/grpc.pxi @@ -1,4 +1,4 @@ -# Copyright 2015, Google Inc. +# Copyright 2015-2016, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without diff --git a/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi b/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi index 9e14b967e0..fa4ea99ea9 100644 --- a/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi +++ b/src/python/grpcio/grpc/_cython/_cygrpc/records.pyx.pxi @@ -1,4 +1,4 @@ -# Copyright 2015, Google Inc. +# Copyright 2015-2016, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without diff --git a/src/python/grpcio/grpc/_cython/cygrpc.pyx b/src/python/grpcio/grpc/_cython/cygrpc.pyx index 579bac7b8a..b1836bf5be 100644 --- a/src/python/grpcio/grpc/_cython/cygrpc.pyx +++ b/src/python/grpcio/grpc/_cython/cygrpc.pyx @@ -1,4 +1,4 @@ -# Copyright 2015, Google Inc. +# Copyright 2015-2016, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without diff --git a/test/core/statistics/census_log_tests.c b/test/core/statistics/census_log_tests.c index 858aeb9809..77cc57d4d6 100644 --- a/test/core/statistics/census_log_tests.c +++ b/test/core/statistics/census_log_tests.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -237,8 +237,8 @@ static void reader_thread(void *arg) { gpr_timespec interval; int counter = 0; printf(" Reader starting\n"); - interval = gpr_time_from_micros((int64_t)args->read_iteration_interval_in_msec * 1000, - GPR_TIMESPAN); + interval = gpr_time_from_micros( + (int64_t)args->read_iteration_interval_in_msec * 1000, GPR_TIMESPAN); gpr_mu_lock(args->mu); while (!args->stop_flag && records_read < args->total_records) { gpr_cv_wait(&args->stop, args->mu, interval); diff --git a/test/core/support/sync_test.c b/test/core/support/sync_test.c index acb5101536..d311eb136a 100644 --- a/test/core/support/sync_test.c +++ b/test/core/support/sync_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/test/core/support/time_test.c b/test/core/support/time_test.c index 5285a2c75b..6cc3786df1 100644 --- a/test/core/support/time_test.c +++ b/test/core/support/time_test.c @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/test/core/util/test_config.h b/test/core/util/test_config.h index 3872776cb1..f6bb2e1f72 100644 --- a/test/core/util/test_config.h +++ b/test/core/util/test_config.h @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -54,15 +54,15 @@ extern double g_fixture_slowdown_factor; (GRPC_TEST_SLOWDOWN_BUILD_FACTOR * GRPC_TEST_SLOWDOWN_MACHINE_FACTOR * \ g_fixture_slowdown_factor) -#define GRPC_TIMEOUT_SECONDS_TO_DEADLINE(x) \ - gpr_time_add( \ - gpr_now(GPR_CLOCK_MONOTONIC), \ +#define GRPC_TIMEOUT_SECONDS_TO_DEADLINE(x) \ + gpr_time_add( \ + gpr_now(GPR_CLOCK_MONOTONIC), \ gpr_time_from_millis((int64_t)(GRPC_TEST_SLOWDOWN_FACTOR * 1e3 * (x)), \ GPR_TIMESPAN)) -#define GRPC_TIMEOUT_MILLIS_TO_DEADLINE(x) \ - gpr_time_add( \ - gpr_now(GPR_CLOCK_MONOTONIC), \ +#define GRPC_TIMEOUT_MILLIS_TO_DEADLINE(x) \ + gpr_time_add( \ + gpr_now(GPR_CLOCK_MONOTONIC), \ gpr_time_from_micros((int64_t)(GRPC_TEST_SLOWDOWN_FACTOR * 1e3 * (x)), \ GPR_TIMESPAN)) diff --git a/test/cpp/qps/client_async.cc b/test/cpp/qps/client_async.cc index 6b6294ba51..f3f8f37051 100644 --- a/test/cpp/qps/client_async.cc +++ b/test/cpp/qps/client_async.cc @@ -96,8 +96,7 @@ class ClientRpcContextUnaryImpl : public ClientRpcContext { std::function< std::unique_ptr>( BenchmarkService::Stub*, grpc::ClientContext*, const RequestType&, - CompletionQueue*)> - start_req, + CompletionQueue*)> start_req, std::function on_done) : ClientRpcContext(channel_id), context_(), @@ -143,8 +142,7 @@ class ClientRpcContextUnaryImpl : public ClientRpcContext { std::function callback_; std::function>( BenchmarkService::Stub*, grpc::ClientContext*, const RequestType&, - CompletionQueue*)> - start_req_; + CompletionQueue*)> start_req_; grpc::Status status_; double start_; std::unique_ptr> @@ -164,12 +162,11 @@ class AsyncClient : public ClientImpl { using ClientImpl::cores_; using ClientImpl::channels_; using ClientImpl::request_; - AsyncClient( - const ClientConfig& config, - std::function - setup_ctx, - std::function(std::shared_ptr)> - create_stub) + AsyncClient(const ClientConfig& config, + std::function setup_ctx, + std::function(std::shared_ptr)> + create_stub) : ClientImpl(config, create_stub), num_async_threads_(NumThreads(config)), channel_lock_(new std::mutex[config.client_channels()]), @@ -411,8 +408,7 @@ class ClientRpcContextStreamingImpl : public ClientRpcContext { std::function>( BenchmarkService::Stub*, grpc::ClientContext*, CompletionQueue*, - void*)> - start_req, + void*)> start_req, std::function on_done) : ClientRpcContext(channel_id), context_(), @@ -464,10 +460,10 @@ class ClientRpcContextStreamingImpl : public ClientRpcContext { ResponseType response_; bool (ClientRpcContextStreamingImpl::*next_state_)(bool, Histogram*); std::function callback_; - std::function>( - BenchmarkService::Stub*, grpc::ClientContext*, CompletionQueue*, void*)> - start_req_; + std::function< + std::unique_ptr>( + BenchmarkService::Stub*, grpc::ClientContext*, CompletionQueue*, + void*)> start_req_; grpc::Status status_; double start_; std::unique_ptr> @@ -511,8 +507,7 @@ class ClientRpcContextGenericStreamingImpl : public ClientRpcContext { int channel_id, grpc::GenericStub* stub, const ByteBuffer& req, std::function( grpc::GenericStub*, grpc::ClientContext*, - const grpc::string& method_name, CompletionQueue*, void*)> - start_req, + const grpc::string& method_name, CompletionQueue*, void*)> start_req, std::function on_done) : ClientRpcContext(channel_id), context_(), @@ -569,8 +564,7 @@ class ClientRpcContextGenericStreamingImpl : public ClientRpcContext { std::function callback_; std::function( grpc::GenericStub*, grpc::ClientContext*, const grpc::string&, - CompletionQueue*, void*)> - start_req_; + CompletionQueue*, void*)> start_req_; grpc::Status status_; double start_; std::unique_ptr stream_; diff --git a/test/cpp/qps/driver.h b/test/cpp/qps/driver.h index 4b2b400c0c..3af61f7391 100644 --- a/test/cpp/qps/driver.h +++ b/test/cpp/qps/driver.h @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/test/cpp/util/time_test.cc b/test/cpp/util/time_test.cc index 803bd46210..48c6ce7697 100644 --- a/test/cpp/util/time_test.cc +++ b/test/cpp/util/time_test.cc @@ -1,6 +1,6 @@ /* * - * Copyright 2015, Google Inc. + * Copyright 2015-2016, Google Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/test/distrib/python/distribtest.py b/test/distrib/python/distribtest.py index 428ffe2b34..66c1f88796 100644 --- a/test/distrib/python/distribtest.py +++ b/test/distrib/python/distribtest.py @@ -1,3 +1,32 @@ +# Copyright 2015-2016, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + from grpc.beta import implementations # This code doesn't do much but makes sure the native extension is loaded diff --git a/tools/run_tests/build_artifact_python.sh b/tools/run_tests/build_artifact_python.sh index 48cf390f69..87bc85e8b1 100755 --- a/tools/run_tests/build_artifact_python.sh +++ b/tools/run_tests/build_artifact_python.sh @@ -46,4 +46,4 @@ GRPC_PYTHON_BUILD_WITH_CYTHON=1 ${SETARCH_CMD} python setup.py \ mkdir -p artifacts -cp -r dist/* artifacts \ No newline at end of file +cp -r dist/* artifacts -- cgit v1.2.3