This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Use sizeof instead of hard-coded array size
authorKarl Williamson <khw@khw-desktop.(none)>
Thu, 14 Jan 2010 23:02:14 +0000 (16:02 -0700)
committerCraig A. Berry <craigberry@mac.com>
Sat, 29 May 2010 15:40:17 +0000 (10:40 -0500)
The array should be declared with its actual size.

universal.c

index 27783ac..dec8505 100644 (file)
@@ -1175,7 +1175,7 @@ XS(XS_re_regexp_pattern)
         /* Houston, we have a regex! */
         SV *pattern;
         STRLEN left = 0;
-        char reflags[6];
+        char reflags[sizeof(INT_PAT_MODS)];
 
         if ( GIMME_V == G_ARRAY ) {
             /*