Author: timbo Date: Tue May 27 05:21:47 2008 New Revision: 11329 Modified: dbi/trunk/DBI.xs dbi/trunk/DBIXS.h dbi/trunk/dbixs_rev.h
Log: Fix #32309 - http://rt.cpan.org/Public/Bug/Display.html?id=32309 (hopefully) by setting DBIS using the same mechanism that drivers use to access it. Modified: dbi/trunk/DBI.xs ============================================================================== --- dbi/trunk/DBI.xs (original) +++ dbi/trunk/DBI.xs Tue May 27 05:21:47 2008 @@ -378,9 +378,17 @@ dbi_bootinit(dbistate_t * parent_dbis) { dTHX; + dbistate_t* DBISx; INIT_PERINTERP; - DBIS = (struct dbistate_st*)malloc_using_sv(sizeof(struct dbistate_st)); + DBISx = (struct dbistate_st*)malloc_using_sv(sizeof(struct dbistate_st)); + + /* publish address of dbistate so dynaloaded DBD's can find it, + * taking care to store the value in the same way it'll be used + * to avoid problems on some architectures, for example see + * http://rt.cpan.org/Public/Bug/Display.html?id=32309 + */ + DBISTATE_ASSIGN(DBISx); /* store version and size so we can spot DBI/DBD version mismatch */ DBIS->check_version = check_version; @@ -398,9 +406,6 @@ DBIS->thr_owner = PERL_GET_THX; #endif - /* publish address of dbistate so dynaloaded DBD's can find it */ - sv_setiv(perl_get_sv(DBISTATE_PERLNAME,1), PTR2IV(DBIS)); - DBISTATE_INIT; /* check DBD code to set DBIS from DBISTATE_PERLNAME */ if (DBIS_TRACE_LEVEL > 9) { Modified: dbi/trunk/DBIXS.h ============================================================================== --- dbi/trunk/DBIXS.h (original) +++ dbi/trunk/DBIXS.h Tue May 27 05:21:47 2008 @@ -451,19 +451,21 @@ /* note that USE_ITHREADS implies MULTIPLICITY */ #if defined(MULTIPLICITY) || defined(PERL_OBJECT) || defined(PERL_CAPI) -# define DBISTATE_DECLARE typedef int dummy_dbistate /* keep semicolon from feeling lonely */ -# define DBISTATE_ASSIGN(st) -# define DBISTATE_INIT +# define DBISTATE_DECLARE typedef int dummy_dbistate1 /* keep semicolon from feeling lonely */ # undef DBIS # define DBIS (*(INT2PTR(dbistate_t**, &SvIVX(DBISTATE_ADDRSV)))) /* 'dbis' is temp for bad drivers using 'dbis' instead of 'DBIS' */ # define dbis (*(INT2PTR(dbistate_t**, &SvIVX(DBISTATE_ADDRSV)))) +# define DBISTATE_INIT_DBIS typedef int dummy_dbistate2 /* keep semicolon from feeling lonely */ #else /* plain and simple non perl object / multiplicity case */ # define DBISTATE_DECLARE static dbistate_t *DBIS -# define DBISTATE_ASSIGN(st) (DBIS = (st)) # define DBISTATE_INIT_DBIS DBISTATE_ASSIGN(INT2PTR(dbistate_t*, SvIV(DBISTATE_ADDRSV))) + +#endif + +# define DBISTATE_ASSIGN(st) (DBIS = (st)) # define DBISTATE_INIT { /* typically use in BOOT: of XS file */ \ DBISTATE_INIT_DBIS; \ if (DBIS == NULL) \ @@ -472,7 +474,6 @@ sizeof(dbih_drc_t), sizeof(dbih_dbc_t), sizeof(dbih_stc_t), sizeof(dbih_fdc_t) \ ); \ } -#endif /* --- Assorted Utility Macros --- */ Modified: dbi/trunk/dbixs_rev.h ============================================================================== --- dbi/trunk/dbixs_rev.h (original) +++ dbi/trunk/dbixs_rev.h Tue May 27 05:21:47 2008 @@ -1,4 +1,4 @@ -/* Fri May 9 13:27:00 2008 */ -/* Mixed revision working copy (10993M:11152) */ +/* Tue May 27 13:18:10 2008 */ +/* Mixed revision working copy (10993M:11328) */ /* Code modified since last checkin */ #define DBIXS_REVISION 10993
