summaryrefslogtreecommitdiff
path: root/ext/DynaLoader
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-10-25 18:07:58 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-10-25 18:07:58 +0000
commit89ca4ac7af707d34da190bf469b8073ada175d9b (patch)
treee9338f678f71d31acd664a643de302ea3bd3289f /ext/DynaLoader
parent4e1a6d261e266112da00fd82e73dbe2a0631027c (diff)
downloadperl-89ca4ac7af707d34da190bf469b8073ada175d9b.tar.gz
Integrate changes #12652 and #12653 from maintperl;
more tweaks to change#12626 * move the boilerplate code over to perl.h and make DynaLoader use it * make re, Opcode, File::Glob and B threadsafe * re.xs needed s/deinstall/uninstall/ (guess nobody uses C<no re;> anywhere) include XS_VERSION in MY_CXT_KEY (tweak for change#12652) File::Glob required a bit more work in bleadperl because of ExtUtils::Constant (see the Makefile.PL change) p4raw-link: @12652 on //depot/maint-5.6/perl: 3bc8871b91a24662eada2114d9a016153718b1c4 p4raw-link: @12626 on //depot/maint-5.6/perl: 512dcce54ea4db665708f91609bdd0a6126d1acd p4raw-id: //depot/perl@12654 p4raw-integrated: from //depot/maint-5.6/perl@12650 'edit in' ext/B/B.xs ext/DynaLoader/dlutils.c (@12652..) 'merge in' perl.h (@12597..) ext/File/Glob/Glob.xs ext/Opcode/Opcode.xs ext/re/re.xs (@12652..)
Diffstat (limited to 'ext/DynaLoader')
-rw-r--r--ext/DynaLoader/dlutils.c62
1 files changed, 11 insertions, 51 deletions
diff --git a/ext/DynaLoader/dlutils.c b/ext/DynaLoader/dlutils.c
index 604c7f40e1..f15cf7315f 100644
--- a/ext/DynaLoader/dlutils.c
+++ b/ext/DynaLoader/dlutils.c
@@ -8,7 +8,10 @@
* files when the interpreter exits
*/
-#define MY_CXT_KEY "DynaLoader_guts"
+#ifndef XS_VERSION
+# define XS_VERSION "0"
+#endif
+#define MY_CXT_KEY "DynaLoader::_guts"##XS_VERSION
typedef struct {
char * x_dl_last_error; /* pointer to allocated memory for
@@ -26,63 +29,20 @@ typedef struct {
#endif
} my_cxt_t;
-/* XXX most of this is boilerplate code that should abstracted further into
- * macros and exposed via XSUB.h */
-
-#if defined(USE_ITHREADS)
-
-#define dMY_CXT_SV \
- SV *my_cxt_sv = *hv_fetch(PL_modglobal, MY_CXT_KEY, \
- sizeof(MY_CXT_KEY)-1, TRUE)
-
-/* we allocate my_cxt in a Perl SV so that it will be released when
- * the interpreter goes away */
-#define dMY_CXT_INIT \
- dMY_CXT_SV; \
- /* newSV() allocates one more than needed */ \
- my_cxt_t *my_cxt = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1)); \
- Zero(my_cxt, 1, my_cxt_t); \
- sv_setuv(my_cxt_sv, (UV)my_cxt);
-
-#define dMY_CXT \
- dMY_CXT_SV; \
- my_cxt_t *my_cxt = (my_cxt_t*)SvUV(my_cxt_sv)
+START_MY_CXT
-#define dl_last_error (my_cxt->x_dl_last_error)
-#define dl_nonlazy (my_cxt->x_dl_nonlazy)
+#define dl_last_error (MY_CXT.x_dl_last_error)
+#define dl_nonlazy (MY_CXT.x_dl_nonlazy)
#ifdef DL_LOADONCEONLY
-#define dl_loaded_files (my_cxt->x_dl_loaded_files)
+#define dl_loaded_files (MY_CXT.x_dl_loaded_files)
#endif
#ifdef DL_CXT_EXTRA
-#define dl_cxtx (my_cxt->x_dl_cxtx)
+#define dl_cxtx (MY_CXT.x_dl_cxtx)
#endif
#ifdef DEBUGGING
-#define dl_debug (my_cxt->x_dl_debug)
+#define dl_debug (MY_CXT.x_dl_debug)
#endif
-#else /* USE_ITHREADS */
-
-static my_cxt_t my_cxt;
-
-#define dMY_CXT_SV dNOOP
-#define dMY_CXT_INIT dNOOP
-#define dMY_CXT dNOOP
-
-#define dl_last_error (my_cxt.x_dl_last_error)
-#define dl_nonlazy (my_cxt.x_dl_nonlazy)
-#ifdef DL_LOADONCEONLY
-#define dl_loaded_files (my_cxt.x_dl_loaded_files)
-#endif
-#ifdef DL_CXT_EXTRA
-#define dl_cxtx (my_cxt.x_dl_cxtx)
-#endif
-#ifdef DEBUGGING
-#define dl_debug (my_cxt.x_dl_debug)
-#endif
-
-#endif /* !defined(USE_ITHREADS) */
-
-
#ifdef DEBUGGING
#define DLDEBUG(level,code) \
STMT_START { \
@@ -123,7 +83,7 @@ static void
dl_generic_private_init(pTHX) /* called by dl_*.xs dl_private_init() */
{
char *perl_dl_nonlazy;
- dMY_CXT_INIT;
+ MY_CXT_INIT;
dl_last_error = NULL;
dl_nonlazy = 0;