From cd41a0b549fa81d88ed804e1cdf59bb492fa9171 Mon Sep 17 00:00:00 2001 From: "Nicolas \"Pixel\" Noble" Date: Mon, 8 Feb 2016 22:53:14 +0100 Subject: [PATCH] Removing undescores in {GPR,GRPC,CENSUS}_API. --- include/grpc/census.h | 92 ++++++++------- include/grpc/compression.h | 14 +-- include/grpc/grpc.h | 133 +++++++++++----------- include/grpc/grpc_security.h | 73 ++++++------ include/grpc/impl/codegen/alloc.h | 14 +-- include/grpc/impl/codegen/byte_buffer.h | 26 ++--- include/grpc/impl/codegen/log.h | 10 +- include/grpc/impl/codegen/port_platform.h | 12 +- include/grpc/impl/codegen/slice.h | 30 ++--- include/grpc/impl/codegen/slice_buffer.h | 34 +++--- include/grpc/impl/codegen/sync.h | 44 +++---- include/grpc/impl/codegen/time.h | 46 ++++---- include/grpc/support/avl.h | 12 +- include/grpc/support/cmdline.h | 24 ++-- include/grpc/support/cpu.h | 4 +- include/grpc/support/histogram.h | 44 +++---- include/grpc/support/host_port.h | 4 +- include/grpc/support/log_win32.h | 2 +- include/grpc/support/string_util.h | 4 +- include/grpc/support/subprocess.h | 10 +- include/grpc/support/thd.h | 18 +-- test/cpp/end2end/thread_stress_test.cc | 4 +- tools/buildgen/plugins/list_api.py | 2 +- 23 files changed, 324 insertions(+), 332 deletions(-) diff --git a/include/grpc/census.h b/include/grpc/census.h index 6313b196f22..dfa3bd7e0df 100644 --- a/include/grpc/census.h +++ b/include/grpc/census.h @@ -59,15 +59,15 @@ enum census_features { * census_initialize() will return a non-zero value. It is an error to call * census_initialize() more than once (without an intervening * census_shutdown()). */ -CENSUS_API int census_initialize(int features); -CENSUS_API void census_shutdown(void); +CENSUSAPI int census_initialize(int features); +CENSUSAPI void census_shutdown(void); /** Return the features supported by the current census implementation (not all * features will be available on all platforms). */ -CENSUS_API int census_supported(void); +CENSUSAPI int census_supported(void); /** Return the census features currently enabled. */ -CENSUS_API int census_enabled(void); +CENSUSAPI int census_enabled(void); /** A Census Context is a handle used by Census to represent the current tracing @@ -145,16 +145,16 @@ typedef struct { tags used in its creation. @return A new, valid census_context. */ -CENSUS_API census_context *census_context_create( +CENSUSAPI census_context *census_context_create( const census_context *base, const census_tag *tags, int ntags, census_context_status const **status); /* Destroy a context. Once this function has been called, the context cannot be reused. */ -CENSUS_API void census_context_destroy(census_context *context); +CENSUSAPI void census_context_destroy(census_context *context); /* Get a pointer to the original status from the context creation. */ -CENSUS_API const census_context_status *census_context_get_status( +CENSUSAPI const census_context_status *census_context_get_status( const census_context *context); /* Structure used for iterating over the tegs in a context. API clients should @@ -168,18 +168,18 @@ typedef struct { } census_context_iterator; /* Initialize a census_tag_iterator. Must be called before first use. */ -CENSUS_API void census_context_initialize_iterator( +CENSUSAPI void census_context_initialize_iterator( const census_context *context, census_context_iterator *iterator); /* Get the contents of the "next" tag in the context. If there are no more tags, returns 0 (and 'tag' contents will be unchanged), otherwise returns 1. */ -CENSUS_API int census_context_next_tag(census_context_iterator *iterator, - census_tag *tag); +CENSUSAPI int census_context_next_tag(census_context_iterator *iterator, + census_tag *tag); /* Get a context tag by key. Returns 0 if the key is not present. */ -CENSUS_API int census_context_get_tag(const census_context *context, - const char *key, census_tag *tag); +CENSUSAPI int census_context_get_tag(const census_context *context, + const char *key, census_tag *tag); /* Tag set encode/decode functionality. These functionas are intended for use by RPC systems only, for purposes of transmitting/receiving contexts. @@ -201,17 +201,16 @@ CENSUS_API int census_context_get_tag(const census_context *context, [buffer, buffer + *print_buf_size) and binary tags into [returned-ptr, returned-ptr + *bin_buf_size) (and the returned pointer should be buffer + *print_buf_size) */ -CENSUS_API char *census_context_encode(const census_context *context, - char *buffer, size_t buf_size, - size_t *print_buf_size, - size_t *bin_buf_size); +CENSUSAPI char *census_context_encode(const census_context *context, + char *buffer, size_t buf_size, + size_t *print_buf_size, + size_t *bin_buf_size); /* Decode context buffers encoded with census_context_encode(). Returns NULL if there is an error in parsing either buffer. */ -CENSUS_API census_context *census_context_decode(const char *buffer, - size_t size, - const char *bin_buffer, - size_t bin_size); +CENSUSAPI census_context *census_context_decode(const char *buffer, size_t size, + const char *bin_buffer, + size_t bin_size); /* Distributed traces can have a number of options. */ enum census_trace_mask_values { @@ -221,10 +220,10 @@ enum census_trace_mask_values { /** Get the current trace mask associated with this context. The value returned will be the logical or of census_trace_mask_values values. */ -CENSUS_API int census_trace_mask(const census_context *context); +CENSUSAPI int census_trace_mask(const census_context *context); /** Set the trace mask associated with a context. */ -CENSUS_API void census_set_trace_mask(int trace_mask); +CENSUSAPI void census_set_trace_mask(int trace_mask); /* The concept of "operation" is a fundamental concept for Census. In an RPC system, and operation typcially represents a single RPC, or a significant @@ -272,7 +271,7 @@ typedef struct { @return A timestamp representing the operation start time. */ -CENSUS_API census_timestamp census_start_rpc_op_timestamp(void); +CENSUSAPI census_timestamp census_start_rpc_op_timestamp(void); /** Represent functions to map RPC name ID to service/method names. Census @@ -324,7 +323,7 @@ typedef struct { @return A new census context. */ -CENSUS_API census_context *census_start_client_rpc_op( +CENSUSAPI census_context *census_start_client_rpc_op( const census_context *context, int64_t rpc_name_id, const census_rpc_name_info *rpc_name_info, const char *peer, int trace_mask, const census_timestamp *start_time); @@ -332,8 +331,8 @@ CENSUS_API census_context *census_start_client_rpc_op( /** Add peer information to a context representing a client RPC operation. */ -CENSUS_API void census_set_rpc_client_peer(census_context *context, - const char *peer); +CENSUSAPI void census_set_rpc_client_peer(census_context *context, + const char *peer); /** Start a server RPC operation. Returns a new context to be used in future @@ -353,7 +352,7 @@ CENSUS_API void census_set_rpc_client_peer(census_context *context, @return A new census context. */ -CENSUS_API census_context *census_start_server_rpc_op( +CENSUSAPI census_context *census_start_server_rpc_op( const char *buffer, int64_t rpc_name_id, const census_rpc_name_info *rpc_name_info, const char *peer, int trace_mask, census_timestamp *start_time); @@ -383,9 +382,9 @@ CENSUS_API census_context *census_start_server_rpc_op( @return A new census context. */ -CENSUS_API census_context *census_start_op(census_context *context, - const char *family, const char *name, - int trace_mask); +CENSUSAPI census_context *census_start_op(census_context *context, + const char *family, const char *name, + int trace_mask); /** End an operation started by any of the census_start_*_op*() calls. The @@ -396,7 +395,7 @@ CENSUS_API census_context *census_start_op(census_context *context, @param status status associated with the operation. Not interpreted by census. */ -CENSUS_API void census_end_op(census_context *context, int status); +CENSUSAPI void census_end_op(census_context *context, int status); #define CENSUS_TRACE_RECORD_START_OP ((uint32_t)0) #define CENSUS_TRACE_RECORD_END_OP ((uint32_t)1) @@ -408,8 +407,8 @@ CENSUS_API void census_end_op(census_context *context, int status); @param buffer Pointer to buffer to use @param n Number of bytes in buffer */ -CENSUS_API void census_trace_print(census_context *context, uint32_t type, - const char *buffer, size_t n); +CENSUSAPI void census_trace_print(census_context *context, uint32_t type, + const char *buffer, size_t n); /** Trace record. */ typedef struct { @@ -430,7 +429,7 @@ typedef struct { while scanning is ongoing. @returns 0 on success, non-zero on failure (e.g. if a scan is already ongoing) */ -CENSUS_API int census_trace_scan_start(int consume); +CENSUSAPI int census_trace_scan_start(int consume); /** Get a trace record. The data pointed to by the trace buffer is guaranteed stable until the next census_get_trace_record() call (if the consume @@ -441,10 +440,10 @@ CENSUS_API int census_trace_scan_start(int consume); census_trace_scan_start()), 0 if there is no more trace data (and trace_record will not be modified) or 1 otherwise. */ -CENSUS_API int census_get_trace_record(census_trace_record *trace_record); +CENSUSAPI int census_get_trace_record(census_trace_record *trace_record); /** End a scan previously started by census_trace_scan_start() */ -CENSUS_API void census_trace_scan_end(); +CENSUSAPI void census_trace_scan_end(); /* Core stats collection API's. The following concepts are used: * Aggregation: A collection of values. Census supports the following @@ -475,8 +474,8 @@ typedef struct { } census_value; /* Record new usage values against the given context. */ -CENSUS_API void census_record_values(census_context *context, - census_value *values, size_t nvalues); +CENSUSAPI void census_record_values(census_context *context, + census_value *values, size_t nvalues); /** Type representing a particular aggregation */ typedef struct census_aggregation_ops census_aggregation_ops; @@ -508,24 +507,24 @@ typedef struct census_view census_view; /* TODO(aveitch): consider if context is the right argument type to pass in tags. */ -CENSUS_API census_view *census_view_create( +CENSUSAPI census_view *census_view_create( uint32_t metric_id, const census_context *tags, const census_aggregation *aggregations, size_t naggregations); /** Destroy a previously created view. */ -CENSUS_API void census_view_delete(census_view *view); +CENSUSAPI void census_view_delete(census_view *view); /** Metric ID associated with a view */ -CENSUS_API size_t census_view_metric(const census_view *view); +CENSUSAPI size_t census_view_metric(const census_view *view); /** Number of aggregations associated with view. */ -CENSUS_API size_t census_view_naggregations(const census_view *view); +CENSUSAPI size_t census_view_naggregations(const census_view *view); /** Get tags associated with view. */ -CENSUS_API const census_context *census_view_tags(const census_view *view); +CENSUSAPI const census_context *census_view_tags(const census_view *view); /** Get aggregation descriptors associated with a view. */ -CENSUS_API const census_aggregation *census_view_aggregrations( +CENSUSAPI const census_aggregation *census_view_aggregrations( const census_view *view); /** Holds all the aggregation data for a particular view instantiation. Forms @@ -545,11 +544,10 @@ typedef struct { @param view View from which to get data. @return Full set of data for all aggregations for the view. */ -CENSUS_API const census_view_data *census_view_get_data( - const census_view *view); +CENSUSAPI const census_view_data *census_view_get_data(const census_view *view); /** Reset all view data to zero for the specified view */ -CENSUS_API void census_view_reset(census_view *view); +CENSUSAPI void census_view_reset(census_view *view); #ifdef __cplusplus } diff --git a/include/grpc/compression.h b/include/grpc/compression.h index a2b65b0e8af..acc168a6eef 100644 --- a/include/grpc/compression.h +++ b/include/grpc/compression.h @@ -46,33 +46,33 @@ extern "C" { /** Parses the first \a name_length bytes of \a name as a * grpc_compression_algorithm instance, updating \a algorithm. Returns 1 upon * success, 0 otherwise. */ -GRPC_API int grpc_compression_algorithm_parse( +GRPCAPI int grpc_compression_algorithm_parse( const char *name, size_t name_length, grpc_compression_algorithm *algorithm); /** Updates \a name with the encoding name corresponding to a valid \a * algorithm. Returns 1 upon success, 0 otherwise. */ -GRPC_API int grpc_compression_algorithm_name( +GRPCAPI int grpc_compression_algorithm_name( grpc_compression_algorithm algorithm, char **name); /** Returns the compression algorithm corresponding to \a level. * * It abort()s for unknown levels . */ -GRPC_API grpc_compression_algorithm +GRPCAPI grpc_compression_algorithm grpc_compression_algorithm_for_level(grpc_compression_level level); -GRPC_API void grpc_compression_options_init(grpc_compression_options *opts); +GRPCAPI void grpc_compression_options_init(grpc_compression_options *opts); /** Mark \a algorithm as enabled in \a opts. */ -GRPC_API void grpc_compression_options_enable_algorithm( +GRPCAPI void grpc_compression_options_enable_algorithm( grpc_compression_options *opts, grpc_compression_algorithm algorithm); /** Mark \a algorithm as disabled in \a opts. */ -GRPC_API void grpc_compression_options_disable_algorithm( +GRPCAPI void grpc_compression_options_disable_algorithm( grpc_compression_options *opts, grpc_compression_algorithm algorithm); /** Returns true if \a algorithm is marked as enabled in \a opts. */ -GRPC_API int grpc_compression_options_is_algorithm_enabled( +GRPCAPI int grpc_compression_options_is_algorithm_enabled( const grpc_compression_options *opts, grpc_compression_algorithm algorithm); #ifdef __cplusplus diff --git a/include/grpc/grpc.h b/include/grpc/grpc.h index ac4c536be31..5113645daf9 100644 --- a/include/grpc/grpc.h +++ b/include/grpc/grpc.h @@ -55,11 +55,11 @@ extern "C" { * functionality lives in grpc_security.h. */ -GRPC_API void grpc_metadata_array_init(grpc_metadata_array *array); -GRPC_API void grpc_metadata_array_destroy(grpc_metadata_array *array); +GRPCAPI void grpc_metadata_array_init(grpc_metadata_array *array); +GRPCAPI void grpc_metadata_array_destroy(grpc_metadata_array *array); -GRPC_API void grpc_call_details_init(grpc_call_details *details); -GRPC_API void grpc_call_details_destroy(grpc_call_details *details); +GRPCAPI void grpc_call_details_init(grpc_call_details *details); +GRPCAPI void grpc_call_details_destroy(grpc_call_details *details); /** Registers a plugin to be initialized and destroyed with the library. @@ -69,7 +69,7 @@ GRPC_API void grpc_call_details_destroy(grpc_call_details *details); (and hence so will \a init and \a destroy). It is safe to pass NULL to either argument. Plugins are destroyed in the reverse order they were initialized. */ -GRPC_API void grpc_register_plugin(void (*init)(void), void (*destroy)(void)); +GRPCAPI void grpc_register_plugin(void (*init)(void), void (*destroy)(void)); /** Initialize the grpc library. @@ -77,7 +77,7 @@ GRPC_API void grpc_register_plugin(void (*init)(void), void (*destroy)(void)); (To avoid overhead, little checking is done, and some things may work. We do not warrant that they will continue to do so in future revisions of this library). */ -GRPC_API void grpc_init(void); +GRPCAPI void grpc_init(void); /** Shut down the grpc library. @@ -85,13 +85,13 @@ GRPC_API void grpc_init(void); executing within the grpc library. Prior to calling, all application owned grpc objects must have been destroyed. */ -GRPC_API void grpc_shutdown(void); +GRPCAPI void grpc_shutdown(void); /** Return a string representing the current version of grpc */ -GRPC_API const char *grpc_version_string(void); +GRPCAPI const char *grpc_version_string(void); /** Create a completion queue */ -GRPC_API grpc_completion_queue *grpc_completion_queue_create(void *reserved); +GRPCAPI grpc_completion_queue *grpc_completion_queue_create(void *reserved); /** Blocks until an event is available, the completion queue is being shut down, or deadline is reached. @@ -101,9 +101,9 @@ GRPC_API grpc_completion_queue *grpc_completion_queue_create(void *reserved); Callers must not call grpc_completion_queue_next and grpc_completion_queue_pluck simultaneously on the same completion queue. */ -GRPC_API grpc_event grpc_completion_queue_next(grpc_completion_queue *cq, - gpr_timespec deadline, - void *reserved); +GRPCAPI grpc_event grpc_completion_queue_next(grpc_completion_queue *cq, + gpr_timespec deadline, + void *reserved); /** Blocks until an event with tag 'tag' is available, the completion queue is being shutdown or deadline is reached. @@ -116,9 +116,9 @@ GRPC_API grpc_event grpc_completion_queue_next(grpc_completion_queue *cq, Completion queues support a maximum of GRPC_MAX_COMPLETION_QUEUE_PLUCKERS concurrently executing plucks at any time. */ -GRPC_API grpc_event -grpc_completion_queue_pluck(grpc_completion_queue *cq, void *tag, - gpr_timespec deadline, void *reserved); +GRPCAPI grpc_event grpc_completion_queue_pluck(grpc_completion_queue *cq, + void *tag, gpr_timespec deadline, + void *reserved); /** Maximum number of outstanding grpc_completion_queue_pluck executions per completion queue */ @@ -131,11 +131,11 @@ grpc_completion_queue_pluck(grpc_completion_queue *cq, void *tag, After calling this function applications should ensure that no NEW work is added to be published on this completion queue. */ -GRPC_API void grpc_completion_queue_shutdown(grpc_completion_queue *cq); +GRPCAPI void grpc_completion_queue_shutdown(grpc_completion_queue *cq); /** Destroy a completion queue. The caller must ensure that the queue is drained and no threads are executing grpc_completion_queue_next */ -GRPC_API void grpc_completion_queue_destroy(grpc_completion_queue *cq); +GRPCAPI void grpc_completion_queue_destroy(grpc_completion_queue *cq); /** Create a completion queue alarm instance associated to \a cq. * @@ -143,18 +143,18 @@ GRPC_API void grpc_completion_queue_destroy(grpc_completion_queue *cq); * grpc_alarm_cancel), an event with tag \a tag will be added to \a cq. If the * alarm expired, the event's success bit will be true, false otherwise (ie, * upon cancellation). */ -GRPC_API grpc_alarm *grpc_alarm_create(grpc_completion_queue *cq, - gpr_timespec deadline, void *tag); +GRPCAPI grpc_alarm *grpc_alarm_create(grpc_completion_queue *cq, + gpr_timespec deadline, void *tag); /** Cancel a completion queue alarm. Calling this function over an alarm that * has already fired has no effect. */ -GRPC_API void grpc_alarm_cancel(grpc_alarm *alarm); +GRPCAPI void grpc_alarm_cancel(grpc_alarm *alarm); /** Destroy the given completion queue alarm, cancelling it in the process. */ -GRPC_API void grpc_alarm_destroy(grpc_alarm *alarm); +GRPCAPI void grpc_alarm_destroy(grpc_alarm *alarm); /** Check the connectivity state of a channel. */ -GRPC_API grpc_connectivity_state +GRPCAPI grpc_connectivity_state grpc_channel_check_connectivity_state(grpc_channel *channel, int try_to_connect); @@ -163,7 +163,7 @@ grpc_channel_check_connectivity_state(grpc_channel *channel, tag will be enqueued on cq with success=1. If deadline expires BEFORE the state is changed, tag will be enqueued on cq with success=0. */ -GRPC_API void grpc_channel_watch_connectivity_state( +GRPCAPI void grpc_channel_watch_connectivity_state( grpc_channel *channel, grpc_connectivity_state last_observed_state, gpr_timespec deadline, grpc_completion_queue *cq, void *tag); @@ -173,24 +173,23 @@ GRPC_API void grpc_channel_watch_connectivity_state( If parent_call is non-NULL, it must be a server-side call. It will be used to propagate properties from the server call to this new client call. */ -GRPC_API grpc_call *grpc_channel_create_call( +GRPCAPI grpc_call *grpc_channel_create_call( grpc_channel *channel, grpc_call *parent_call, uint32_t propagation_mask, grpc_completion_queue *completion_queue, const char *method, const char *host, gpr_timespec deadline, void *reserved); /** Ping the channels peer (load balanced channels will select one sub-channel to ping); if the channel is not connected, posts a failed. */ -GRPC_API void grpc_channel_ping(grpc_channel *channel, - grpc_completion_queue *cq, void *tag, - void *reserved); +GRPCAPI void grpc_channel_ping(grpc_channel *channel, grpc_completion_queue *cq, + void *tag, void *reserved); /** Pre-register a method/host pair on a channel. */ -GRPC_API void *grpc_channel_register_call(grpc_channel *channel, - const char *method, const char *host, - void *reserved); +GRPCAPI void *grpc_channel_register_call(grpc_channel *channel, + const char *method, const char *host, + void *reserved); /** Create a call given a handle returned from grpc_channel_register_call */ -GRPC_API grpc_call *grpc_channel_create_registered_call( +GRPCAPI grpc_call *grpc_channel_create_registered_call( grpc_channel *channel, grpc_call *parent_call, uint32_t propagation_mask, grpc_completion_queue *completion_queue, void *registered_call_handle, gpr_timespec deadline, void *reserved); @@ -206,9 +205,9 @@ GRPC_API grpc_call *grpc_channel_create_registered_call( needs to be synchronized. As an optimization, you may synchronize batches containing just send operations independently from batches containing just receive operations. */ -GRPC_API grpc_call_error grpc_call_start_batch(grpc_call *call, - const grpc_op *ops, size_t nops, - void *tag, void *reserved); +GRPCAPI grpc_call_error grpc_call_start_batch(grpc_call *call, + const grpc_op *ops, size_t nops, + void *tag, void *reserved); /** Returns a newly allocated string representing the endpoint to which this call is communicating with. The string is in the uri format accepted by @@ -218,36 +217,36 @@ GRPC_API grpc_call_error grpc_call_start_batch(grpc_call *call, WARNING: this value is never authenticated or subject to any security related code. It must not be used for any authentication related functionality. Instead, use grpc_auth_context. */ -GRPC_API char *grpc_call_get_peer(grpc_call *call); +GRPCAPI char *grpc_call_get_peer(grpc_call *call); struct census_context; /* Set census context for a call; Must be called before first call to grpc_call_start_batch(). */ -GRPC_API void grpc_census_call_set_context(grpc_call *call, - struct census_context *context); +GRPCAPI void grpc_census_call_set_context(grpc_call *call, + struct census_context *context); /* Retrieve the calls current census context. */ -GRPC_API struct census_context *grpc_census_call_get_context(grpc_call *call); +GRPCAPI struct census_context *grpc_census_call_get_context(grpc_call *call); /** Return a newly allocated string representing the target a channel was created for. */ -GRPC_API char *grpc_channel_get_target(grpc_channel *channel); +GRPCAPI char *grpc_channel_get_target(grpc_channel *channel); /** Create a client channel to 'target'. Additional channel level configuration MAY be provided by grpc_channel_args, though the expectation is that most clients will want to simply pass NULL. See grpc_channel_args definition for more on this. The data in 'args' need only live through the invocation of this function. */ -GRPC_API grpc_channel *grpc_insecure_channel_create( +GRPCAPI grpc_channel *grpc_insecure_channel_create( const char *target, const grpc_channel_args *args, void *reserved); /** Create a lame client: this client fails every operation attempted on it. */ -GRPC_API grpc_channel *grpc_lame_client_channel_create( +GRPCAPI grpc_channel *grpc_lame_client_channel_create( const char *target, grpc_status_code error_code, const char *error_message); /** Close and destroy a grpc channel */ -GRPC_API void grpc_channel_destroy(grpc_channel *channel); +GRPCAPI void grpc_channel_destroy(grpc_channel *channel); /* Error handling for grpc_call Most grpc_call functions return a grpc_error. If the error is not GRPC_OK @@ -260,7 +259,7 @@ GRPC_API void grpc_channel_destroy(grpc_channel *channel); THREAD-SAFETY grpc_call_cancel and grpc_call_cancel_with_status are thread-safe, and can be called at any point before grpc_call_destroy is called.*/ -GRPC_API grpc_call_error grpc_call_cancel(grpc_call *call, void *reserved); +GRPCAPI grpc_call_error grpc_call_cancel(grpc_call *call, void *reserved); /** Called by clients to cancel an RPC on the server. Can be called multiple times, from any thread. @@ -268,13 +267,13 @@ GRPC_API grpc_call_error grpc_call_cancel(grpc_call *call, void *reserved); and description passed in. Importantly, this function does not send status nor description to the remote endpoint. */ -GRPC_API grpc_call_error +GRPCAPI grpc_call_error grpc_call_cancel_with_status(grpc_call *call, grpc_status_code status, const char *description, void *reserved); /** Destroy a call. THREAD SAFETY: grpc_call_destroy is thread-compatible */ -GRPC_API void grpc_call_destroy(grpc_call *call); +GRPCAPI void grpc_call_destroy(grpc_call *call); /** Request notification of a new call. Once a call is received, a notification tagged with \a tag_new is added to @@ -284,7 +283,7 @@ GRPC_API void grpc_call_destroy(grpc_call *call); to \a cq_bound_to_call. Note that \a cq_for_notification must have been registered to the server via \a grpc_server_register_completion_queue. */ -GRPC_API grpc_call_error +GRPCAPI grpc_call_error grpc_server_request_call(grpc_server *server, grpc_call **call, grpc_call_details *details, grpc_metadata_array *request_metadata, @@ -299,14 +298,13 @@ grpc_server_request_call(grpc_server *server, grpc_call **call, registered_method (as returned by this function). Must be called before grpc_server_start. Returns NULL on failure. */ -GRPC_API void *grpc_server_register_method(grpc_server *server, - const char *method, - const char *host); +GRPCAPI void *grpc_server_register_method(grpc_server *server, + const char *method, const char *host); /** Request notification of a new pre-registered call. 'cq_for_notification' must have been registered to the server via grpc_server_register_completion_queue. */ -GRPC_API grpc_call_error grpc_server_request_registered_call( +GRPCAPI grpc_call_error grpc_server_request_registered_call( grpc_server *server, void *registered_method, grpc_call **call, gpr_timespec *deadline, grpc_metadata_array *request_metadata, grpc_byte_buffer **optional_payload, @@ -317,25 +315,25 @@ GRPC_API 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_API grpc_server *grpc_server_create(const grpc_channel_args *args, - void *reserved); +GRPCAPI 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 and to grpc_server_shutdown_and_notify. Must be performed prior to grpc_server_start. */ -GRPC_API void grpc_server_register_completion_queue(grpc_server *server, - grpc_completion_queue *cq, - void *reserved); +GRPCAPI void grpc_server_register_completion_queue(grpc_server *server, + grpc_completion_queue *cq, + void *reserved); /** Add a HTTP2 over plaintext over tcp listener. Returns bound port number on success, 0 on failure. REQUIRES: server not started */ -GRPC_API int grpc_server_add_insecure_http2_port(grpc_server *server, - const char *addr); +GRPCAPI int grpc_server_add_insecure_http2_port(grpc_server *server, + const char *addr); /** Start a server - tells all listeners to start listening */ -GRPC_API void grpc_server_start(grpc_server *server); +GRPCAPI void grpc_server_start(grpc_server *server); /** Begin shutting down a server. After completion, no new calls or connections will be admitted. @@ -344,19 +342,19 @@ GRPC_API void grpc_server_start(grpc_server *server); Shutdown is idempotent, and all tags will be notified at once if multiple grpc_server_shutdown_and_notify calls are made. 'cq' must have been registered to this server via grpc_server_register_completion_queue. */ -GRPC_API void grpc_server_shutdown_and_notify(grpc_server *server, - grpc_completion_queue *cq, - void *tag); +GRPCAPI void grpc_server_shutdown_and_notify(grpc_server *server, + grpc_completion_queue *cq, + void *tag); /** Cancel all in-progress calls. Only usable after shutdown. */ -GRPC_API void grpc_server_cancel_all_calls(grpc_server *server); +GRPCAPI void grpc_server_cancel_all_calls(grpc_server *server); /** Destroy a server. Shutdown must have completed beforehand (i.e. all tags generated by grpc_server_shutdown_and_notify must have been received, and at least one call to grpc_server_shutdown_and_notify must have been made). */ -GRPC_API void grpc_server_destroy(grpc_server *server); +GRPCAPI void grpc_server_destroy(grpc_server *server); /** Enable or disable a tracer. @@ -366,18 +364,17 @@ GRPC_API void grpc_server_destroy(grpc_server *server); Use of this function is not strictly thread-safe, but the thread-safety issues raised by it should not be of concern. */ -GRPC_API int grpc_tracer_set_enabled(const char *name, int enabled); +GRPCAPI int grpc_tracer_set_enabled(const char *name, int enabled); /** Check whether a metadata key is legal (will be accepted by core) */ -GRPC_API int grpc_header_key_is_legal(const char *key, size_t length); +GRPCAPI int grpc_header_key_is_legal(const char *key, size_t length); /** Check whether a non-binary metadata value is legal (will be accepted by core) */ -GRPC_API int grpc_header_nonbin_value_is_legal(const char *value, - size_t length); +GRPCAPI int grpc_header_nonbin_value_is_legal(const char *value, size_t length); /** Check whether a metadata key corresponds to a binary value */ -GRPC_API int grpc_is_binary_header(const char *key, size_t length); +GRPCAPI int grpc_is_binary_header(const char *key, size_t length); #ifdef __cplusplus } diff --git a/include/grpc/grpc_security.h b/include/grpc/grpc_security.h index 28881c3a11a..3de5cae8be2 100644 --- a/include/grpc/grpc_security.h +++ b/include/grpc/grpc_security.h @@ -65,39 +65,39 @@ typedef struct grpc_auth_property { } grpc_auth_property; /* Returns NULL when the iterator is at the end. */ -GRPC_API const grpc_auth_property *grpc_auth_property_iterator_next( +GRPCAPI const grpc_auth_property *grpc_auth_property_iterator_next( grpc_auth_property_iterator *it); /* Iterates over the auth context. */ -GRPC_API grpc_auth_property_iterator +GRPCAPI grpc_auth_property_iterator grpc_auth_context_property_iterator(const grpc_auth_context *ctx); /* Gets the peer identity. Returns an empty iterator (first _next will return NULL) if the peer is not authenticated. */ -GRPC_API grpc_auth_property_iterator +GRPCAPI grpc_auth_property_iterator grpc_auth_context_peer_identity(const grpc_auth_context *ctx); /* Finds a property in the context. May return an empty iterator (first _next will return NULL) if no property with this name was found in the context. */ -GRPC_API grpc_auth_property_iterator +GRPCAPI grpc_auth_property_iterator grpc_auth_context_find_properties_by_name(const grpc_auth_context *ctx, const char *name); /* Gets the name of the property that indicates the peer identity. Will return NULL if the peer is not authenticated. */ -GRPC_API const char *grpc_auth_context_peer_identity_property_name( +GRPCAPI const char *grpc_auth_context_peer_identity_property_name( const grpc_auth_context *ctx); /* Returns 1 if the peer is authenticated, 0 otherwise. */ -GRPC_API int grpc_auth_context_peer_is_authenticated( +GRPCAPI int grpc_auth_context_peer_is_authenticated( const grpc_auth_context *ctx); /* Gets the auth context from the call. Caller needs to call grpc_auth_context_release on the returned context. */ -GRPC_API grpc_auth_context *grpc_call_auth_context(grpc_call *call); +GRPCAPI grpc_auth_context *grpc_call_auth_context(grpc_call *call); /* Releases the auth context returned from grpc_call_auth_context. */ -GRPC_API void grpc_auth_context_release(grpc_auth_context *context); +GRPCAPI void grpc_auth_context_release(grpc_auth_context *context); /* -- The following auth context methods should only be called by a server metadata @@ -105,19 +105,18 @@ GRPC_API void grpc_auth_context_release(grpc_auth_context *context); -- */ /* Add a property. */ -GRPC_API void grpc_auth_context_add_property(grpc_auth_context *ctx, - const char *name, - const char *value, - size_t value_length); +GRPCAPI void grpc_auth_context_add_property(grpc_auth_context *ctx, + const char *name, const char *value, + size_t value_length); /* Add a C string property. */ -GRPC_API void grpc_auth_context_add_cstring_property(grpc_auth_context *ctx, - const char *name, - const char *value); +GRPCAPI void grpc_auth_context_add_cstring_property(grpc_auth_context *ctx, + const char *name, + const char *value); /* Sets the property name. Returns 1 if successful or 0 in case of failure (which means that no property with this name exists). */ -GRPC_API int grpc_auth_context_set_peer_identity_property_name( +GRPCAPI int grpc_auth_context_set_peer_identity_property_name( grpc_auth_context *ctx, const char *name); /* --- grpc_channel_credentials object. --- @@ -129,7 +128,7 @@ typedef struct grpc_channel_credentials grpc_channel_credentials; /* Releases a channel credentials object. The creator of the credentials object is responsible for its release. */ -GRPC_API void grpc_channel_credentials_release(grpc_channel_credentials *creds); +GRPCAPI void grpc_channel_credentials_release(grpc_channel_credentials *creds); /* Environment variable that points to the google default application credentials json key or refresh token. Used in the @@ -139,7 +138,7 @@ GRPC_API void grpc_channel_credentials_release(grpc_channel_credentials *creds); /* Creates default credentials to connect to a google gRPC service. WARNING: Do NOT use this credentials to connect to a non-google service as this could result in an oauth2 token leak. */ -GRPC_API grpc_channel_credentials *grpc_google_default_credentials_create(void); +GRPCAPI grpc_channel_credentials *grpc_google_default_credentials_create(void); /* Environment variable that points to the default SSL roots file. This file must be a PEM encoded file with all the roots such as the one that can be @@ -192,7 +191,7 @@ typedef struct { - pem_key_cert_pair is a pointer on the object containing client's private key and certificate chain. This parameter can be NULL if the client does not have such a key/cert pair. */ -GRPC_API grpc_channel_credentials *grpc_ssl_credentials_create( +GRPCAPI grpc_channel_credentials *grpc_ssl_credentials_create( const char *pem_root_certs, grpc_ssl_pem_key_cert_pair *pem_key_cert_pair, void *reserved); @@ -206,32 +205,32 @@ typedef struct grpc_call_credentials grpc_call_credentials; /* Releases a call credentials object. The creator of the credentials object is responsible for its release. */ -GRPC_API void grpc_call_credentials_release(grpc_call_credentials *creds); +GRPCAPI void grpc_call_credentials_release(grpc_call_credentials *creds); /* Creates a composite channel credentials object. */ -GRPC_API grpc_channel_credentials *grpc_composite_channel_credentials_create( +GRPCAPI grpc_channel_credentials *grpc_composite_channel_credentials_create( grpc_channel_credentials *channel_creds, grpc_call_credentials *call_creds, void *reserved); /* Creates a composite call credentials object. */ -GRPC_API grpc_call_credentials *grpc_composite_call_credentials_create( +GRPCAPI grpc_call_credentials *grpc_composite_call_credentials_create( grpc_call_credentials *creds1, grpc_call_credentials *creds2, void *reserved); /* Creates a compute engine credentials object for connecting to Google. WARNING: Do NOT use this credentials to connect to a non-google service as this could result in an oauth2 token leak. */ -GRPC_API grpc_call_credentials *grpc_google_compute_engine_credentials_create( +GRPCAPI grpc_call_credentials *grpc_google_compute_engine_credentials_create( void *reserved); -GRPC_API gpr_timespec grpc_max_auth_token_lifetime(); +GRPCAPI gpr_timespec grpc_max_auth_token_lifetime(); /* Creates a JWT credentials object. May return NULL if the input is invalid. - json_key is the JSON key string containing the client's private key. - token_lifetime is the lifetime of each Json Web Token (JWT) created with this credentials. It should not exceed grpc_max_auth_token_lifetime or will be cropped to this value. */ -GRPC_API grpc_call_credentials * +GRPCAPI grpc_call_credentials * grpc_service_account_jwt_access_credentials_create(const char *json_key, gpr_timespec token_lifetime, void *reserved); @@ -242,16 +241,16 @@ grpc_service_account_jwt_access_credentials_create(const char *json_key, this could result in an oauth2 token leak. - json_refresh_token is the JSON string containing the refresh token itself along with a client_id and client_secret. */ -GRPC_API grpc_call_credentials *grpc_google_refresh_token_credentials_create( +GRPCAPI grpc_call_credentials *grpc_google_refresh_token_credentials_create( const char *json_refresh_token, void *reserved); /* Creates an Oauth2 Access Token credentials with an access token that was aquired by an out of band mechanism. */ -GRPC_API grpc_call_credentials *grpc_access_token_credentials_create( +GRPCAPI grpc_call_credentials *grpc_access_token_credentials_create( const char *access_token, void *reserved); /* Creates an IAM credentials object for connecting to Google. */ -GRPC_API grpc_call_credentials *grpc_google_iam_credentials_create( +GRPCAPI grpc_call_credentials *grpc_google_iam_credentials_create( const char *authorization_token, const char *authority_selector, void *reserved); @@ -313,13 +312,13 @@ typedef struct { } grpc_metadata_credentials_plugin; /* Creates a credentials object from a plugin. */ -GRPC_API grpc_call_credentials *grpc_metadata_credentials_create_from_plugin( +GRPCAPI grpc_call_credentials *grpc_metadata_credentials_create_from_plugin( grpc_metadata_credentials_plugin plugin, void *reserved); /* --- Secure channel creation. --- */ /* Creates a secure channel using the passed-in credentials. */ -GRPC_API grpc_channel *grpc_secure_channel_create( +GRPCAPI grpc_channel *grpc_secure_channel_create( grpc_channel_credentials *creds, const char *target, const grpc_channel_args *args, void *reserved); @@ -332,7 +331,7 @@ typedef struct grpc_server_credentials grpc_server_credentials; /* Releases a server_credentials object. The creator of the server_credentials object is responsible for its release. */ -GRPC_API void grpc_server_credentials_release(grpc_server_credentials *creds); +GRPCAPI void grpc_server_credentials_release(grpc_server_credentials *creds); /* Creates an SSL server_credentials object. - pem_roots_cert is the NULL-terminated string containing the PEM encoding of @@ -345,7 +344,7 @@ GRPC_API void grpc_server_credentials_release(grpc_server_credentials *creds); - force_client_auth, if set to non-zero will force the client to authenticate with an SSL cert. Note that this option is ignored if pem_root_certs is NULL. */ -GRPC_API grpc_server_credentials *grpc_ssl_server_credentials_create( +GRPCAPI grpc_server_credentials *grpc_ssl_server_credentials_create( const char *pem_root_certs, grpc_ssl_pem_key_cert_pair *pem_key_cert_pairs, size_t num_key_cert_pairs, int force_client_auth, void *reserved); @@ -354,15 +353,15 @@ GRPC_API grpc_server_credentials *grpc_ssl_server_credentials_create( /* Add a HTTP2 over an encrypted link over tcp listener. Returns bound port number on success, 0 on failure. REQUIRES: server not started */ -GRPC_API int grpc_server_add_secure_http2_port(grpc_server *server, - const char *addr, - grpc_server_credentials *creds); +GRPCAPI int grpc_server_add_secure_http2_port(grpc_server *server, + const char *addr, + grpc_server_credentials *creds); /* --- Call specific credentials. --- */ /* Sets a credentials to a call. Can only be called on the client side before grpc_call_start_batch. */ -GRPC_API grpc_call_error +GRPCAPI grpc_call_error grpc_call_set_credentials(grpc_call *call, grpc_call_credentials *creds); /* --- Auth Metadata Processing --- */ @@ -394,7 +393,7 @@ typedef struct { void *state; } grpc_auth_metadata_processor; -GRPC_API void grpc_server_credentials_set_auth_metadata_processor( +GRPCAPI void grpc_server_credentials_set_auth_metadata_processor( grpc_server_credentials *creds, grpc_auth_metadata_processor processor); #ifdef __cplusplus diff --git a/include/grpc/impl/codegen/alloc.h b/include/grpc/impl/codegen/alloc.h index dc7ba78846c..23513544330 100644 --- a/include/grpc/impl/codegen/alloc.h +++ b/include/grpc/impl/codegen/alloc.h @@ -49,23 +49,23 @@ typedef struct gpr_allocation_functions { } gpr_allocation_functions; /* malloc, never returns NULL */ -GPR_API void *gpr_malloc(size_t size); +GPRAPI void *gpr_malloc(size_t size); /* free */ -GPR_API void gpr_free(void *ptr); +GPRAPI void gpr_free(void *ptr); /* realloc, never returns NULL */ -GPR_API void *gpr_realloc(void *p, size_t size); +GPRAPI void *gpr_realloc(void *p, size_t size); /* aligned malloc, never returns NULL, will align to 1 << alignment_log */ -GPR_API void *gpr_malloc_aligned(size_t size, size_t alignment_log); +GPRAPI void *gpr_malloc_aligned(size_t size, size_t alignment_log); /* free memory allocated by gpr_malloc_aligned */ -GPR_API void gpr_free_aligned(void *ptr); +GPRAPI void gpr_free_aligned(void *ptr); /** Request the family of allocation functions in \a functions be used. NOTE * that this request will be honored in a *best effort* basis and that no * guarantees are made about the default functions (eg, malloc) being called. */ -GPR_API void gpr_set_allocation_functions(gpr_allocation_functions functions); +GPRAPI void gpr_set_allocation_functions(gpr_allocation_functions functions); /** Return the family of allocation functions currently in effect. */ -GPR_API gpr_allocation_functions gpr_get_allocation_functions(); +GPRAPI gpr_allocation_functions gpr_get_allocation_functions(); #ifdef __cplusplus } diff --git a/include/grpc/impl/codegen/byte_buffer.h b/include/grpc/impl/codegen/byte_buffer.h index 5049461f73f..9e96d4bdae4 100644 --- a/include/grpc/impl/codegen/byte_buffer.h +++ b/include/grpc/impl/codegen/byte_buffer.h @@ -65,8 +65,8 @@ typedef struct grpc_byte_buffer grpc_byte_buffer; * * Increases the reference count for all \a slices processed. The user is * responsible for invoking grpc_byte_buffer_destroy on the returned instance.*/ -GRPC_API grpc_byte_buffer *grpc_raw_byte_buffer_create(gpr_slice *slices, - size_t nslices); +GRPCAPI grpc_byte_buffer *grpc_raw_byte_buffer_create(gpr_slice *slices, + size_t nslices); /** Returns a *compressed* RAW byte buffer instance over the given slices (up to * \a nslices). The \a compression argument defines the compression algorithm @@ -74,44 +74,44 @@ GRPC_API grpc_byte_buffer *grpc_raw_byte_buffer_create(gpr_slice *slices, * * Increases the reference count for all \a slices processed. The user is * responsible for invoking grpc_byte_buffer_destroy on the returned instance.*/ -GRPC_API grpc_byte_buffer *grpc_raw_compressed_byte_buffer_create( +GRPCAPI grpc_byte_buffer *grpc_raw_compressed_byte_buffer_create( gpr_slice *slices, size_t nslices, grpc_compression_algorithm compression); /** Copies input byte buffer \a bb. * * Increases the reference count of all the source slices. The user is * responsible for calling grpc_byte_buffer_destroy over the returned copy. */ -GRPC_API grpc_byte_buffer *grpc_byte_buffer_copy(grpc_byte_buffer *bb); +GRPCAPI grpc_byte_buffer *grpc_byte_buffer_copy(grpc_byte_buffer *bb); /** Returns the size of the given byte buffer, in bytes. */ -GRPC_API size_t grpc_byte_buffer_length(grpc_byte_buffer *bb); +GRPCAPI size_t grpc_byte_buffer_length(grpc_byte_buffer *bb); /** Destroys \a byte_buffer deallocating all its memory. */ -GRPC_API void grpc_byte_buffer_destroy(grpc_byte_buffer *byte_buffer); +GRPCAPI void grpc_byte_buffer_destroy(grpc_byte_buffer *byte_buffer); /** Reader for byte buffers. Iterates over slices in the byte buffer */ struct grpc_byte_buffer_reader; typedef struct grpc_byte_buffer_reader grpc_byte_buffer_reader; /** Initialize \a reader to read over \a buffer */ -GRPC_API void grpc_byte_buffer_reader_init(grpc_byte_buffer_reader *reader, - grpc_byte_buffer *buffer); +GRPCAPI void grpc_byte_buffer_reader_init(grpc_byte_buffer_reader *reader, + grpc_byte_buffer *buffer); /** Cleanup and destroy \a reader */ -GRPC_API void grpc_byte_buffer_reader_destroy(grpc_byte_buffer_reader *reader); +GRPCAPI void grpc_byte_buffer_reader_destroy(grpc_byte_buffer_reader *reader); /** Updates \a slice with the next piece of data from from \a reader and returns * 1. Returns 0 at the end of the stream. Caller is responsible for calling * gpr_slice_unref on the result. */ -GRPC_API int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader *reader, - gpr_slice *slice); +GRPCAPI int grpc_byte_buffer_reader_next(grpc_byte_buffer_reader *reader, + gpr_slice *slice); /** Merge all data from \a reader into single slice */ -GRPC_API gpr_slice +GRPCAPI gpr_slice grpc_byte_buffer_reader_readall(grpc_byte_buffer_reader *reader); /** Returns a RAW byte buffer instance from the output of \a reader. */ -GRPC_API grpc_byte_buffer *grpc_raw_byte_buffer_from_reader( +GRPCAPI grpc_byte_buffer *grpc_raw_byte_buffer_from_reader( grpc_byte_buffer_reader *reader); #ifdef __cplusplus diff --git a/include/grpc/impl/codegen/log.h b/include/grpc/impl/codegen/log.h index 5df91c65098..d6e18e9ca5f 100644 --- a/include/grpc/impl/codegen/log.h +++ b/include/grpc/impl/codegen/log.h @@ -71,11 +71,11 @@ const char *gpr_log_severity_string(gpr_log_severity severity); /* Log a message. It's advised to use GPR_xxx above to generate the context * for each message */ -GPR_API void gpr_log(const char *file, int line, gpr_log_severity severity, - const char *format, ...); +GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity, + const char *format, ...); -GPR_API void gpr_log_message(const char *file, int line, - gpr_log_severity severity, const char *message); +GPRAPI void gpr_log_message(const char *file, int line, + gpr_log_severity severity, const char *message); /* Log overrides: applications can use this API to intercept logging calls and use their own implementations */ @@ -88,7 +88,7 @@ typedef struct { } gpr_log_func_args; typedef void (*gpr_log_func)(gpr_log_func_args *args); -GPR_API void gpr_set_log_function(gpr_log_func func); +GPRAPI void gpr_set_log_function(gpr_log_func func); /* abort() the process if x is zero, having written a line to the log. diff --git a/include/grpc/impl/codegen/port_platform.h b/include/grpc/impl/codegen/port_platform.h index d265e9b3922..258063fd545 100644 --- a/include/grpc/impl/codegen/port_platform.h +++ b/include/grpc/impl/codegen/port_platform.h @@ -347,16 +347,16 @@ typedef unsigned __int64 uint64_t; } while (0) #endif /* GPR_FORBID_UNREACHABLE_CODE */ -#ifndef GPR_API -#define GPR_API +#ifndef GPRAPI +#define GPRAPI #endif -#ifndef GRPC_API -#define GRPC_API GPR_API +#ifndef GRPCAPI +#define GRPCAPI GPRAPI #endif -#ifndef CENSUS_API -#define CENSUS_API GRPC_API +#ifndef CENSUSAPI +#define CENSUSAPI GRPCAPI #endif #endif /* GRPC_IMPL_CODEGEN_PORT_PLATFORM_H */ diff --git a/include/grpc/impl/codegen/slice.h b/include/grpc/impl/codegen/slice.h index d60a40ca352..a62fdd087bc 100644 --- a/include/grpc/impl/codegen/slice.h +++ b/include/grpc/impl/codegen/slice.h @@ -105,7 +105,7 @@ typedef struct gpr_slice { /* Increment the refcount of s. Requires slice is initialized. Returns s. */ -GPR_API gpr_slice gpr_slice_ref(gpr_slice s); +GPRAPI gpr_slice gpr_slice_ref(gpr_slice s); /* Decrement the ref count of s. If the ref count of s reaches zero, all slices sharing the ref count are destroyed, and considered no longer @@ -113,22 +113,22 @@ GPR_API gpr_slice gpr_slice_ref(gpr_slice s); len, dest) where dest!=NULL , then (*dest)(start) is called, else if s is ultimately derived from a call to gpr_slice_new_with_len(start, len, dest) where dest!=NULL , then (*dest)(start, len). Requires s initialized. */ -GPR_API void gpr_slice_unref(gpr_slice s); +GPRAPI void gpr_slice_unref(gpr_slice s); /* Create a slice pointing at some data. Calls malloc to allocate a refcount for the object, and arranges that destroy will be called with the pointer passed in at destruction. */ -GPR_API gpr_slice gpr_slice_new(void *p, size_t len, void (*destroy)(void *)); +GPRAPI gpr_slice gpr_slice_new(void *p, size_t len, void (*destroy)(void *)); /* Equivalent to gpr_slice_new, but with a two argument destroy function that also takes the slice length. */ -GPR_API gpr_slice +GPRAPI gpr_slice gpr_slice_new_with_len(void *p, size_t len, void (*destroy)(void *, size_t)); /* Equivalent to gpr_slice_new(malloc(len), len, free), but saves one malloc() call. Aborts if malloc() fails. */ -GPR_API gpr_slice gpr_slice_malloc(size_t length); +GPRAPI gpr_slice gpr_slice_malloc(size_t length); /* Create a slice by copying a string. Does not preserve null terminators. @@ -136,44 +136,44 @@ GPR_API gpr_slice gpr_slice_malloc(size_t length); size_t len = strlen(source); gpr_slice slice = gpr_slice_malloc(len); memcpy(slice->data, source, len); */ -GPR_API gpr_slice gpr_slice_from_copied_string(const char *source); +GPRAPI gpr_slice gpr_slice_from_copied_string(const char *source); /* Create a slice by copying a buffer. Equivalent to: gpr_slice slice = gpr_slice_malloc(len); memcpy(slice->data, source, len); */ -GPR_API gpr_slice gpr_slice_from_copied_buffer(const char *source, size_t len); +GPRAPI gpr_slice gpr_slice_from_copied_buffer(const char *source, size_t len); /* Create a slice pointing to constant memory */ -GPR_API gpr_slice gpr_slice_from_static_string(const char *source); +GPRAPI gpr_slice gpr_slice_from_static_string(const char *source); /* Return a result slice derived from s, which shares a ref count with s, where result.data==s.data+begin, and result.length==end-begin. The ref count of s is increased by one. Requires s initialized, begin <= end, begin <= s.length, and end <= source->length. */ -GPR_API gpr_slice gpr_slice_sub(gpr_slice s, size_t begin, size_t end); +GPRAPI gpr_slice gpr_slice_sub(gpr_slice s, size_t begin, size_t end); /* The same as gpr_slice_sub, but without altering the ref count */ -GPR_API gpr_slice gpr_slice_sub_no_ref(gpr_slice s, size_t begin, size_t end); +GPRAPI gpr_slice gpr_slice_sub_no_ref(gpr_slice s, size_t begin, size_t end); /* Splits s into two: modifies s to be s[0:split], and returns a new slice, sharing a refcount with s, that contains s[split:s.length]. Requires s intialized, split <= s.length */ -GPR_API gpr_slice gpr_slice_split_tail(gpr_slice *s, size_t split); +GPRAPI gpr_slice gpr_slice_split_tail(gpr_slice *s, size_t split); /* Splits s into two: modifies s to be s[split:s.length], and returns a new slice, sharing a refcount with s, that contains s[0:split]. Requires s intialized, split <= s.length */ -GPR_API gpr_slice gpr_slice_split_head(gpr_slice *s, size_t split); +GPRAPI gpr_slice gpr_slice_split_head(gpr_slice *s, size_t split); -GPR_API gpr_slice gpr_empty_slice(void); +GPRAPI gpr_slice gpr_empty_slice(void); /* Returns <0 if a < b, ==0 if a == b, >0 if a > b The order is arbitrary, and is not guaranteed to be stable across different versions of the API. */ -GPR_API int gpr_slice_cmp(gpr_slice a, gpr_slice b); -GPR_API int gpr_slice_str_cmp(gpr_slice a, const char *b); +GPRAPI int gpr_slice_cmp(gpr_slice a, gpr_slice b); +GPRAPI int gpr_slice_str_cmp(gpr_slice a, const char *b); #ifdef __cplusplus } diff --git a/include/grpc/impl/codegen/slice_buffer.h b/include/grpc/impl/codegen/slice_buffer.h index 8428c2f539b..4fe909ee82a 100644 --- a/include/grpc/impl/codegen/slice_buffer.h +++ b/include/grpc/impl/codegen/slice_buffer.h @@ -59,13 +59,13 @@ typedef struct { } gpr_slice_buffer; /* initialize a slice buffer */ -GPR_API void gpr_slice_buffer_init(gpr_slice_buffer *sb); +GPRAPI void gpr_slice_buffer_init(gpr_slice_buffer *sb); /* destroy a slice buffer - unrefs any held elements */ -GPR_API void gpr_slice_buffer_destroy(gpr_slice_buffer *sb); +GPRAPI void gpr_slice_buffer_destroy(gpr_slice_buffer *sb); /* Add an element to a slice buffer - takes ownership of the slice. This function is allowed to concatenate the passed in slice to the end of some other slice if desired by the slice buffer. */ -GPR_API void gpr_slice_buffer_add(gpr_slice_buffer *sb, gpr_slice slice); +GPRAPI void gpr_slice_buffer_add(gpr_slice_buffer *sb, gpr_slice slice); /* add an element to a slice buffer - takes ownership of the slice and returns the index of the slice. Guarantees that the slice will not be concatenated at the end of another @@ -73,30 +73,30 @@ GPR_API void gpr_slice_buffer_add(gpr_slice_buffer *sb, gpr_slice slice); slice at the returned index in sb->slices) The implementation MAY decide to concatenate data at the end of a small slice added in this fashion. */ -GPR_API size_t +GPRAPI size_t gpr_slice_buffer_add_indexed(gpr_slice_buffer *sb, gpr_slice slice); -GPR_API void gpr_slice_buffer_addn(gpr_slice_buffer *sb, gpr_slice *slices, - size_t n); +GPRAPI void gpr_slice_buffer_addn(gpr_slice_buffer *sb, gpr_slice *slices, + size_t n); /* add a very small (less than 8 bytes) amount of data to the end of a slice buffer: returns a pointer into which to add the data */ -GPR_API uint8_t *gpr_slice_buffer_tiny_add(gpr_slice_buffer *sb, size_t len); +GPRAPI uint8_t *gpr_slice_buffer_tiny_add(gpr_slice_buffer *sb, size_t len); /* pop the last buffer, but don't unref it */ -GPR_API void gpr_slice_buffer_pop(gpr_slice_buffer *sb); +GPRAPI void gpr_slice_buffer_pop(gpr_slice_buffer *sb); /* clear a slice buffer, unref all elements */ -GPR_API void gpr_slice_buffer_reset_and_unref(gpr_slice_buffer *sb); +GPRAPI void gpr_slice_buffer_reset_and_unref(gpr_slice_buffer *sb); /* swap the contents of two slice buffers */ -GPR_API void gpr_slice_buffer_swap(gpr_slice_buffer *a, gpr_slice_buffer *b); +GPRAPI void gpr_slice_buffer_swap(gpr_slice_buffer *a, gpr_slice_buffer *b); /* move all of the elements of src into dst */ -GPR_API void gpr_slice_buffer_move_into(gpr_slice_buffer *src, - gpr_slice_buffer *dst); +GPRAPI void gpr_slice_buffer_move_into(gpr_slice_buffer *src, + gpr_slice_buffer *dst); /* remove n bytes from the end of a slice buffer */ -GPR_API void gpr_slice_buffer_trim_end(gpr_slice_buffer *src, size_t n, - gpr_slice_buffer *garbage); +GPRAPI void gpr_slice_buffer_trim_end(gpr_slice_buffer *src, size_t n, + gpr_slice_buffer *garbage); /* move the first n bytes of src into dst */ -GPR_API void gpr_slice_buffer_move_first(gpr_slice_buffer *src, size_t n, - gpr_slice_buffer *dst); +GPRAPI void gpr_slice_buffer_move_first(gpr_slice_buffer *src, size_t n, + gpr_slice_buffer *dst); /* take the first slice in the slice buffer */ -GPR_API gpr_slice gpr_slice_buffer_take_first(gpr_slice_buffer *src); +GPRAPI gpr_slice gpr_slice_buffer_take_first(gpr_slice_buffer *src); #ifdef __cplusplus } diff --git a/include/grpc/impl/codegen/sync.h b/include/grpc/impl/codegen/sync.h index 04ff0dc5bf9..d2f19d37d66 100644 --- a/include/grpc/impl/codegen/sync.h +++ b/include/grpc/impl/codegen/sync.h @@ -78,26 +78,26 @@ extern "C" { gpr_mu are uninitialized when first declared. */ /* Initialize *mu. Requires: *mu uninitialized. */ -GPR_API void gpr_mu_init(gpr_mu *mu); +GPRAPI void gpr_mu_init(gpr_mu *mu); /* Cause *mu no longer to be initialized, freeing any memory in use. Requires: *mu initialized; no other concurrent operation on *mu. */ -GPR_API void gpr_mu_destroy(gpr_mu *mu); +GPRAPI void gpr_mu_destroy(gpr_mu *mu); /* Wait until no thread has a lock on *mu, cause the calling thread to own an exclusive lock on *mu, then return. May block indefinitely or crash if the calling thread has a lock on *mu. Requires: *mu initialized. */ -GPR_API void gpr_mu_lock(gpr_mu *mu); +GPRAPI void gpr_mu_lock(gpr_mu *mu); /* Release an exclusive lock on *mu held by the calling thread. Requires: *mu initialized; the calling thread holds an exclusive lock on *mu. */ -GPR_API void gpr_mu_unlock(gpr_mu *mu); +GPRAPI void gpr_mu_unlock(gpr_mu *mu); /* Without blocking, attempt to acquire an exclusive lock on *mu for the calling thread, then return non-zero iff success. Fail, if any thread holds the lock; succeeds with high probability if no thread holds the lock. Requires: *mu initialized. */ -GPR_API int gpr_mu_trylock(gpr_mu *mu); +GPRAPI int gpr_mu_trylock(gpr_mu *mu); /* --- Condition variable interface --- @@ -106,11 +106,11 @@ GPR_API int gpr_mu_trylock(gpr_mu *mu); uninitialized when first declared. */ /* Initialize *cv. Requires: *cv uninitialized. */ -GPR_API void gpr_cv_init(gpr_cv *cv); +GPRAPI void gpr_cv_init(gpr_cv *cv); /* Cause *cv no longer to be initialized, freeing any memory in use. Requires: *cv initialized; no other concurrent operation on *cv.*/ -GPR_API void gpr_cv_destroy(gpr_cv *cv); +GPRAPI void gpr_cv_destroy(gpr_cv *cv); /* Atomically release *mu and wait on *cv. When the calling thread is woken from *cv or the deadline abs_deadline is exceeded, execute gpr_mu_lock(mu) @@ -119,16 +119,16 @@ GPR_API void gpr_cv_destroy(gpr_cv *cv); an absolute deadline, or a GPR_TIMESPAN. May return even when not woken explicitly. Requires: *mu and *cv initialized; the calling thread holds an exclusive lock on *mu. */ -GPR_API int gpr_cv_wait(gpr_cv *cv, gpr_mu *mu, gpr_timespec abs_deadline); +GPRAPI int gpr_cv_wait(gpr_cv *cv, gpr_mu *mu, gpr_timespec abs_deadline); /* If any threads are waiting on *cv, wake at least one. Clients may treat this as an optimization of gpr_cv_broadcast() for use in the case where waking more than one waiter is not useful. Requires: *cv initialized. */ -GPR_API void gpr_cv_signal(gpr_cv *cv); +GPRAPI void gpr_cv_signal(gpr_cv *cv); /* Wake all threads waiting on *cv. Requires: *cv initialized. */ -GPR_API void gpr_cv_broadcast(gpr_cv *cv); +GPRAPI void gpr_cv_broadcast(gpr_cv *cv); /* --- One-time initialization --- @@ -141,7 +141,7 @@ GPR_API void gpr_cv_broadcast(gpr_cv *cv); If multiple threads call gpr_once() on the same gpr_once instance, one of them will call (*init_routine)(), and the others will block until that call finishes.*/ -GPR_API void gpr_once_init(gpr_once *once, void (*init_routine)(void)); +GPRAPI void gpr_once_init(gpr_once *once, void (*init_routine)(void)); /* --- One-time event notification --- @@ -151,43 +151,43 @@ GPR_API void gpr_once_init(gpr_once *once, void (*init_routine)(void)); It requires no destruction. */ /* Initialize *ev. */ -GPR_API void gpr_event_init(gpr_event *ev); +GPRAPI void gpr_event_init(gpr_event *ev); /* Set *ev so that gpr_event_get() and gpr_event_wait() will return value. Requires: *ev initialized; value != NULL; no prior or concurrent calls to gpr_event_set(ev, ...) since initialization. */ -GPR_API void gpr_event_set(gpr_event *ev, void *value); +GPRAPI void gpr_event_set(gpr_event *ev, void *value); /* Return the value set by gpr_event_set(ev, ...), or NULL if no such call has completed. If the result is non-NULL, all operations that occurred prior to the gpr_event_set(ev, ...) set will be visible after this call returns. Requires: *ev initialized. This operation is faster than acquiring a mutex on most platforms. */ -GPR_API void *gpr_event_get(gpr_event *ev); +GPRAPI void *gpr_event_get(gpr_event *ev); /* Wait until *ev is set by gpr_event_set(ev, ...), or abs_deadline is exceeded, then return gpr_event_get(ev). Requires: *ev initialized. Use abs_deadline==gpr_inf_future for no deadline. When the event has been signalled before the call, this operation is faster than acquiring a mutex on most platforms. */ -GPR_API void *gpr_event_wait(gpr_event *ev, gpr_timespec abs_deadline); +GPRAPI void *gpr_event_wait(gpr_event *ev, gpr_timespec abs_deadline); /* --- Reference counting --- These calls act on the type gpr_refcount. It requires no destruction. */ /* Initialize *r to value n. */ -GPR_API void gpr_ref_init(gpr_refcount *r, int n); +GPRAPI void gpr_ref_init(gpr_refcount *r, int n); /* Increment the reference count *r. Requires *r initialized. */ -GPR_API void gpr_ref(gpr_refcount *r); +GPRAPI void gpr_ref(gpr_refcount *r); /* Increment the reference count *r by n. Requires *r initialized, n > 0. */ -GPR_API void gpr_refn(gpr_refcount *r, int n); +GPRAPI void gpr_refn(gpr_refcount *r, int n); /* Decrement the reference count *r and return non-zero iff it has reached zero. . Requires *r initialized. */ -GPR_API int gpr_unref(gpr_refcount *r); +GPRAPI int gpr_unref(gpr_refcount *r); /* --- Stats counters --- @@ -198,13 +198,13 @@ GPR_API int gpr_unref(gpr_refcount *r); synchronize other events. */ /* Initialize *c to the value n. */ -GPR_API void gpr_stats_init(gpr_stats_counter *c, intptr_t n); +GPRAPI void gpr_stats_init(gpr_stats_counter *c, intptr_t n); /* *c += inc. Requires: *c initialized. */ -GPR_API void gpr_stats_inc(gpr_stats_counter *c, intptr_t inc); +GPRAPI void gpr_stats_inc(gpr_stats_counter *c, intptr_t inc); /* Return *c. Requires: *c initialized. */ -GPR_API intptr_t gpr_stats_read(const gpr_stats_counter *c); +GPRAPI intptr_t gpr_stats_read(const gpr_stats_counter *c); /* ==================Example use of interface=================== A producer-consumer queue of up to N integers, diff --git a/include/grpc/impl/codegen/time.h b/include/grpc/impl/codegen/time.h index 4ed1c3cbd86..c22bedfe77c 100644 --- a/include/grpc/impl/codegen/time.h +++ b/include/grpc/impl/codegen/time.h @@ -69,10 +69,10 @@ typedef struct gpr_timespec { } gpr_timespec; /* Time constants. */ -GPR_API gpr_timespec +GPRAPI gpr_timespec gpr_time_0(gpr_clock_type type); /* The zero time interval. */ -GPR_API gpr_timespec gpr_inf_future(gpr_clock_type type); /* The far future */ -GPR_API gpr_timespec gpr_inf_past(gpr_clock_type type); /* The far past. */ +GPRAPI gpr_timespec gpr_inf_future(gpr_clock_type type); /* The far future */ +GPRAPI gpr_timespec gpr_inf_past(gpr_clock_type type); /* The far past. */ #define GPR_MS_PER_SEC 1000 #define GPR_US_PER_SEC 1000000 @@ -82,48 +82,46 @@ GPR_API gpr_timespec gpr_inf_past(gpr_clock_type type); /* The far past. */ #define GPR_US_PER_MS 1000 /* initialize time subsystem */ -GPR_API void gpr_time_init(void); +GPRAPI void gpr_time_init(void); /* Return the current time measured from the given clocks epoch. */ -GPR_API gpr_timespec gpr_now(gpr_clock_type clock); +GPRAPI gpr_timespec gpr_now(gpr_clock_type clock); /* Convert a timespec from one clock to another */ -GPR_API gpr_timespec +GPRAPI 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. */ -GPR_API int gpr_time_cmp(gpr_timespec a, gpr_timespec b); +GPRAPI int gpr_time_cmp(gpr_timespec a, gpr_timespec b); -GPR_API gpr_timespec gpr_time_max(gpr_timespec a, gpr_timespec b); -GPR_API gpr_timespec gpr_time_min(gpr_timespec a, gpr_timespec b); +GPRAPI gpr_timespec gpr_time_max(gpr_timespec a, gpr_timespec b); +GPRAPI gpr_timespec gpr_time_min(gpr_timespec a, gpr_timespec b); /* Add and subtract times. Calculations saturate at infinities. */ -GPR_API gpr_timespec gpr_time_add(gpr_timespec a, gpr_timespec b); -GPR_API gpr_timespec gpr_time_sub(gpr_timespec a, gpr_timespec b); +GPRAPI gpr_timespec gpr_time_add(gpr_timespec a, gpr_timespec b); +GPRAPI gpr_timespec gpr_time_sub(gpr_timespec a, gpr_timespec b); /* Return a timespec representing a given number of time units. INT64_MIN is interpreted as gpr_inf_past, and INT64_MAX as gpr_inf_future. */ -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_hours(int64_t x, gpr_clock_type clock_type); +GPRAPI gpr_timespec gpr_time_from_micros(int64_t x, gpr_clock_type clock_type); +GPRAPI gpr_timespec gpr_time_from_nanos(int64_t x, gpr_clock_type clock_type); +GPRAPI gpr_timespec gpr_time_from_millis(int64_t x, gpr_clock_type clock_type); +GPRAPI gpr_timespec gpr_time_from_seconds(int64_t x, gpr_clock_type clock_type); +GPRAPI gpr_timespec gpr_time_from_minutes(int64_t x, gpr_clock_type clock_type); +GPRAPI 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); +GPRAPI int32_t gpr_time_to_millis(gpr_timespec timespec); /* Return 1 if two times are equal or within threshold of each other, 0 otherwise */ -GPR_API int gpr_time_similar(gpr_timespec a, gpr_timespec b, - gpr_timespec threshold); +GPRAPI int gpr_time_similar(gpr_timespec a, gpr_timespec b, + gpr_timespec threshold); /* Sleep until at least 'until' - an absolute timeout */ -GPR_API void gpr_sleep_until(gpr_timespec until); +GPRAPI void gpr_sleep_until(gpr_timespec until); -GPR_API double gpr_timespec_to_micros(gpr_timespec t); +GPRAPI double gpr_timespec_to_micros(gpr_timespec t); #ifdef __cplusplus } diff --git a/include/grpc/support/avl.h b/include/grpc/support/avl.h index 3433124c6fa..28eb5b175ea 100644 --- a/include/grpc/support/avl.h +++ b/include/grpc/support/avl.h @@ -69,23 +69,23 @@ typedef struct gpr_avl { } gpr_avl; /** create an immutable AVL tree */ -GPR_API gpr_avl gpr_avl_create(const gpr_avl_vtable *vtable); +GPRAPI gpr_avl gpr_avl_create(const gpr_avl_vtable *vtable); /** add a reference to an existing tree - returns the tree as a convenience */ -GPR_API gpr_avl gpr_avl_ref(gpr_avl avl); +GPRAPI gpr_avl gpr_avl_ref(gpr_avl avl); /** remove a reference to a tree - destroying it if there are no references left */ -GPR_API void gpr_avl_unref(gpr_avl avl); +GPRAPI void gpr_avl_unref(gpr_avl avl); /** return a new tree with (key, value) added to avl. implicitly unrefs avl to allow easy chaining. if key exists in avl, the new tree's key entry updated (i.e. a duplicate is not created) */ -GPR_API gpr_avl gpr_avl_add(gpr_avl avl, void *key, void *value); +GPRAPI gpr_avl gpr_avl_add(gpr_avl avl, void *key, void *value); /** return a new tree with key deleted */ -GPR_API gpr_avl gpr_avl_remove(gpr_avl avl, void *key); +GPRAPI gpr_avl gpr_avl_remove(gpr_avl avl, void *key); /** lookup key, and return the associated value. does not mutate avl. returns NULL if key is not found. */ -GPR_API void *gpr_avl_get(gpr_avl avl, void *key); +GPRAPI void *gpr_avl_get(gpr_avl avl, void *key); #endif diff --git a/include/grpc/support/cmdline.h b/include/grpc/support/cmdline.h index 6f442e3cf23..55e2ffdffe6 100644 --- a/include/grpc/support/cmdline.h +++ b/include/grpc/support/cmdline.h @@ -70,31 +70,31 @@ typedef struct gpr_cmdline gpr_cmdline; /* Construct a command line parser: takes a short description of the tool doing the parsing */ -GPR_API gpr_cmdline *gpr_cmdline_create(const char *description); +GPRAPI gpr_cmdline *gpr_cmdline_create(const char *description); /* Add an integer parameter, with a name (used on the command line) and some helpful text (used in the command usage) */ -GPR_API void gpr_cmdline_add_int(gpr_cmdline *cl, const char *name, - const char *help, int *value); +GPRAPI void gpr_cmdline_add_int(gpr_cmdline *cl, const char *name, + const char *help, int *value); /* The same, for a boolean flag */ -GPR_API void gpr_cmdline_add_flag(gpr_cmdline *cl, const char *name, - const char *help, int *value); +GPRAPI void gpr_cmdline_add_flag(gpr_cmdline *cl, const char *name, + const char *help, int *value); /* And for a string */ -GPR_API void gpr_cmdline_add_string(gpr_cmdline *cl, const char *name, - const char *help, char **value); +GPRAPI void gpr_cmdline_add_string(gpr_cmdline *cl, const char *name, + const char *help, char **value); /* Set a callback for non-named arguments */ -GPR_API void gpr_cmdline_on_extra_arg( +GPRAPI void gpr_cmdline_on_extra_arg( gpr_cmdline *cl, const char *name, const char *help, void (*on_extra_arg)(void *user_data, const char *arg), void *user_data); /* Enable surviving failure: default behavior is to exit the process */ -GPR_API void gpr_cmdline_set_survive_failure(gpr_cmdline *cl); +GPRAPI void gpr_cmdline_set_survive_failure(gpr_cmdline *cl); /* Parse the command line; returns 1 on success, on failure either dies (by default) or returns 0 if gpr_cmdline_set_survive_failure() has been called */ -GPR_API int gpr_cmdline_parse(gpr_cmdline *cl, int argc, char **argv); +GPRAPI int gpr_cmdline_parse(gpr_cmdline *cl, int argc, char **argv); /* Destroy the parser */ -GPR_API void gpr_cmdline_destroy(gpr_cmdline *cl); +GPRAPI void gpr_cmdline_destroy(gpr_cmdline *cl); /* Get a string describing usage */ -GPR_API char *gpr_cmdline_usage_string(gpr_cmdline *cl, const char *argv0); +GPRAPI char *gpr_cmdline_usage_string(gpr_cmdline *cl, const char *argv0); #ifdef __cplusplus } diff --git a/include/grpc/support/cpu.h b/include/grpc/support/cpu.h index db4bdd42aab..3ca83b5a0d6 100644 --- a/include/grpc/support/cpu.h +++ b/include/grpc/support/cpu.h @@ -44,13 +44,13 @@ extern "C" { /* Return the number of CPU cores on the current system. Will return 0 if the information is not available. */ -GPR_API unsigned gpr_cpu_num_cores(void); +GPRAPI unsigned gpr_cpu_num_cores(void); /* Return the CPU on which the current thread is executing; N.B. This should be considered advisory only - it is possible that the thread is switched to a different CPU at any time. Returns a value in range [0, gpr_cpu_num_cores() - 1] */ -GPR_API unsigned gpr_cpu_current_cpu(void); +GPRAPI unsigned gpr_cpu_current_cpu(void); #ifdef __cplusplus } // extern "C" diff --git a/include/grpc/support/histogram.h b/include/grpc/support/histogram.h index 9c807ea27db..c34c8c84071 100644 --- a/include/grpc/support/histogram.h +++ b/include/grpc/support/histogram.h @@ -43,34 +43,34 @@ extern "C" { typedef struct gpr_histogram gpr_histogram; -GPR_API gpr_histogram *gpr_histogram_create(double resolution, - double max_bucket_start); -GPR_API void gpr_histogram_destroy(gpr_histogram *h); -GPR_API void gpr_histogram_add(gpr_histogram *h, double x); +GPRAPI gpr_histogram *gpr_histogram_create(double resolution, + double max_bucket_start); +GPRAPI void gpr_histogram_destroy(gpr_histogram *h); +GPRAPI void gpr_histogram_add(gpr_histogram *h, double x); /* The following merges the second histogram into the first. It only works if they have the same buckets and resolution. Returns 0 on failure, 1 on success */ -GPR_API int gpr_histogram_merge(gpr_histogram *dst, const gpr_histogram *src); +GPRAPI int gpr_histogram_merge(gpr_histogram *dst, const gpr_histogram *src); -GPR_API double gpr_histogram_percentile(gpr_histogram *histogram, - double percentile); -GPR_API double gpr_histogram_mean(gpr_histogram *histogram); -GPR_API double gpr_histogram_stddev(gpr_histogram *histogram); -GPR_API double gpr_histogram_variance(gpr_histogram *histogram); -GPR_API double gpr_histogram_maximum(gpr_histogram *histogram); -GPR_API double gpr_histogram_minimum(gpr_histogram *histogram); -GPR_API double gpr_histogram_count(gpr_histogram *histogram); -GPR_API double gpr_histogram_sum(gpr_histogram *histogram); -GPR_API double gpr_histogram_sum_of_squares(gpr_histogram *histogram); +GPRAPI double gpr_histogram_percentile(gpr_histogram *histogram, + double percentile); +GPRAPI double gpr_histogram_mean(gpr_histogram *histogram); +GPRAPI double gpr_histogram_stddev(gpr_histogram *histogram); +GPRAPI double gpr_histogram_variance(gpr_histogram *histogram); +GPRAPI double gpr_histogram_maximum(gpr_histogram *histogram); +GPRAPI double gpr_histogram_minimum(gpr_histogram *histogram); +GPRAPI double gpr_histogram_count(gpr_histogram *histogram); +GPRAPI double gpr_histogram_sum(gpr_histogram *histogram); +GPRAPI double gpr_histogram_sum_of_squares(gpr_histogram *histogram); -GPR_API const uint32_t *gpr_histogram_get_contents(gpr_histogram *histogram, - size_t *count); -GPR_API void gpr_histogram_merge_contents(gpr_histogram *histogram, - const uint32_t *data, - size_t data_count, double min_seen, - double max_seen, double sum, - double sum_of_squares, double count); +GPRAPI const uint32_t *gpr_histogram_get_contents(gpr_histogram *histogram, + size_t *count); +GPRAPI void gpr_histogram_merge_contents(gpr_histogram *histogram, + const uint32_t *data, + size_t data_count, double min_seen, + double max_seen, double sum, + double sum_of_squares, double count); #ifdef __cplusplus } diff --git a/include/grpc/support/host_port.h b/include/grpc/support/host_port.h index ee9c294ebcd..53cc917acb4 100644 --- a/include/grpc/support/host_port.h +++ b/include/grpc/support/host_port.h @@ -50,14 +50,14 @@ extern "C" { destroyed using gpr_free(). In the unlikely event of an error, returns -1 and sets *out to NULL. */ -GPR_API int gpr_join_host_port(char **out, const char *host, int port); +GPRAPI int gpr_join_host_port(char **out, const char *host, int port); /* Given a name in the form "host:port" or "[ho:st]:port", split into hostname and port number, into newly allocated strings, which must later be destroyed using gpr_free(). Return 1 on success, 0 on failure. Guarantees *host and *port == NULL on failure. */ -GPR_API int gpr_split_host_port(const char *name, char **host, char **port); +GPRAPI int gpr_split_host_port(const char *name, char **host, char **port); #ifdef __cplusplus } diff --git a/include/grpc/support/log_win32.h b/include/grpc/support/log_win32.h index 1470e5b4840..49c9ab0f914 100644 --- a/include/grpc/support/log_win32.h +++ b/include/grpc/support/log_win32.h @@ -42,7 +42,7 @@ extern "C" { * formatted error message, corresponding to the error messageid. * Use in conjunction with GetLastError() et al. */ -GPR_API char *gpr_format_message(int messageid); +GPRAPI char *gpr_format_message(int messageid); #ifdef __cplusplus } diff --git a/include/grpc/support/string_util.h b/include/grpc/support/string_util.h index 74f2cb371a2..6fc38cb191f 100644 --- a/include/grpc/support/string_util.h +++ b/include/grpc/support/string_util.h @@ -42,7 +42,7 @@ extern "C" { /* Returns a copy of src that can be passed to gpr_free(). If allocation fails or if src is NULL, returns NULL. */ -GPR_API char *gpr_strdup(const char *src); +GPRAPI char *gpr_strdup(const char *src); /* printf to a newly-allocated string. The set of supported formats may vary between platforms. @@ -52,7 +52,7 @@ GPR_API char *gpr_strdup(const char *src); On error, returns -1 and sets *strp to NULL. If the format string is bad, the result is undefined. */ -GPR_API int gpr_asprintf(char **strp, const char *format, ...); +GPRAPI int gpr_asprintf(char **strp, const char *format, ...); #ifdef __cplusplus } diff --git a/include/grpc/support/subprocess.h b/include/grpc/support/subprocess.h index ffbdf673577..6a4946014be 100644 --- a/include/grpc/support/subprocess.h +++ b/include/grpc/support/subprocess.h @@ -43,14 +43,14 @@ extern "C" { typedef struct gpr_subprocess gpr_subprocess; /* .exe on windows, empty on unices */ -GPR_API const char *gpr_subprocess_binary_extension(); +GPRAPI const char *gpr_subprocess_binary_extension(); -GPR_API gpr_subprocess *gpr_subprocess_create(int argc, const char **argv); +GPRAPI gpr_subprocess *gpr_subprocess_create(int argc, const char **argv); /* if subprocess has not been joined, kill it */ -GPR_API void gpr_subprocess_destroy(gpr_subprocess *p); +GPRAPI void gpr_subprocess_destroy(gpr_subprocess *p); /* returns exit status; can be called at most once */ -GPR_API int gpr_subprocess_join(gpr_subprocess *p); -GPR_API void gpr_subprocess_interrupt(gpr_subprocess *p); +GPRAPI int gpr_subprocess_join(gpr_subprocess *p); +GPRAPI void gpr_subprocess_interrupt(gpr_subprocess *p); #ifdef __cplusplus } // extern "C" diff --git a/include/grpc/support/thd.h b/include/grpc/support/thd.h index 84e964fc07b..abe57ebefb8 100644 --- a/include/grpc/support/thd.h +++ b/include/grpc/support/thd.h @@ -59,30 +59,30 @@ typedef struct { in *t, and return true. If there are insufficient resources, return false. If options==NULL, default options are used. The thread is immediately runnable, and exits when (*thd_body)() returns. */ -GPR_API int gpr_thd_new(gpr_thd_id *t, void (*thd_body)(void *arg), void *arg, - const gpr_thd_options *options); +GPRAPI int gpr_thd_new(gpr_thd_id *t, void (*thd_body)(void *arg), void *arg, + const gpr_thd_options *options); /* Return a gpr_thd_options struct with all fields set to defaults. */ -GPR_API gpr_thd_options gpr_thd_options_default(void); +GPRAPI gpr_thd_options gpr_thd_options_default(void); /* Set the thread to become detached on startup - this is the default. */ -GPR_API void gpr_thd_options_set_detached(gpr_thd_options *options); +GPRAPI void gpr_thd_options_set_detached(gpr_thd_options *options); /* Set the thread to become joinable - mutually exclusive with detached. */ -GPR_API void gpr_thd_options_set_joinable(gpr_thd_options *options); +GPRAPI void gpr_thd_options_set_joinable(gpr_thd_options *options); /* Returns non-zero if the option detached is set. */ -GPR_API int gpr_thd_options_is_detached(const gpr_thd_options *options); +GPRAPI int gpr_thd_options_is_detached(const gpr_thd_options *options); /* Returns non-zero if the option joinable is set. */ -GPR_API int gpr_thd_options_is_joinable(const gpr_thd_options *options); +GPRAPI int gpr_thd_options_is_joinable(const gpr_thd_options *options); /* Returns the identifier of the current thread. */ -GPR_API gpr_thd_id gpr_thd_currentid(void); +GPRAPI gpr_thd_id gpr_thd_currentid(void); /* Blocks until the specified thread properly terminates. Calling this on a detached thread has unpredictable results. */ -GPR_API void gpr_thd_join(gpr_thd_id t); +GPRAPI void gpr_thd_join(gpr_thd_id t); #ifdef __cplusplus } diff --git a/test/cpp/end2end/thread_stress_test.cc b/test/cpp/end2end/thread_stress_test.cc index dd7a8e5ed2c..e246c0b0e2f 100644 --- a/test/cpp/end2end/thread_stress_test.cc +++ b/test/cpp/end2end/thread_stress_test.cc @@ -55,10 +55,10 @@ using grpc::testing::EchoRequest; using grpc::testing::EchoResponse; using std::chrono::system_clock; -const int kNumThreads = 100; // Number of threads +const int kNumThreads = 100; // Number of threads const int kNumAsyncSendThreads = 2; const int kNumAsyncReceiveThreads = 50; -const int kNumRpcs = 1000; // Number of RPCs per thread +const int kNumRpcs = 1000; // Number of RPCs per thread namespace grpc { namespace testing { diff --git a/tools/buildgen/plugins/list_api.py b/tools/buildgen/plugins/list_api.py index 3396dcd39ba..ff937a0ab83 100755 --- a/tools/buildgen/plugins/list_api.py +++ b/tools/buildgen/plugins/list_api.py @@ -37,7 +37,7 @@ import sys import yaml -_RE_API = r'(?:GPR_API|GRPC_API|CENSUS_API)([^;]*);' +_RE_API = r'(?:GPRAPI|GRPCAPI|CENSUSAPI)([^;]*);' def list_c_apis(filenames):