diff options
Diffstat (limited to 'include')
41 files changed, 123 insertions, 127 deletions
diff --git a/include/grpc++/async_unary_call.h b/include/grpc++/async_unary_call.h index d631ccd134..3d22df4b33 100644 --- a/include/grpc++/async_unary_call.h +++ b/include/grpc++/async_unary_call.h @@ -121,8 +121,8 @@ class ServerAsyncResponseWriter GRPC_FINAL } // The response is dropped if the status is not OK. if (status.ok()) { - finish_buf_.ServerSendStatus( - ctx_->trailing_metadata_, finish_buf_.SendMessage(msg)); + finish_buf_.ServerSendStatus(ctx_->trailing_metadata_, + finish_buf_.SendMessage(msg)); } else { finish_buf_.ServerSendStatus(ctx_->trailing_metadata_, status); } diff --git a/include/grpc++/auth_context.h b/include/grpc++/auth_context.h index f8ea8ad6f4..7dced90ce5 100644 --- a/include/grpc++/auth_context.h +++ b/include/grpc++/auth_context.h @@ -62,6 +62,7 @@ class AuthPropertyIterator AuthPropertyIterator(); AuthPropertyIterator(const grpc_auth_property* property, const grpc_auth_property_iterator* iter); + private: friend class SecureAuthContext; const grpc_auth_property* property_; @@ -92,4 +93,3 @@ class AuthContext { } // namespace grpc #endif // GRPCXX_AUTH_CONTEXT_H - diff --git a/include/grpc++/byte_buffer.h b/include/grpc++/byte_buffer.h index cb3c6a1159..6467776398 100644 --- a/include/grpc++/byte_buffer.h +++ b/include/grpc++/byte_buffer.h @@ -91,8 +91,8 @@ class SerializationTraits<ByteBuffer, void> { dest->set_buffer(byte_buffer); return Status::OK; } - static Status Serialize(const ByteBuffer& source, grpc_byte_buffer** buffer, - bool* own_buffer) { + static Status Serialize(const ByteBuffer& source, grpc_byte_buffer** buffer, + bool* own_buffer) { *buffer = source.buffer(); *own_buffer = false; return Status::OK; diff --git a/include/grpc++/client_context.h b/include/grpc++/client_context.h index 915a80ddb0..8de2ba4877 100644 --- a/include/grpc++/client_context.h +++ b/include/grpc++/client_context.h @@ -185,7 +185,9 @@ class ClientContext { // Get and set census context void set_census_context(struct census_context* ccp) { census_context_ = ccp; } - struct census_context* census_context() const { return census_context_; } + struct census_context* census_context() const { + return census_context_; + } void TryCancel(); diff --git a/include/grpc++/dynamic_thread_pool.h b/include/grpc++/dynamic_thread_pool.h index f0cd35940f..a4d4885b51 100644 --- a/include/grpc++/dynamic_thread_pool.h +++ b/include/grpc++/dynamic_thread_pool.h @@ -55,11 +55,12 @@ class DynamicThreadPool GRPC_FINAL : public ThreadPoolInterface { private: class DynamicThread { - public: - DynamicThread(DynamicThreadPool *pool); + public: + DynamicThread(DynamicThreadPool* pool); ~DynamicThread(); - private: - DynamicThreadPool *pool_; + + private: + DynamicThreadPool* pool_; std::unique_ptr<grpc::thread> thd_; void ThreadFunc(); }; diff --git a/include/grpc++/generic_stub.h b/include/grpc++/generic_stub.h index c34e1fcf55..172f10e45a 100644 --- a/include/grpc++/generic_stub.h +++ b/include/grpc++/generic_stub.h @@ -52,8 +52,8 @@ class GenericStub GRPC_FINAL { // begin a call to a named method std::unique_ptr<GenericClientAsyncReaderWriter> Call( - ClientContext* context, const grpc::string& method, - CompletionQueue* cq, void* tag); + ClientContext* context, const grpc::string& method, CompletionQueue* cq, + void* tag); private: std::shared_ptr<ChannelInterface> channel_; diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h index d49102fa3e..bc1db4c12c 100644 --- a/include/grpc++/impl/call.h +++ b/include/grpc++/impl/call.h @@ -67,14 +67,10 @@ class WriteOptions { WriteOptions(const WriteOptions& other) : flags_(other.flags_) {} /// Clear all flags. - inline void Clear() { - flags_ = 0; - } + inline void Clear() { flags_ = 0; } /// Returns raw flags bitset. - inline gpr_uint32 flags() const { - return flags_; - } + inline gpr_uint32 flags() const { return flags_; } /// Sets flag for the disabling of compression for the next message write. /// @@ -122,9 +118,7 @@ class WriteOptions { /// not go out on the wire immediately. /// /// \sa GRPC_WRITE_BUFFER_HINT - inline bool get_buffer_hint() const { - return GetBit(GRPC_WRITE_BUFFER_HINT); - } + inline bool get_buffer_hint() const { return GetBit(GRPC_WRITE_BUFFER_HINT); } WriteOptions& operator=(const WriteOptions& rhs) { flags_ = rhs.flags_; @@ -132,17 +126,11 @@ class WriteOptions { } private: - void SetBit(const gpr_int32 mask) { - flags_ |= mask; - } + void SetBit(const gpr_int32 mask) { flags_ |= mask; } - void ClearBit(const gpr_int32 mask) { - flags_ &= ~mask; - } + void ClearBit(const gpr_int32 mask) { flags_ &= ~mask; } - bool GetBit(const gpr_int32 mask) const { - return flags_ & mask; - } + bool GetBit(const gpr_int32 mask) const { return flags_ & mask; } gpr_uint32 flags_; }; diff --git a/include/grpc++/impl/grpc_library.h b/include/grpc++/impl/grpc_library.h index f9fa677901..ce4211418d 100644 --- a/include/grpc++/impl/grpc_library.h +++ b/include/grpc++/impl/grpc_library.h @@ -46,5 +46,4 @@ class GrpcLibrary { } // namespace grpc - #endif // GRPCXX_IMPL_GRPC_LIBRARY_H diff --git a/include/grpc++/impl/serialization_traits.h b/include/grpc++/impl/serialization_traits.h index 1f5c674e4c..3ea66a3405 100644 --- a/include/grpc++/impl/serialization_traits.h +++ b/include/grpc++/impl/serialization_traits.h @@ -37,12 +37,12 @@ namespace grpc { /// Defines how to serialize and deserialize some type. -/// +/// /// Used for hooking different message serialization API's into GRPC. /// Each SerializationTraits implementation must provide the following /// functions: /// static Status Serialize(const Message& msg, -/// grpc_byte_buffer** buffer, +/// grpc_byte_buffer** buffer, // bool* own_buffer); /// static Status Deserialize(grpc_byte_buffer* buffer, /// Message* msg, @@ -57,7 +57,7 @@ namespace grpc { /// msg. max_message_size is passed in as a bound on the maximum number of /// message bytes Deserialize should accept. /// -/// Both functions return a Status, allowing them to explain what went +/// Both functions return a Status, allowing them to explain what went /// wrong if required. template <class Message, class UnusedButHereForPartialTemplateSpecialization = void> diff --git a/include/grpc++/impl/sync_no_cxx11.h b/include/grpc++/impl/sync_no_cxx11.h index 5869b04c76..120a031045 100644 --- a/include/grpc++/impl/sync_no_cxx11.h +++ b/include/grpc++/impl/sync_no_cxx11.h @@ -38,7 +38,7 @@ namespace grpc { -template<class mutex> +template <class mutex> class lock_guard; class condition_variable; @@ -46,6 +46,7 @@ class mutex { public: mutex() { gpr_mu_init(&mu_); } ~mutex() { gpr_mu_destroy(&mu_); } + private: ::gpr_mu mu_; template <class mutex> @@ -58,6 +59,7 @@ class lock_guard { public: lock_guard(mutex &mu) : mu_(mu), locked(true) { gpr_mu_lock(&mu.mu_); } ~lock_guard() { unlock_internal(); } + protected: void lock_internal() { if (!locked) gpr_mu_lock(&mu_.mu_); @@ -67,6 +69,7 @@ class lock_guard { if (locked) gpr_mu_unlock(&mu_.mu_); locked = false; } + private: mutex &mu_; bool locked; @@ -76,7 +79,7 @@ class lock_guard { template <class mutex> class unique_lock : public lock_guard<mutex> { public: - unique_lock(mutex &mu) : lock_guard<mutex>(mu) { } + unique_lock(mutex &mu) : lock_guard<mutex>(mu) {} void lock() { this->lock_internal(); } void unlock() { this->unlock_internal(); } }; @@ -92,6 +95,7 @@ class condition_variable { } void notify_one() { gpr_cv_signal(&cv_); } void notify_all() { gpr_cv_broadcast(&cv_); } + private: gpr_cv cv_; }; diff --git a/include/grpc++/impl/thd_no_cxx11.h b/include/grpc++/impl/thd_no_cxx11.h index a6bdd7dfe9..84d03ce184 100644 --- a/include/grpc++/impl/thd_no_cxx11.h +++ b/include/grpc++/impl/thd_no_cxx11.h @@ -40,7 +40,8 @@ namespace grpc { class thread { public: - template<class T> thread(void (T::*fptr)(), T *obj) { + template <class T> + thread(void (T::*fptr)(), T *obj) { func_ = new thread_function<T>(fptr, obj); joined_ = false; start(); @@ -53,28 +54,28 @@ class thread { gpr_thd_join(thd_); joined_ = true; } + private: void start() { gpr_thd_options options = gpr_thd_options_default(); gpr_thd_options_set_joinable(&options); - gpr_thd_new(&thd_, thread_func, (void *) func_, &options); + gpr_thd_new(&thd_, thread_func, (void *)func_, &options); } static void thread_func(void *arg) { - thread_function_base *func = (thread_function_base *) arg; + thread_function_base *func = (thread_function_base *)arg; func->call(); } class thread_function_base { public: - virtual ~thread_function_base() { } + virtual ~thread_function_base() {} virtual void call() = 0; }; - template<class T> + template <class T> class thread_function : public thread_function_base { public: - thread_function(void (T::*fptr)(), T *obj) - : fptr_(fptr) - , obj_(obj) { } + thread_function(void (T::*fptr)(), T *obj) : fptr_(fptr), obj_(obj) {} virtual void call() { (obj_->*fptr_)(); } + private: void (T::*fptr_)(); T *obj_; @@ -84,8 +85,8 @@ class thread { bool joined_; // Disallow copy and assign. - thread(const thread&); - void operator=(const thread&); + thread(const thread &); + void operator=(const thread &); }; } // namespace grpc diff --git a/include/grpc++/server.h b/include/grpc++/server.h index 8755b4b445..99f288d179 100644 --- a/include/grpc++/server.h +++ b/include/grpc++/server.h @@ -84,8 +84,9 @@ class Server GRPC_FINAL : public GrpcLibrary, private CallHook { int max_message_size); // Register a service. This call does not take ownership of the service. // The service must exist for the lifetime of the Server instance. - bool RegisterService(const grpc::string *host, RpcService* service); - bool RegisterAsyncService(const grpc::string *host, AsynchronousService* service); + bool RegisterService(const grpc::string* host, RpcService* service); + bool RegisterAsyncService(const grpc::string* host, + AsynchronousService* service); void RegisterAsyncGenericService(AsyncGenericService* service); // Add a listening port. Can be called multiple times. int AddListeningPort(const grpc::string& addr, ServerCredentials* creds); diff --git a/include/grpc++/server_builder.h b/include/grpc++/server_builder.h index 44ee00eec9..906daf1370 100644 --- a/include/grpc++/server_builder.h +++ b/include/grpc++/server_builder.h @@ -76,15 +76,14 @@ class ServerBuilder { // The service must exist for the lifetime of the Server instance returned by // BuildAndStart(). // Only matches requests with :authority \a host - void RegisterService(const grpc::string& host, - SynchronousService* service); + void RegisterService(const grpc::string& host, SynchronousService* service); // Register an asynchronous service. // This call does not take ownership of the service or completion queue. // The service and completion queuemust exist for the lifetime of the Server // instance returned by BuildAndStart(). // Only matches requests with :authority \a host - void RegisterAsyncService(const grpc::string& host, + void RegisterAsyncService(const grpc::string& host, AsynchronousService* service); // Set max message size in bytes. @@ -117,9 +116,10 @@ class ServerBuilder { }; typedef std::unique_ptr<grpc::string> HostString; - template <class T> struct NamedService { + template <class T> + struct NamedService { explicit NamedService(T* s) : service(s) {} - NamedService(const grpc::string& h, T *s) + NamedService(const grpc::string& h, T* s) : host(new grpc::string(h)), service(s) {} HostString host; T* service; @@ -127,7 +127,8 @@ class ServerBuilder { int max_message_size_; std::vector<std::unique_ptr<NamedService<RpcService>>> services_; - std::vector<std::unique_ptr<NamedService<AsynchronousService>>> async_services_; + std::vector<std::unique_ptr<NamedService<AsynchronousService>>> + async_services_; std::vector<Port> ports_; std::vector<ServerCompletionQueue*> cqs_; std::shared_ptr<ServerCredentials> creds_; diff --git a/include/grpc++/stream.h b/include/grpc++/stream.h index bc0c3c0f3b..45dafcd282 100644 --- a/include/grpc++/stream.h +++ b/include/grpc++/stream.h @@ -85,9 +85,7 @@ class WriterInterface { // Returns false when the stream has been closed. virtual bool Write(const W& msg, const WriteOptions& options) = 0; - inline bool Write(const W& msg) { - return Write(msg, WriteOptions()); - } + inline bool Write(const W& msg) { return Write(msg, WriteOptions()); } }; template <class R> @@ -640,9 +638,8 @@ class ServerAsyncReader GRPC_FINAL : public ServerAsyncStreamingInterface, } // The response is dropped if the status is not OK. if (status.ok()) { - finish_ops_.ServerSendStatus( - ctx_->trailing_metadata_, - finish_ops_.SendMessage(msg)); + finish_ops_.ServerSendStatus(ctx_->trailing_metadata_, + finish_ops_.SendMessage(msg)); } else { finish_ops_.ServerSendStatus(ctx_->trailing_metadata_, status); } diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index 56fd4db16c..2220e8f039 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -378,11 +378,11 @@ typedef struct grpc_op { /** Registers a plugin to be initialized and destroyed with the library. - The \a init and \a destroy functions will be invoked as part of - \a grpc_init() and \a grpc_shutdown(), respectively. + The \a init and \a destroy functions will be invoked as part of + \a grpc_init() and \a grpc_shutdown(), respectively. Note that these functions can be invoked an arbitrary number of times (and hence so will \a init and \a destroy). - It is safe to pass NULL to either argument. Plugins are destroyed in + It is safe to pass NULL to either argument. Plugins are destroyed in the reverse order they were initialized. */ void grpc_register_plugin(void (*init)(void), void (*destroy)(void)); @@ -629,8 +629,7 @@ grpc_call_error grpc_server_request_registered_call( be specified with args. If no additional configuration is needed, args can be NULL. See grpc_channel_args for more. The data in 'args' need only live through the invocation of this function. */ -grpc_server *grpc_server_create(const grpc_channel_args *args, - void *reserved); +grpc_server *grpc_server_create(const grpc_channel_args *args, void *reserved); /** Register a completion queue with the server. Must be done for any notification completion queue that is passed to grpc_server_request_*_call diff --git a/include/grpc/status.h b/include/grpc/status.h index 456b9006e7..65ce410227 100644 --- a/include/grpc/status.h +++ b/include/grpc/status.h @@ -160,4 +160,4 @@ typedef enum { } #endif -#endif /* GRPC_STATUS_H */ +#endif /* GRPC_STATUS_H */ diff --git a/include/grpc/support/alloc.h b/include/grpc/support/alloc.h index 509870f3e3..9d4e743da7 100644 --- a/include/grpc/support/alloc.h +++ b/include/grpc/support/alloc.h @@ -55,4 +55,4 @@ void gpr_free_aligned(void *ptr); } #endif -#endif /* GRPC_SUPPORT_ALLOC_H */ +#endif /* GRPC_SUPPORT_ALLOC_H */ diff --git a/include/grpc/support/atm.h b/include/grpc/support/atm.h index ba8d7f579e..3f88e2e1a5 100644 --- a/include/grpc/support/atm.h +++ b/include/grpc/support/atm.h @@ -89,4 +89,4 @@ #error could not determine platform for atm #endif -#endif /* GRPC_SUPPORT_ATM_H */ +#endif /* GRPC_SUPPORT_ATM_H */ diff --git a/include/grpc/support/atm_gcc_atomic.h b/include/grpc/support/atm_gcc_atomic.h index a2c8386028..104e1d51df 100644 --- a/include/grpc/support/atm_gcc_atomic.h +++ b/include/grpc/support/atm_gcc_atomic.h @@ -69,4 +69,4 @@ static __inline int gpr_atm_rel_cas(gpr_atm *p, gpr_atm o, gpr_atm n) { __ATOMIC_RELAXED); } -#endif /* GRPC_SUPPORT_ATM_GCC_ATOMIC_H */ +#endif /* GRPC_SUPPORT_ATM_GCC_ATOMIC_H */ diff --git a/include/grpc/support/atm_gcc_sync.h b/include/grpc/support/atm_gcc_sync.h index 38b5a9eec2..241ae76c91 100644 --- a/include/grpc/support/atm_gcc_sync.h +++ b/include/grpc/support/atm_gcc_sync.h @@ -84,4 +84,4 @@ static __inline void gpr_atm_no_barrier_store(gpr_atm *p, gpr_atm value) { #define gpr_atm_acq_cas(p, o, n) (__sync_bool_compare_and_swap((p), (o), (n))) #define gpr_atm_rel_cas(p, o, n) gpr_atm_acq_cas((p), (o), (n)) -#endif /* GRPC_SUPPORT_ATM_GCC_SYNC_H */ +#endif /* GRPC_SUPPORT_ATM_GCC_SYNC_H */ diff --git a/include/grpc/support/atm_win32.h b/include/grpc/support/atm_win32.h index 694528a9ba..cc016e5cdf 100644 --- a/include/grpc/support/atm_win32.h +++ b/include/grpc/support/atm_win32.h @@ -66,31 +66,31 @@ static __inline int gpr_atm_no_barrier_cas(gpr_atm *p, gpr_atm o, gpr_atm n) { /* InterlockedCompareExchangePointerNoFence() not available on vista or windows7 */ #ifdef GPR_ARCH_64 - return o == (gpr_atm)InterlockedCompareExchangeAcquire64((volatile LONGLONG *) p, - (LONGLONG) n, (LONGLONG) o); + return o == (gpr_atm)InterlockedCompareExchangeAcquire64( + (volatile LONGLONG *)p, (LONGLONG)n, (LONGLONG)o); #else - return o == (gpr_atm)InterlockedCompareExchangeAcquire((volatile LONG *) p, - (LONG) n, (LONG) o); + return o == (gpr_atm)InterlockedCompareExchangeAcquire((volatile LONG *)p, + (LONG)n, (LONG)o); #endif } static __inline int gpr_atm_acq_cas(gpr_atm *p, gpr_atm o, gpr_atm n) { #ifdef GPR_ARCH_64 - return o == (gpr_atm)InterlockedCompareExchangeAcquire64((volatile LONGLONG *) p, - (LONGLONG) n, (LONGLONG) o); + return o == (gpr_atm)InterlockedCompareExchangeAcquire64( + (volatile LONGLONG *)p, (LONGLONG)n, (LONGLONG)o); #else - return o == (gpr_atm)InterlockedCompareExchangeAcquire((volatile LONG *) p, - (LONG) n, (LONG) o); + return o == (gpr_atm)InterlockedCompareExchangeAcquire((volatile LONG *)p, + (LONG)n, (LONG)o); #endif } static __inline int gpr_atm_rel_cas(gpr_atm *p, gpr_atm o, gpr_atm n) { #ifdef GPR_ARCH_64 - return o == (gpr_atm)InterlockedCompareExchangeRelease64((volatile LONGLONG *) p, - (LONGLONG) n, (LONGLONG) o); + return o == (gpr_atm)InterlockedCompareExchangeRelease64( + (volatile LONGLONG *)p, (LONGLONG)n, (LONGLONG)o); #else - return o == (gpr_atm)InterlockedCompareExchangeRelease((volatile LONG *) p, - (LONG) n, (LONG) o); + return o == (gpr_atm)InterlockedCompareExchangeRelease((volatile LONG *)p, + (LONG)n, (LONG)o); #endif } @@ -110,17 +110,16 @@ static __inline gpr_atm gpr_atm_full_fetch_add(gpr_atm *p, gpr_atm delta) { #ifdef GPR_ARCH_64 do { old = *p; - } while (old != (gpr_atm)InterlockedCompareExchange64((volatile LONGLONG *) p, - (LONGLONG) old + delta, - (LONGLONG) old)); + } while (old != (gpr_atm)InterlockedCompareExchange64((volatile LONGLONG *)p, + (LONGLONG)old + delta, + (LONGLONG)old)); #else do { old = *p; - } while (old != (gpr_atm)InterlockedCompareExchange((volatile LONG *) p, - (LONG) old + delta, - (LONG) old)); + } while (old != (gpr_atm)InterlockedCompareExchange( + (volatile LONG *)p, (LONG)old + delta, (LONG)old)); #endif return old; } -#endif /* GRPC_SUPPORT_ATM_WIN32_H */ +#endif /* GRPC_SUPPORT_ATM_WIN32_H */ diff --git a/include/grpc/support/cmdline.h b/include/grpc/support/cmdline.h index e5a266666e..028dac2955 100644 --- a/include/grpc/support/cmdline.h +++ b/include/grpc/support/cmdline.h @@ -94,4 +94,4 @@ char *gpr_cmdline_usage_string(gpr_cmdline *cl, const char *argv0); } #endif -#endif /* GRPC_SUPPORT_CMDLINE_H */ +#endif /* GRPC_SUPPORT_CMDLINE_H */ diff --git a/include/grpc/support/cpu.h b/include/grpc/support/cpu.h index 2b2a56168a..7d8af59911 100644 --- a/include/grpc/support/cpu.h +++ b/include/grpc/support/cpu.h @@ -54,4 +54,4 @@ unsigned gpr_cpu_current_cpu(void); } // extern "C" #endif -#endif /* GRPC_SUPPORT_CPU_H */ +#endif /* GRPC_SUPPORT_CPU_H */ diff --git a/include/grpc/support/histogram.h b/include/grpc/support/histogram.h index 64d08f0bf1..2fd1084208 100644 --- a/include/grpc/support/histogram.h +++ b/include/grpc/support/histogram.h @@ -73,4 +73,4 @@ void gpr_histogram_merge_contents(gpr_histogram *histogram, } #endif -#endif /* GRPC_SUPPORT_HISTOGRAM_H */ +#endif /* GRPC_SUPPORT_HISTOGRAM_H */ diff --git a/include/grpc/support/host_port.h b/include/grpc/support/host_port.h index 30267ab1df..375d1774e6 100644 --- a/include/grpc/support/host_port.h +++ b/include/grpc/support/host_port.h @@ -61,4 +61,4 @@ int gpr_split_host_port(const char *name, char **host, char **port); } #endif -#endif /* GRPC_SUPPORT_HOST_PORT_H */ +#endif /* GRPC_SUPPORT_HOST_PORT_H */ diff --git a/include/grpc/support/log.h b/include/grpc/support/log.h index aad4f235d2..59db4ba1dd 100644 --- a/include/grpc/support/log.h +++ b/include/grpc/support/log.h @@ -105,4 +105,4 @@ void gpr_set_log_function(gpr_log_func func); } #endif -#endif /* GRPC_SUPPORT_LOG_H */ +#endif /* GRPC_SUPPORT_LOG_H */ diff --git a/include/grpc/support/log_win32.h b/include/grpc/support/log_win32.h index 595a81a5af..ea6b16dd77 100644 --- a/include/grpc/support/log_win32.h +++ b/include/grpc/support/log_win32.h @@ -48,4 +48,4 @@ char *gpr_format_message(DWORD messageid); } #endif -#endif /* GRPC_SUPPORT_LOG_WIN32_H */ +#endif /* GRPC_SUPPORT_LOG_WIN32_H */ diff --git a/include/grpc/support/port_platform.h b/include/grpc/support/port_platform.h index d5745f9878..d09815557e 100644 --- a/include/grpc/support/port_platform.h +++ b/include/grpc/support/port_platform.h @@ -64,7 +64,8 @@ #undef GRPC_NOMINMAX_WAS_NOT_DEFINED #undef NOMINMAX #endif /* GRPC_WIN32_LEAN_AND_MEAN_WAS_NOT_DEFINED */ -#endif /* defined(_WIN64) || defined(WIN64) || defined(_WIN32) || defined(WIN32) */ +#endif /* defined(_WIN64) || defined(WIN64) || defined(_WIN32) || \ + defined(WIN32) */ /* Override this file with one for your platform if you need to redefine things. */ diff --git a/include/grpc/support/slice.h b/include/grpc/support/slice.h index ec6c117afe..3abb1b7ca1 100644 --- a/include/grpc/support/slice.h +++ b/include/grpc/support/slice.h @@ -96,7 +96,7 @@ typedef struct gpr_slice { #define GPR_SLICE_LENGTH(slice) \ ((slice).refcount ? (slice).data.refcounted.length \ : (slice).data.inlined.length) -#define GPR_SLICE_SET_LENGTH(slice, newlen) \ +#define GPR_SLICE_SET_LENGTH(slice, newlen) \ ((slice).refcount ? ((slice).data.refcounted.length = (size_t)(newlen)) \ : ((slice).data.inlined.length = (gpr_uint8)(newlen))) #define GPR_SLICE_END_PTR(slice) \ diff --git a/include/grpc/support/string_util.h b/include/grpc/support/string_util.h index 515709447b..109f9ffdf7 100644 --- a/include/grpc/support/string_util.h +++ b/include/grpc/support/string_util.h @@ -58,4 +58,4 @@ int gpr_asprintf(char **strp, const char *format, ...); } #endif -#endif /* GRPC_SUPPORT_STRING_UTIL_H */ +#endif /* GRPC_SUPPORT_STRING_UTIL_H */ diff --git a/include/grpc/support/subprocess.h b/include/grpc/support/subprocess.h index c884e5ef5e..654623fd09 100644 --- a/include/grpc/support/subprocess.h +++ b/include/grpc/support/subprocess.h @@ -36,7 +36,7 @@ #ifdef __cplusplus extern "C" { -#endif +#endif typedef struct gpr_subprocess gpr_subprocess; diff --git a/include/grpc/support/sync.h b/include/grpc/support/sync.h index 1dd826a828..172aea0217 100644 --- a/include/grpc/support/sync.h +++ b/include/grpc/support/sync.h @@ -312,4 +312,4 @@ gpr_intptr gpr_stats_read(const gpr_stats_counter *c); } #endif -#endif /* GRPC_SUPPORT_SYNC_H */ +#endif /* GRPC_SUPPORT_SYNC_H */ diff --git a/include/grpc/support/sync_generic.h b/include/grpc/support/sync_generic.h index bbd1b3ea2e..fd55e02ea8 100644 --- a/include/grpc/support/sync_generic.h +++ b/include/grpc/support/sync_generic.h @@ -38,24 +38,18 @@ #include <grpc/support/atm.h> /* gpr_event */ -typedef struct { - gpr_atm state; -} gpr_event; +typedef struct { gpr_atm state; } gpr_event; #define GPR_EVENT_INIT \ { 0 } /* gpr_refcount */ -typedef struct { - gpr_atm count; -} gpr_refcount; +typedef struct { gpr_atm count; } gpr_refcount; /* gpr_stats_counter */ -typedef struct { - gpr_atm value; -} gpr_stats_counter; +typedef struct { gpr_atm value; } gpr_stats_counter; #define GPR_STATS_INIT \ { 0 } -#endif /* GRPC_SUPPORT_SYNC_GENERIC_H */ +#endif /* GRPC_SUPPORT_SYNC_GENERIC_H */ diff --git a/include/grpc/support/sync_posix.h b/include/grpc/support/sync_posix.h index 762d9ebe3c..81ffa25900 100644 --- a/include/grpc/support/sync_posix.h +++ b/include/grpc/support/sync_posix.h @@ -44,4 +44,4 @@ typedef pthread_once_t gpr_once; #define GPR_ONCE_INIT PTHREAD_ONCE_INIT -#endif /* GRPC_SUPPORT_SYNC_POSIX_H */ +#endif /* GRPC_SUPPORT_SYNC_POSIX_H */ diff --git a/include/grpc/support/sync_win32.h b/include/grpc/support/sync_win32.h index 66b9af9074..8ddbeaab97 100644 --- a/include/grpc/support/sync_win32.h +++ b/include/grpc/support/sync_win32.h @@ -46,4 +46,4 @@ typedef CONDITION_VARIABLE gpr_cv; typedef INIT_ONCE gpr_once; #define GPR_ONCE_INIT INIT_ONCE_STATIC_INIT -#endif /* GRPC_SUPPORT_SYNC_WIN32_H */ +#endif /* GRPC_SUPPORT_SYNC_WIN32_H */ diff --git a/include/grpc/support/thd.h b/include/grpc/support/thd.h index 8126992d6b..d3265f25bd 100644 --- a/include/grpc/support/thd.h +++ b/include/grpc/support/thd.h @@ -88,4 +88,4 @@ void gpr_thd_join(gpr_thd_id t); } #endif -#endif /* GRPC_SUPPORT_THD_H */ +#endif /* GRPC_SUPPORT_THD_H */ diff --git a/include/grpc/support/time.h b/include/grpc/support/time.h index be59c37956..4ef9c76459 100644 --- a/include/grpc/support/time.h +++ b/include/grpc/support/time.h @@ -84,7 +84,8 @@ void gpr_time_init(void); gpr_timespec gpr_now(gpr_clock_type clock); /* Convert a timespec from one clock to another */ -gpr_timespec gpr_convert_clock_type(gpr_timespec t, gpr_clock_type target_clock); +gpr_timespec gpr_convert_clock_type(gpr_timespec t, + gpr_clock_type target_clock); /* Return -ve, 0, or +ve according to whether a < b, a == b, or a > b respectively. */ diff --git a/include/grpc/support/tls.h b/include/grpc/support/tls.h index 156280e47d..a4ebac56fd 100644 --- a/include/grpc/support/tls.h +++ b/include/grpc/support/tls.h @@ -47,7 +47,7 @@ GPR_TLS_DECL(foo); Thread locals always have static scope. - Initializing a thread local (must be done at library initialization + Initializing a thread local (must be done at library initialization time): gpr_tls_init(&foo); @@ -58,7 +58,7 @@ gpr_tls_set(&foo, new_value); Accessing a thread local: - current_value = gpr_tls_get(&foo, value); + current_value = gpr_tls_get(&foo, value); ALL functions here may be implemented as macros. */ diff --git a/include/grpc/support/tls_gcc.h b/include/grpc/support/tls_gcc.h index a078b104ea..1a02fb22d7 100644 --- a/include/grpc/support/tls_gcc.h +++ b/include/grpc/support/tls_gcc.h @@ -42,10 +42,14 @@ struct gpr_gcc_thread_local { }; #define GPR_TLS_DECL(name) \ - static __thread struct gpr_gcc_thread_local name = {0} + static __thread struct gpr_gcc_thread_local name = {0} -#define gpr_tls_init(tls) do {} while (0) -#define gpr_tls_destroy(tls) do {} while (0) +#define gpr_tls_init(tls) \ + do { \ + } while (0) +#define gpr_tls_destroy(tls) \ + do { \ + } while (0) #define gpr_tls_set(tls, new_value) (((tls)->value) = (new_value)) #define gpr_tls_get(tls) ((tls)->value) diff --git a/include/grpc/support/tls_msvc.h b/include/grpc/support/tls_msvc.h index 526aeeacdf..9997f8e4b0 100644 --- a/include/grpc/support/tls_msvc.h +++ b/include/grpc/support/tls_msvc.h @@ -42,10 +42,14 @@ struct gpr_msvc_thread_local { }; #define GPR_TLS_DECL(name) \ - static __declspec(thread) struct gpr_msvc_thread_local name = {0} + static __declspec(thread) struct gpr_msvc_thread_local name = {0} -#define gpr_tls_init(tls) do {} while (0) -#define gpr_tls_destroy(tls) do {} while (0) +#define gpr_tls_init(tls) \ + do { \ + } while (0) +#define gpr_tls_destroy(tls) \ + do { \ + } while (0) #define gpr_tls_set(tls, new_value) (((tls)->value) = (new_value)) #define gpr_tls_get(tls) ((tls)->value) diff --git a/include/grpc/support/useful.h b/include/grpc/support/useful.h index 3842611590..9f08d788c0 100644 --- a/include/grpc/support/useful.h +++ b/include/grpc/support/useful.h @@ -46,10 +46,10 @@ #define GPR_ARRAY_SIZE(array) (sizeof(array) / sizeof(*(array))) #define GPR_SWAP(type, a, b) \ - do { \ - type x = a; \ - a = b; \ - b = x; \ + do { \ + type x = a; \ + a = b; \ + b = x; \ } while (0) /** Set the \a n-th bit of \a i (a mutable pointer). */ @@ -72,4 +72,4 @@ 0x0f0f0f0f) % \ 255) -#endif /* GRPC_SUPPORT_USEFUL_H */ +#endif /* GRPC_SUPPORT_USEFUL_H */ |