Skip to content

Commit 65ce00c

Browse files
committed
Adjust threads.xs to use PERL_VERSION_GE and PERL_VERSION_LT
Fixes #5 probably want to split PERL_VERSION_DECIMAL and co to their ownn .h file
1 parent 0854b73 commit 65ce00c

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

dist/threads/threads.xs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
#endif
88
#include "EXTERN.h"
99
#include "perl.h"
10+
#define PERL_CORE 1
11+
#include "vutil.h"
1012
#include "XSUB.h"
1113
/* Workaround for XSUB.h bug under WIN32 */
1214
#ifdef WIN32
@@ -421,7 +423,7 @@ STATIC const MGVTBL ithread_vtbl = {
421423
ithread_mg_free, /* free */
422424
0, /* copy */
423425
ithread_mg_dup, /* dup */
424-
#if (PERL_VERSION > 8) || (PERL_VERSION == 8 && PERL_SUBVERSION > 8)
426+
#if PERL_VERSION_GE(5,8,9)
425427
0 /* local */
426428
#endif
427429
};
@@ -751,7 +753,7 @@ S_ithread_create(
751753
AV *params;
752754
SV **array;
753755

754-
#if PERL_VERSION <= 8 && PERL_SUBVERSION <= 7
756+
#if PERL_VERSION_LT(5,8,8)
755757
SV **tmps_tmp = PL_tmps_stack;
756758
IV tmps_ix = PL_tmps_ix;
757759
#endif
@@ -849,7 +851,7 @@ S_ithread_create(
849851
* context for the duration of our work for new interpreter.
850852
*/
851853
{
852-
#if (PERL_VERSION > 13) || (PERL_VERSION == 13 && PERL_SUBVERSION > 1)
854+
#if PERL_VERSION_GE(5,13,2)
853855
CLONE_PARAMS *clone_param = Perl_clone_params_new(aTHX, thread->interp);
854856
#else
855857
CLONE_PARAMS clone_param_s;
@@ -859,7 +861,7 @@ S_ithread_create(
859861

860862
MY_CXT_CLONE;
861863

862-
#if (PERL_VERSION < 13) || (PERL_VERSION == 13 && PERL_SUBVERSION <= 1)
864+
#if PERL_VERSION_LT(5,13,2)
863865
clone_param->flags = 0;
864866
#endif
865867

@@ -886,7 +888,7 @@ S_ithread_create(
886888
perl_clone() and sv_dup_inc(). Hence copy the parameters
887889
somewhere under our control first, before duplicating. */
888890
if (num_params) {
889-
#if (PERL_VERSION > 8)
891+
#if PERL_VERSION_GE(5,9,0)
890892
Copy(parent_perl->Istack_base + params_start, array, num_params, SV *);
891893
#else
892894
Copy(parent_perl->Tstack_base + params_start, array, num_params, SV *);
@@ -897,11 +899,11 @@ S_ithread_create(
897899
}
898900
}
899901

900-
#if (PERL_VERSION > 13) || (PERL_VERSION == 13 && PERL_SUBVERSION > 1)
902+
#if PERL_VERSION_GE(5,13,2)
901903
Perl_clone_params_del(clone_param);
902904
#endif
903905

904-
#if PERL_VERSION <= 8 && PERL_SUBVERSION <= 7
906+
#if PERL_VERSION_LT(5,8,8)
905907
/* The code below checks that anything living on the tmps stack and
906908
* has been cloned (so it lives in the ptr_table) has a refcount
907909
* higher than 0.
@@ -1339,7 +1341,7 @@ ithread_join(...)
13391341
/* Get the return value from the call_sv */
13401342
/* Objects do not survive this process - FIXME */
13411343
if ((thread->gimme & G_WANT) != G_VOID) {
1342-
#if (PERL_VERSION < 13) || (PERL_VERSION == 13 && PERL_SUBVERSION <= 1)
1344+
#if PERL_VERSION_LT(5,13,2)
13431345
AV *params_copy;
13441346
PerlInterpreter *other_perl;
13451347
CLONE_PARAMS clone_params;
@@ -1766,7 +1768,7 @@ ithread_error(...)
17661768

17671769
/* If thread died, then clone the error into the calling thread */
17681770
if (thread->state & PERL_ITHR_DIED) {
1769-
#if (PERL_VERSION < 13) || (PERL_VERSION == 13 && PERL_SUBVERSION <= 1)
1771+
#if PERL_VERSION_LT(5,13,2)
17701772
PerlInterpreter *other_perl;
17711773
CLONE_PARAMS clone_params;
17721774
ithread *current_thread;

0 commit comments

Comments
 (0)