summaryrefslogtreecommitdiff
path: root/perl.h
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2010-09-01 11:49:02 +0100
committerDavid Mitchell <davem@iabyn.com>2010-09-01 12:24:44 +0100
commit27cbf00ac29bc5a46a6a386cdf963cf1d7a4620a (patch)
tree40f08df5c358a8d0a9014a790d330300662169d3 /perl.h
parent57bb245860e35e488edc349867894087587a1af6 (diff)
downloadperl-27cbf00ac29bc5a46a6a386cdf963cf1d7a4620a.tar.gz
MY_CXT macros: make the two sets of defs similar
Three years ago there was a cut and paste of all the MY_CXT macros into a second #ifdef PERL_GLOBAL_STRUCT_PRIVATE branch with minor modifications (Bad programmer! No cookie!). Make the two branches more similar in preparation for a partial merge. No functional changes.
Diffstat (limited to 'perl.h')
-rw-r--r--perl.h20
1 files changed, 12 insertions, 8 deletions
diff --git a/perl.h b/perl.h
index d9b2228608..5eeb912359 100644
--- a/perl.h
+++ b/perl.h
@@ -5809,16 +5809,17 @@ typedef struct am_table_short AMTS;
* case below uses it to declare the data as static. */
#define START_MY_CXT
#define MY_CXT_INDEX Perl_my_cxt_index(aTHX_ MY_CXT_KEY)
+#define MY_CXT_INIT_ARG MY_CXT_KEY
/* Creates and zeroes the per-interpreter data.
* (We allocate my_cxtp in a Perl SV so that it will be released when
* the interpreter goes away.) */
#define MY_CXT_INIT \
my_cxt_t *my_cxtp = \
- (my_cxt_t*)Perl_my_cxt_init(aTHX_ MY_CXT_KEY, sizeof(my_cxt_t))
+ (my_cxt_t*)Perl_my_cxt_init(aTHX_ MY_CXT_INIT_ARG, sizeof(my_cxt_t))
#define MY_CXT_INIT_INTERP(my_perl) \
my_cxt_t *my_cxtp = \
- (my_cxt_t*)Perl_my_cxt_init(my_perl, MY_CXT_KEY, sizeof(my_cxt_t))
+ (my_cxt_t*)Perl_my_cxt_init(my_perl, MY_CXT_INIT_ARG, sizeof(my_cxt_t))
/* This declaration should be used within all functions that use the
* interpreter-local data. */
@@ -5839,31 +5840,34 @@ typedef struct am_table_short AMTS;
* right after the definition (i.e. at file scope). The non-threads
* case below uses it to declare the data as static. */
#define START_MY_CXT static int my_cxt_index = -1;
+#define MY_CXT_INDEX my_cxt_index
+#define MY_CXT_INIT_ARG &my_cxt_index
/* This declaration should be used within all functions that use the
* interpreter-local data. */
#define dMY_CXT \
- my_cxt_t *my_cxtp = (my_cxt_t *)PL_my_cxt_list[my_cxt_index]
+ my_cxt_t *my_cxtp = (my_cxt_t *)PL_my_cxt_list[MY_CXT_INDEX]
#define dMY_CXT_INTERP(my_perl) \
- my_cxt_t *my_cxtp = (my_cxt_t *)(my_perl)->Imy_cxt_list[my_cxt_index]
+ my_cxt_t *my_cxtp = (my_cxt_t *)(my_perl)->Imy_cxt_list[MY_CXT_INDEX]
/* Creates and zeroes the per-interpreter data.
* (We allocate my_cxtp in a Perl SV so that it will be released when
* the interpreter goes away.) */
#define MY_CXT_INIT \
my_cxt_t *my_cxtp = \
- (my_cxt_t*)Perl_my_cxt_init(aTHX_ &my_cxt_index, sizeof(my_cxt_t))
+ (my_cxt_t*)Perl_my_cxt_init(aTHX_ MY_CXT_INIT_ARG, sizeof(my_cxt_t))
#define MY_CXT_INIT_INTERP(my_perl) \
my_cxt_t *my_cxtp = \
- (my_cxt_t*)Perl_my_cxt_init(my_perl, &my_cxt_index, sizeof(my_cxt_t))
+ (my_cxt_t*)Perl_my_cxt_init(my_perl, MY_CXT_INIT_ARG, sizeof(my_cxt_t))
/* Clones the per-interpreter data. */
#define MY_CXT_CLONE \
my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1));\
- Copy(PL_my_cxt_list[my_cxt_index], my_cxtp, 1, my_cxt_t);\
- PL_my_cxt_list[my_cxt_index] = my_cxtp \
+ Copy(PL_my_cxt_list[MY_CXT_INDEX], my_cxtp, 1, my_cxt_t);\
+ PL_my_cxt_list[MY_CXT_INDEX] = my_cxtp \
#endif /* #ifdef PERL_GLOBAL_STRUCT_PRIVATE */
+#undef MY_CXT_INIT_ARG
/* This macro must be used to access members of the my_cxt_t structure.
* e.g. MYCXT.some_data */