diff options
author | Nicholas Clark <nick@ccl4.org> | 2013-06-26 18:01:09 +0200 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2013-07-12 12:51:39 +0200 |
commit | 5c64bffd0d9c35e88b9ac48fc997977163abcc50 (patch) | |
tree | b6caa55fa3e482170bf8f3304e96de6a9937b7f4 /util.c | |
parent | 358c04b72260b75d5a00491f60fc675c4790fe11 (diff) | |
download | perl-5c64bffd0d9c35e88b9ac48fc997977163abcc50.tar.gz |
Fix SEGVs and test failures for -DPERL_GLOBAL_STRUCT_PRIVATE
With PERL_GLOBAL_STRUCT_PRIVATE "global" variables are in a structure in
malloc()ed memory, not in global static variables or a global static
structure. Hence no global variables are implicitly initialised to zero.
* PL_curinterp and PL_op_sequence need initialising to NULL
* The global structure is free()d before handlers registered with atexit()
run, so be defensive about this.
* Some C code checks SvOK(PL_sv_placeholder) so ensure that its SvFLAGS()
are 0.
* Zero PL_hash_seed
Diffstat (limited to 'util.c')
-rw-r--r-- | util.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -5456,6 +5456,10 @@ Perl_init_global_struct(pTHX) # ifdef PERL_SET_VARS PERL_SET_VARS(plvarsp); # endif +# ifdef PERL_GLOBAL_STRUCT_PRIVATE + plvarsp->Gsv_placeholder.sv_flags = 0; + memset(plvarsp->Ghash_seed, 0, sizeof(plvarsp->Ghash_seed)); +# endif # undef PERL_GLOBAL_STRUCT_INIT # endif return plvarsp; |