summaryrefslogtreecommitdiff
path: root/perlvars.h
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2013-06-26 18:01:09 +0200
committerNicholas Clark <nick@ccl4.org>2013-07-12 12:51:39 +0200
commit5c64bffd0d9c35e88b9ac48fc997977163abcc50 (patch)
treeb6caa55fa3e482170bf8f3304e96de6a9937b7f4 /perlvars.h
parent358c04b72260b75d5a00491f60fc675c4790fe11 (diff)
downloadperl-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 'perlvars.h')
-rw-r--r--perlvars.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/perlvars.h b/perlvars.h
index 96dfe04c26..aa724e8084 100644
--- a/perlvars.h
+++ b/perlvars.h
@@ -32,7 +32,7 @@ all interpreters and all threads in a process.
#if defined(USE_ITHREADS)
PERLVAR(G, op_mutex, perl_mutex) /* Mutex for op refcounting */
#endif
-PERLVAR(G, curinterp, PerlInterpreter *)
+PERLVARI(G, curinterp, PerlInterpreter *, NULL)
/* currently running interpreter
* (initial parent interpreter under
* useithreads) */
@@ -217,7 +217,7 @@ the Perl core) will normally return C<KEYWORD_PLUGIN_DECLINE>.
PERLVARI(G, keyword_plugin, Perl_keyword_plugin_t, Perl_keyword_plugin_standard)
-PERLVAR(G, op_sequence, HV *) /* dump.c */
+PERLVARI(G, op_sequence, HV *, NULL) /* dump.c */
PERLVARI(G, op_seq, UV, 0) /* dump.c */
#ifdef USE_ITHREADS
@@ -225,7 +225,10 @@ PERLVAR(G, dollarzero_mutex, perl_mutex) /* Modifying $0 */
#endif
/* Restricted hashes placeholder value.
- * The contents are never used, only the address. */
+ In theory, the contents are never used, only the address.
+ In practice, &PL_sv_placeholder is returned by some APIs, and the calling
+ code is checking SvOK(). */
+
PERLVAR(G, sv_placeholder, SV)
#if defined(MYMALLOC) && defined(USE_ITHREADS)