Commits

Shlomi Fish committed 1b5621b

More declarations after statements.

https://rt.cpan.org/Ticket/Display.html?id=69622 .

  • Participants
  • Parent commits f289bee

Comments (0)

Files changed (3)

 Revision history for Perl extension XML::LibXML
 
+    - Fixed missing declarations after statements:
+        - resolves https://rt.cpan.org/Ticket/Display.html?id=69622 again.
+        - thanks to Vadim / VKON.
+
 1.82            Wed Jul 20 23:43:53 IDT 2011
     - Moved some if blocks after the dSP; (which contains declarations) to be
     compliant with C89/C90, which don't allow declarations in the middle of
 =cut
 ----------------
 
-Perl
+No declarations after statements
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+One should make sure there are no declarations after statements in the ANSI
+C code. If you're using gcc, you can make sure this is the case by adding
+the flags "-Wdeclaration-after-statement -Werror" to "CCFLAGS" in the makefile.

File perl-libxml-sax.c

     SV * rv = NULL;
 
     if ( ch != NULL && handler != NULL ) {
+        dSP;
+
         int len = xmlStrlen( ch );
 
         if (sax->joinchars)
             PSaxCharactersFlush(ctxt, sax->charbuf);
         }
 
-        dSP;
-
         ENTER;
         SAVETMPS;
 
     SV * rv = NULL;
 
     if ( ch != NULL && handler != NULL ) {
+        dSP;
 
         if (sax->joinchars)
         {
             PSaxCharactersFlush(ctxt, sax->charbuf);
         }
 
-        dSP;
 
         ENTER;
         SAVETMPS;
     SV * rv = NULL;
 
     if ( handler != NULL ) {
+        dSP;
+
         if (sax->joinchars)
         {
             PSaxCharactersFlush(ctxt, sax->charbuf);
         }
-
-        dSP;
     
         ENTER;
         SAVETMPS;