diff options
author | Craig Tiller <craig.tiller@gmail.com> | 2015-02-24 08:12:05 -0800 |
---|---|---|
committer | Craig Tiller <craig.tiller@gmail.com> | 2015-02-24 08:12:05 -0800 |
commit | 25f6cd7a97dc669ea71b9556392772c3473efc89 (patch) | |
tree | f66dd0aefb0836d2fa412731ad63c29442b5ab2c /src/core | |
parent | e8eb8a4fd46b56dfbfdc8666fa498186b824bed0 (diff) | |
parent | f7c87c2741e18e9fb481252151f14fff8ed026d3 (diff) |
Merge github.com:grpc/grpc into credit
Conflicts:
examples/pubsub/publisher_test.cc
examples/pubsub/subscriber_test.cc
include/grpc++/create_channel.h
src/cpp/client/create_channel.cc
test/cpp/end2end/async_end2end_test.cc
test/cpp/end2end/end2end_test.cc
test/cpp/util/create_test_channel.cc
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/support/log_win32.c | 2 | ||||
-rw-r--r-- | src/core/support/string_posix.c | 2 | ||||
-rw-r--r-- | src/core/support/sync.c | 4 | ||||
-rw-r--r-- | src/core/support/time.c | 14 |
4 files changed, 11 insertions, 11 deletions
diff --git a/src/core/support/log_win32.c b/src/core/support/log_win32.c index cff130ae18..720dc141f5 100644 --- a/src/core/support/log_win32.c +++ b/src/core/support/log_win32.c @@ -90,7 +90,7 @@ void gpr_default_log(gpr_log_func_args *args) { strcpy(time_buffer, "error:strftime"); } - fprintf(stderr, "%s%s.%09u %5u %s:%d: %s\n", + fprintf(stderr, "%s%s.%09u %5u %s:%d] %s\n", gpr_log_severity_string(args->severity), time_buffer, (int)(now.tv_nsec), GetCurrentThreadId(), args->file, args->line, args->message); diff --git a/src/core/support/string_posix.c b/src/core/support/string_posix.c index 8a678b3103..25c333db4e 100644 --- a/src/core/support/string_posix.c +++ b/src/core/support/string_posix.c @@ -51,7 +51,7 @@ int gpr_asprintf(char **strp, const char *format, ...) { va_start(args, format); ret = vsnprintf(buf, sizeof(buf), format, args); va_end(args); - if (!(0 <= ret)) { + if (ret < 0) { *strp = NULL; return -1; } diff --git a/src/core/support/sync.c b/src/core/support/sync.c index 1a5cf57c4f..ccfe1e25f4 100644 --- a/src/core/support/sync.c +++ b/src/core/support/sync.c @@ -41,7 +41,7 @@ Should be a prime. */ enum { event_sync_partitions = 31 }; -/* Event are partitioned by address to avoid lock contention. */ +/* Events are partitioned by address to avoid lock contention. */ static struct sync_array_s { gpr_mu mu; gpr_cv cv; @@ -71,10 +71,10 @@ void gpr_event_set(gpr_event *ev, void *value) { struct sync_array_s *s = hash(ev); gpr_mu_lock(&s->mu); GPR_ASSERT(gpr_atm_acq_load(&ev->state) == 0); - GPR_ASSERT(value != NULL); gpr_atm_rel_store(&ev->state, (gpr_atm)value); gpr_cv_broadcast(&s->cv); gpr_mu_unlock(&s->mu); + GPR_ASSERT(value != NULL); } void *gpr_event_get(gpr_event *ev) { diff --git a/src/core/support/time.c b/src/core/support/time.c index 67f7665650..7dbf95059f 100644 --- a/src/core/support/time.c +++ b/src/core/support/time.c @@ -85,12 +85,12 @@ gpr_timespec gpr_time_from_nanos(long ns) { } else if (ns == LONG_MIN) { result = gpr_inf_past; } else if (ns >= 0) { - result.tv_sec = ns / 1000000000; - result.tv_nsec = ns - result.tv_sec * 1000000000; + result.tv_sec = ns / GPR_NS_PER_SEC; + result.tv_nsec = ns - result.tv_sec * GPR_NS_PER_SEC; } else { /* Calculation carefully formulated to avoid any possible under/overflow. */ - result.tv_sec = (-(999999999 - (ns + 1000000000)) / 1000000000) - 1; - result.tv_nsec = ns - result.tv_sec * 1000000000; + result.tv_sec = (-(999999999 - (ns + GPR_NS_PER_SEC)) / GPR_NS_PER_SEC) - 1; + result.tv_nsec = ns - result.tv_sec * GPR_NS_PER_SEC; } return result; } @@ -172,8 +172,8 @@ gpr_timespec gpr_time_add(gpr_timespec a, gpr_timespec b) { gpr_timespec sum; int inc = 0; sum.tv_nsec = a.tv_nsec + b.tv_nsec; - if (sum.tv_nsec >= 1000000000) { - sum.tv_nsec -= 1000000000; + if (sum.tv_nsec >= GPR_NS_PER_SEC) { + sum.tv_nsec -= GPR_NS_PER_SEC; inc++; } if (a.tv_sec == TYPE_MAX(time_t) || a.tv_sec == TYPE_MIN(time_t)) { @@ -200,7 +200,7 @@ gpr_timespec gpr_time_sub(gpr_timespec a, gpr_timespec b) { int dec = 0; diff.tv_nsec = a.tv_nsec - b.tv_nsec; if (diff.tv_nsec < 0) { - diff.tv_nsec += 1000000000; + diff.tv_nsec += GPR_NS_PER_SEC; dec++; } if (a.tv_sec == TYPE_MAX(time_t) || a.tv_sec == TYPE_MIN(time_t)) { |