From: Julius Bünger Date: Fri, 8 Apr 2016 18:27:48 +0000 (+0000) Subject: -rps: add parentheses in macros X-Git-Tag: initial-import-from-subversion-38251~966 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=3329003cb2aa8105a885a00867159effd23208b4;p=oweals%2Fgnunet.git -rps: add parentheses in macros --- 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));