diff options
author | 2018-03-05 21:48:32 -0800 | |
---|---|---|
committer | 2018-03-05 21:48:32 -0800 | |
commit | 6684230224843456e5db89f768382c5830d83a79 (patch) | |
tree | 830b7b6b6cf47d86d1f99e2e511e6048015fd6b7 /src/core/lib | |
parent | 94dad67f4386ca1d46d96fd255cf4a9df5c087b2 (diff) | |
parent | 673439d5bd2d1711c10e8c4d29ceee3e67d585fd (diff) |
Merge branch 'master' of https://github.com/grpc/grpc into channel-tracing
Diffstat (limited to 'src/core/lib')
-rw-r--r-- | src/core/lib/gpr/cpu_posix.cc | 2 | ||||
-rw-r--r-- | src/core/lib/gprpp/memory.h | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/core/lib/gpr/cpu_posix.cc b/src/core/lib/gpr/cpu_posix.cc index 7a77f7ab64..915fd4976c 100644 --- a/src/core/lib/gpr/cpu_posix.cc +++ b/src/core/lib/gpr/cpu_posix.cc @@ -37,7 +37,7 @@ static long ncpus = 0; static pthread_key_t thread_id_key; static void init_ncpus() { - ncpus = sysconf(_SC_NPROCESSORS_ONLN); + ncpus = sysconf(_SC_NPROCESSORS_CONF); if (ncpus < 1 || ncpus > INT32_MAX) { gpr_log(GPR_ERROR, "Cannot determine number of CPUs: assuming 1"); ncpus = 1; diff --git a/src/core/lib/gprpp/memory.h b/src/core/lib/gprpp/memory.h index f84e20eeea..ba2f546675 100644 --- a/src/core/lib/gprpp/memory.h +++ b/src/core/lib/gprpp/memory.h @@ -30,12 +30,12 @@ namespace grpc_core { // The alignment of memory returned by gpr_malloc(). -constexpr size_t kAllignmentForDefaultAllocationInBytes = 8; +constexpr size_t kAlignmentForDefaultAllocationInBytes = 8; // Alternative to new, since we cannot use it (for fear of libstdc++) template <typename T, typename... Args> inline T* New(Args&&... args) { - void* p = alignof(T) > kAllignmentForDefaultAllocationInBytes + void* p = alignof(T) > kAlignmentForDefaultAllocationInBytes ? gpr_malloc_aligned(sizeof(T), alignof(T)) : gpr_malloc(sizeof(T)); return new (p) T(std::forward<Args>(args)...); @@ -45,7 +45,7 @@ inline T* New(Args&&... args) { template <typename T> inline void Delete(T* p) { p->~T(); - if (alignof(T) > kAllignmentForDefaultAllocationInBytes) { + if (alignof(T) > kAlignmentForDefaultAllocationInBytes) { gpr_free_aligned(p); } else { gpr_free(p); |