mirror of
https://github.com/libevent/libevent.git
synced 2025-01-09 00:56:20 +08:00
Parenthesize macro arguments more aggressively
This commit is contained in:
parent
f32b57505e
commit
07e9e9b4b1
@ -104,7 +104,7 @@ unsigned char *evbuffer_find(struct evbuffer *buffer, const unsigned char *what,
|
||||
/** deprecated in favor of calling the functions directly */
|
||||
#define EVBUFFER_LENGTH(x) evbuffer_get_length(x)
|
||||
/** deprecated in favor of calling the functions directly */
|
||||
#define EVBUFFER_DATA(x) evbuffer_pullup(x, -1)
|
||||
#define EVBUFFER_DATA(x) evbuffer_pullup((x), -1)
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -367,8 +367,9 @@ int event_base_got_break(struct event_base *);
|
||||
@param cb callback function
|
||||
@param arg argument that will be passed to the callback function
|
||||
*/
|
||||
#define evtimer_assign(ev, b, cb, arg) event_assign(ev, b, -1, 0, cb, arg)
|
||||
#define evtimer_new(b, cb, arg) event_new(b, -1, 0, cb, arg)
|
||||
#define evtimer_assign(ev, b, cb, arg) \
|
||||
event_assign((ev), (b), -1, 0, (cb), (arg))
|
||||
#define evtimer_new(b, cb, arg) event_new((b), -1, 0, (cb), (arg))
|
||||
|
||||
/**
|
||||
Add a timer event.
|
||||
@ -376,7 +377,7 @@ int event_base_got_break(struct event_base *);
|
||||
@param ev the event struct
|
||||
@param tv timeval struct
|
||||
*/
|
||||
#define evtimer_add(ev, tv) event_add(ev, tv)
|
||||
#define evtimer_add(ev, tv) event_add((ev), (tv))
|
||||
|
||||
/**
|
||||
* Delete a timer event.
|
||||
@ -384,16 +385,16 @@ int event_base_got_break(struct event_base *);
|
||||
* @param ev the event struct to be disabled
|
||||
*/
|
||||
#define evtimer_del(ev) event_del(ev)
|
||||
#define evtimer_pending(ev, tv) event_pending(ev, EV_TIMEOUT, tv)
|
||||
#define evtimer_pending(ev, tv) event_pending((ev), EV_TIMEOUT, (tv))
|
||||
#define evtimer_initialized(ev) _event_initialized((ev), 0)
|
||||
|
||||
#define evsignal_add(ev, tv) event_add(ev, tv)
|
||||
#define evsignal_add(ev, tv) event_add((ev), (tv))
|
||||
#define evsignal_assign(ev, b, x, cb, arg) \
|
||||
event_assign(ev, b, x, EV_SIGNAL|EV_PERSIST, cb, arg)
|
||||
event_assign((ev), (b), (x), EV_SIGNAL|EV_PERSIST, cb, (arg))
|
||||
#define evsignal_new(b, x, cb, arg) \
|
||||
event_new(b, x, EV_SIGNAL|EV_PERSIST, cb, arg)
|
||||
event_new((b), (x), EV_SIGNAL|EV_PERSIST, (cb), (arg))
|
||||
#define evsignal_del(ev) event_del(ev)
|
||||
#define evsignal_pending(ev, tv) event_pending(ev, EV_SIGNAL, tv)
|
||||
#define evsignal_pending(ev, tv) event_pending((ev), EV_SIGNAL, (tv))
|
||||
#define evsignal_initialized(ev) _event_initialized((ev), 0)
|
||||
|
||||
/**
|
||||
|
@ -240,9 +240,9 @@ int event_priority_init(int);
|
||||
*/
|
||||
void event_set(struct event *, evutil_socket_t, short, void (*)(evutil_socket_t, short, void *), void *);
|
||||
|
||||
#define evtimer_set(ev, cb, arg) event_set(ev, -1, 0, cb, arg)
|
||||
#define evtimer_set(ev, cb, arg) event_set((ev), -1, 0, (cb), (arg))
|
||||
#define evsignal_set(ev, x, cb, arg) \
|
||||
event_set(ev, x, EV_SIGNAL|EV_PERSIST, cb, arg)
|
||||
event_set((ev), (x), EV_SIGNAL|EV_PERSIST, (cb), (arg))
|
||||
|
||||
|
||||
/**
|
||||
@ -254,7 +254,7 @@ void event_set(struct event *, evutil_socket_t, short, void (*)(evutil_socket_t,
|
||||
* @deprecated This macro is deprecated because its naming is inconsistent.
|
||||
* The recommend macro is evtimer_add().
|
||||
*/
|
||||
#define timeout_add(ev, tv) event_add(ev, tv)
|
||||
#define timeout_add(ev, tv) event_add((ev), (tv))
|
||||
|
||||
|
||||
/**
|
||||
@ -267,7 +267,7 @@ void event_set(struct event *, evutil_socket_t, short, void (*)(evutil_socket_t,
|
||||
* @deprecated This macro is deprecated because its naming is inconsistent.
|
||||
* The recommend macro is evtimer_set().
|
||||
*/
|
||||
#define timeout_set(ev, cb, arg) event_set(ev, -1, 0, cb, arg)
|
||||
#define timeout_set(ev, cb, arg) event_set((ev), -1, 0, (cb), (arg))
|
||||
|
||||
/**
|
||||
* Disable a timeout event.
|
||||
@ -283,7 +283,7 @@ void event_set(struct event *, evutil_socket_t, short, void (*)(evutil_socket_t,
|
||||
@deprecated This macro is deprecated because its naming is inconsistent.
|
||||
The recommend macro is evtimer_pending().
|
||||
*/
|
||||
#define timeout_pending(ev, tv) event_pending(ev, EV_TIMEOUT, tv)
|
||||
#define timeout_pending(ev, tv) event_pending((ev), EV_TIMEOUT, (tv))
|
||||
/**
|
||||
@deprecated This macro is deprecated because its naming is inconsistent.
|
||||
The recommend macro is evtimer_initialized().
|
||||
@ -294,25 +294,25 @@ void event_set(struct event *, evutil_socket_t, short, void (*)(evutil_socket_t,
|
||||
@deprecated This macro is deprecated because its naming is inconsistent.
|
||||
The recommend macro is evsignal_add().
|
||||
*/
|
||||
#define signal_add(ev, tv) event_add(ev, tv)
|
||||
#define signal_add(ev, tv) event_add((ev), (tv))
|
||||
/**
|
||||
@deprecated This macro is deprecated because its naming is inconsistent.
|
||||
The recommend macro is evsignal_set().
|
||||
*/
|
||||
#define signal_set(ev, x, cb, arg) \
|
||||
event_set(ev, x, EV_SIGNAL|EV_PERSIST, cb, arg)
|
||||
event_set((ev), (x), EV_SIGNAL|EV_PERSIST, (cb), (arg))
|
||||
/**
|
||||
@deprecated This macro is deprecated because its naming is inconsistent.
|
||||
The recommend macro is evsignal_assign().
|
||||
*/
|
||||
#define signal_assign(ev, b, x, cb, arg) \
|
||||
event_assign(ev, b, x, EV_SIGNAL|EV_PERSIST, cb, arg)
|
||||
event_assign((ev), (b), (x), EV_SIGNAL|EV_PERSIST, (cb), (arg))
|
||||
/**
|
||||
@deprecated This macro is deprecated because its naming is inconsistent.
|
||||
The recommend macro is evsignal_new().
|
||||
*/
|
||||
#define signal_new(b, x, cb, arg) \
|
||||
event_new(b, x, EV_SIGNAL|EV_PERSIST, cb, arg)
|
||||
event_new((b), (x), EV_SIGNAL|EV_PERSIST, (cb), (arg))
|
||||
/**
|
||||
@deprecated This macro is deprecated because its naming is inconsistent.
|
||||
The recommend macro is evsignal_del().
|
||||
@ -322,7 +322,7 @@ void event_set(struct event *, evutil_socket_t, short, void (*)(evutil_socket_t,
|
||||
@deprecated This macro is deprecated because its naming is inconsistent.
|
||||
The recommend macro is evsignal_pending().
|
||||
*/
|
||||
#define signal_pending(ev, tv) event_pending(ev, EV_SIGNAL, tv)
|
||||
#define signal_pending(ev, tv) event_pending((ev), EV_SIGNAL, (tv))
|
||||
/**
|
||||
@deprecated This macro is deprecated because its naming is inconsistent.
|
||||
The recommend macro is evsignal_initialized().
|
||||
|
@ -86,7 +86,7 @@ extern "C" {
|
||||
@param value the value to assign
|
||||
*/
|
||||
#define EVTAG_ASSIGN(msg, member, value) \
|
||||
(*(msg)->base->member##_assign)(msg, value)
|
||||
(*(msg)->base->member##_assign)((msg), (value))
|
||||
/**
|
||||
Assigns a value to the member in the message.
|
||||
|
||||
@ -96,7 +96,7 @@ extern "C" {
|
||||
@param len the length of the value
|
||||
*/
|
||||
#define EVTAG_ASSIGN_WITH_LEN(msg, member, value, len) \
|
||||
(*(msg)->base->member##_assign)(msg, value, len)
|
||||
(*(msg)->base->member##_assign)((msg), (value), (len))
|
||||
/**
|
||||
Returns the value for a member.
|
||||
|
||||
@ -106,7 +106,7 @@ extern "C" {
|
||||
@return 0 on success, -1 otherwise.
|
||||
*/
|
||||
#define EVTAG_GET(msg, member, pvalue) \
|
||||
(*(msg)->base->member##_get)(msg, pvalue)
|
||||
(*(msg)->base->member##_get)((msg), (pvalue))
|
||||
/**
|
||||
Returns the value for a member.
|
||||
|
||||
@ -117,7 +117,7 @@ extern "C" {
|
||||
@return 0 on success, -1 otherwise.
|
||||
*/
|
||||
#define EVTAG_GET_WITH_LEN(msg, member, pvalue, plen) \
|
||||
(*(msg)->base->member##_get)(msg, pvalue, plen)
|
||||
(*(msg)->base->member##_get)((msg), (pvalue), (plen))
|
||||
|
||||
#endif /* _EVENT2_RPC_COMPAT_H_ */
|
||||
|
||||
@ -125,7 +125,7 @@ extern "C" {
|
||||
Adds a value to an array.
|
||||
*/
|
||||
#define EVTAG_ARRAY_ADD_VALUE(msg, member, value) \
|
||||
(*(msg)->base->member##_add)(msg, value)
|
||||
(*(msg)->base->member##_add)((msg), (value))
|
||||
/**
|
||||
Allocates a new entry in the array and returns it.
|
||||
*/
|
||||
@ -135,7 +135,7 @@ extern "C" {
|
||||
Gets a variable at the specified offset from the array.
|
||||
*/
|
||||
#define EVTAG_ARRAY_GET(msg, member, offset, pvalue) \
|
||||
(*(msg)->base->member##_get)(msg, offset, pvalue)
|
||||
(*(msg)->base->member##_get)((msg), (offset), (pvalue))
|
||||
/**
|
||||
Returns the number of entries in the array.
|
||||
*/
|
||||
@ -342,7 +342,7 @@ int evrpc_register_rpc(struct evrpc_base *, struct evrpc *,
|
||||
* @return -1 on error or 0 when successful.
|
||||
* @see EVRPC_REGISTER()
|
||||
*/
|
||||
#define EVRPC_UNREGISTER(base, name) evrpc_unregister_rpc(base, #name)
|
||||
#define EVRPC_UNREGISTER(base, name) evrpc_unregister_rpc((base), #name)
|
||||
|
||||
int evrpc_unregister_rpc(struct evrpc_base *base, const char *name);
|
||||
|
||||
@ -369,7 +369,7 @@ struct evrpc_status;
|
||||
* @return 0 on success, -1 on failure
|
||||
*/
|
||||
#define EVRPC_MAKE_REQUEST(name, pool, request, reply, cb, cbarg) \
|
||||
evrpc_send_request_##name(pool, request, reply, cb, cbarg)
|
||||
evrpc_send_request_##name((pool), (request), (reply), (cb), (cbarg))
|
||||
|
||||
/**
|
||||
Makes an RPC request based on the provided context.
|
||||
|
Loading…
x
Reference in New Issue
Block a user