You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by si...@apache.org on 2007/07/04 22:04:24 UTC

svn commit: r553317 - /spamassassin/branches/3.2/sa-compile.raw

Author: sidney
Date: Wed Jul  4 13:04:23 2007
New Revision: 553317

URL: http://svn.apache.org/viewvc?view=rev&rev=553317
Log:
bug5534: fix compile warning in sa-compile

Modified:
    spamassassin/branches/3.2/sa-compile.raw

Modified: spamassassin/branches/3.2/sa-compile.raw
URL: http://svn.apache.org/viewvc/spamassassin/branches/3.2/sa-compile.raw?view=diff&rev=553317&r1=553316&r2=553317
==============================================================================
--- spamassassin/branches/3.2/sa-compile.raw (original)
+++ spamassassin/branches/3.2/sa-compile.raw Wed Jul  4 13:04:23 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: