From 3329003cb2aa8105a885a00867159effd23208b4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Julius=20B=C3=BCnger?= Date: Fri, 8 Apr 2016 18:27:48 +0000 Subject: [PATCH] -rps: add parentheses in macros --- src/rps/gnunet-service-rps_peers.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/rps/gnunet-service-rps_peers.c b/src/rps/gnunet-service-rps_peers.c index c5a19d978..a6d2c7eab 100644 --- a/src/rps/gnunet-service-rps_peers.c +++ b/src/rps/gnunet-service-rps_peers.c @@ -38,32 +38,34 @@ /** * Set a peer flag of given peer context. */ -#define set_peer_flag(peer_ctx, mask) (peer_ctx->peer_flags |= mask) +#define set_peer_flag(peer_ctx, mask) ((peer_ctx->peer_flags) |= (mask)) /** * Get peer flag of given peer context. */ -#define check_peer_flag_set(peer_ctx, mask) (peer_ctx->peer_flags & mask ? GNUNET_YES : GNUNET_NO) +#define check_peer_flag_set(peer_ctx, mask)\ + ((peer_ctx->peer_flags) & (mask) ? GNUNET_YES : GNUNET_NO) /** * Unset flag of given peer context. */ -#define unset_peer_flag(peer_ctx, mask) (peer_ctx->peer_flags &= (~mask)) +#define unset_peer_flag(peer_ctx, mask) ((peer_ctx->peer_flags) &= ~(mask)) /** * Set a channel flag of given channel context. */ -#define set_channel_flag(channel_flags, mask) ((*channel_flags) |= mask) +#define set_channel_flag(channel_flags, mask) ((*channel_flags) |= (mask)) /** * Get channel flag of given channel context. */ -#define check_channel_flag_set(channel_flags, mask) ((*channel_flags) & mask ? GNUNET_YES : GNUNET_NO) +#define check_channel_flag_set(channel_flags, mask)\ + ((*channel_flags) & (mask) ? GNUNET_YES : GNUNET_NO) /** * Unset flag of given channel context. */ -#define unset_channel_flag(channel_flags, mask) ((*channel_flags) &= (~mask)) +#define unset_channel_flag(channel_flags, mask) ((*channel_flags) &= ~(mask)) @@ -304,7 +306,7 @@ set_peer_live (struct PeerContext *peer_ctx) peer = &peer_ctx->peer_id; set_peer_flag (peer_ctx, Peers_VALID); - // TODO LIVE/ONLINE + set_peer_flag (peer_ctx, Peers_ONLINE); LOG (GNUNET_ERROR_TYPE_DEBUG, "Peer %s is live and valid\n", GNUNET_i2s (peer)); -- 2.25.1