]> git.vpit.fr Git - perl/modules/Thread-Cleanup.git/blobdiff - Cleanup.xs
Remove trailing whitespace
[perl/modules/Thread-Cleanup.git] / Cleanup.xs
index 83ec8b461ef9a892d6808fbfd8dacb7e96d280dc..e88916c2c52be88447a381a336270125ec0e5668 100644 (file)
@@ -1,43 +1,33 @@
 /* This file is part of the Thread::Cleanup Perl module.
  * See http://search.cpan.org/dist/Thread-Cleanup/ */
-   
+
 #define PERL_NO_GET_CONTEXT
 #include "EXTERN.h"
-#include "perl.h" 
+#include "perl.h"
 #include "XSUB.h"
 
 #define __PACKAGE__     "Thread::Cleanup"
 #define __PACKAGE_LEN__ (sizeof(__PACKAGE__)-1)
 
-STATIC void tc_callback(pTHX_ void *);
-
-STATIC void tc_callback(pTHX_ void *ud) {
- int *level = ud;
- SV *id;
+#define TC_HAS_PERL(R, V, S) (PERL_REVISION > (R) || (PERL_REVISION == (R) && (PERL_VERSION > (V) || (PERL_VERSION == (V) && (PERL_SUBVERSION >= (S))))))
 
- if (*level) {
-  *level = 0;
-  LEAVE;
-  SAVEDESTRUCTOR_X(tc_callback, level);
-  ENTER;
- } else {
-  dSP;
+#include "reap.h"
 
-  PerlMemShared_free(level);
+STATIC void tc_callback(pTHX_ void *ud) {
+ dSP;
 
 ENTER;
 SAVETMPS;
+ ENTER;
+ SAVETMPS;
 
 PUSHMARK(SP);
 PUTBACK;
+ PUSHMARK(SP);
+ PUTBACK;
 
 call_pv(__PACKAGE__ "::_CLEANUP", G_VOID);
call_pv(__PACKAGE__ "::_CLEANUP", G_VOID | G_EVAL);
 
 PUTBACK;
+ PUTBACK;
 
-  FREETMPS;
-  LEAVE;
- }
+ FREETMPS;
+ LEAVE;
 }
 
 MODULE = Thread::Cleanup            PACKAGE = Thread::Cleanup
@@ -47,12 +37,6 @@ PROTOTYPES: DISABLE
 void
 CLONE(...)
 PREINIT:
- int *level;
-CODE:
- {
-  level = PerlMemShared_malloc(sizeof *level);
-  *level = 1;
-  LEAVE;
-  SAVEDESTRUCTOR_X(tc_callback, level);
-  ENTER;
- }
+PPCODE:
+ reap(3, tc_callback, NULL);
+ XSRETURN(0);