summaryrefslogtreecommitdiff
path: root/perl.c
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2021-02-09 12:48:18 -0700
committerKarl Williamson <khw@cpan.org>2022-07-25 15:47:40 -0600
commit0721b9ab151951a37f60b77264f7ad6341fe2b70 (patch)
tree4dc1b4893c804410449d56d33534dbe667ced7ce /perl.c
parent71ce8c74528f69acac1ccbb56b5cc3d20ddba7dd (diff)
downloadperl-0721b9ab151951a37f60b77264f7ad6341fe2b70.tar.gz
Unixish.h, doshish.h: Reorder terminations; simplify
The IO and memory terminations need to be after other things. Add a comment so that future maintainers won't make the mistakes I did. Also refactor so that amiga os doesn't have a separate list to get out of sync I suspect that the amiga termination should be moved to earlier in the sequence, but absent any evidence; I'm leaving it unchanged. vms destruction was missing a bunch of things and I didn't see any reason to have special handling, so I changed it to just use the standard, presuming the discrepancies were due to changes in the standard not getting propagated to vms. The common definitions are also moved to perl.c which is the only place they are used (including cpan). This makes them available in all circumstances. Otherwise, the #ifdef's for including the relevant header files only include one, so there would be undefined macros.
Diffstat (limited to 'perl.c')
-rw-r--r--perl.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/perl.c b/perl.c
index 8077e0d9f2..e6f93ae05b 100644
--- a/perl.c
+++ b/perl.c
@@ -108,6 +108,34 @@ S_init_tls_and_interp(PerlInterpreter *my_perl)
}
+#ifndef PLATFORM_SYS_INIT_
+# define PLATFORM_SYS_INIT_ NOOP
+#endif
+
+#ifndef PLATFORM_SYS_TERM_
+# define PLATFORM_SYS_TERM_ NOOP
+#endif
+
+#ifndef PERL_SYS_INIT_BODY
+# define PERL_SYS_INIT_BODY(c,v) \
+ MALLOC_CHECK_TAINT2(*c,*v) PERL_FPU_INIT; PERLIO_INIT; \
+ MALLOC_INIT; PLATFORM_SYS_INIT_;
+#endif
+
+/* Generally add things last-in first-terminated. IO and memory terminations
+ * need to be generally last
+ *
+ * BEWARE that using PerlIO in these will be using freed memory, so may appear
+ * to work, but must NOT be retained in production code. */
+#ifndef PERL_SYS_TERM_BODY
+# define PERL_SYS_TERM_BODY() \
+ ENV_TERM; USER_PROP_MUTEX_TERM; LOCALE_TERM; \
+ HINTS_REFCNT_TERM; KEYWORD_PLUGIN_MUTEX_TERM; \
+ OP_CHECK_MUTEX_TERM; OP_REFCNT_TERM; \
+ PERLIO_TERM; MALLOC_TERM; \
+ PLATFORM_SYS_TERM_;
+#endif
+
/* these implement the PERL_SYS_INIT, PERL_SYS_INIT3, PERL_SYS_TERM macros */
void