You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jm...@apache.org on 2007/06/22 14:55:08 UTC

svn commit: r549808 - /spamassassin/trunk/sa-compile.raw

Author: jm
Date: Fri Jun 22 05:55:08 2007
New Revision: 549808

URL: http://svn.apache.org/viewvc?view=rev&rev=549808
Log:
bug 5534: fix annoying 'ISO C90 forbids mixed declarations and code' warnings from sa-compile, caused by extern declarations inside functions

Modified:
    spamassassin/trunk/sa-compile.raw

Modified: spamassassin/trunk/sa-compile.raw
URL: http://svn.apache.org/viewvc/spamassassin/trunk/sa-compile.raw?view=diff&rev=549808&r1=549807&r2=549808
==============================================================================
--- spamassassin/trunk/sa-compile.raw (original)
+++ spamassassin/trunk/sa-compile.raw Fri Jun 22 05:55:08 2007
@@ -460,6 +460,12 @@
 	      newSVpvn_share(wordstart, cp-wordstart, (U32)0));
   }
 
+EOT
+
+  # use a buffer string here instead of writing direct to the file,
+  # so we can prepend 'extern' statements (bug 5534)
+  my $xscode = <<"EOT";
+
 MODULE = $modname  PACKAGE = $modname
 
 PROTOTYPES: DISABLE
@@ -481,24 +487,34 @@
 	pstart = (unsigned char *) SvPVutf8(psv, plen);
 	pend = pstart + plen;
 	results = (AV *) sv_2mortal((SV *) newAV());
+
 EOT
 
   for (1..$numscans) {
     my $funcname = $cprefix."_scan".$_;
 
-    print $re <<EOT;
+    $xscode =
+        # prepend this chunk
+        qq{
+
 	  extern char *${funcname} (unsigned char **);
 
+        }.$xscode.
+        # and append this one
+        qq{
+
 	  cursor = pstart;
 	  while (cursor < pend) {
 	    while (match = ${funcname} (\&cursor)) {
 	      split_and_add(results, match);
 	    }
 	  }
-EOT
+
+        };
 
   }
 
+  print $re $xscode;
   print $re <<EOT;
 	  RETVAL = newRV((SV *) results);
       OUTPUT: