You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
perl-Sereal-Encoder/Sereal-3.007-Add-missing-pa...

42 lines
1.7 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

From 38b829d8845fc795d9404cd0e24b21c5b06f0a6e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Fri, 27 Nov 2015 11:17:25 +0100
Subject: [PATCH] Add missing parentheses to SRL_ENC_HAVE_OPTION arguments
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
GCC warns about missing parentheses:
In file included from srl_encoder.c:50:0:
srl_encoder.c: In function srl_dump_hv:
srl_encoder.h:141:58: warning: suggest parentheses around arithmetic in operand of | [-Wparentheses]
#define SRL_ENC_HAVE_OPTION(enc, flag_num) ((enc)->flags & flag_num)
^
srl_encoder.c:1431:18: note: in expansion of macro SRL_ENC_HAVE_OPTION
if ( SRL_ENC_HAVE_OPTION(enc, SRL_F_SORT_KEYS|SRL_F_SORT_KEYS_PERL) ) {
And indeed this is a bug.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
Perl/Encoder/srl_encoder.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Perl/Encoder/srl_encoder.h b/Perl/Encoder/srl_encoder.h
index 12ca951..639f220 100644
--- a/Perl/Encoder/srl_encoder.h
+++ b/Perl/Encoder/srl_encoder.h
@@ -140,7 +140,7 @@ SV *srl_dump_data_structure_mortal_sv(pTHX_ srl_encoder_t *enc, SV *src, SV *use
/* Set while the encoder is in active use / dirty */
#define SRL_OF_ENCODER_DIRTY 1UL
-#define SRL_ENC_HAVE_OPTION(enc, flag_num) ((enc)->flags & flag_num)
+#define SRL_ENC_HAVE_OPTION(enc, flag_num) ((enc)->flags & (flag_num))
#define SRL_ENC_SET_OPTION(enc, flag_num) STMT_START {(enc)->flags |= (flag_num);}STMT_END
#define SRL_ENC_RESET_OPTION(enc, flag_num) STMT_START {(enc)->flags &= ~(flag_num);}STMT_END
--
2.4.3