summaryrefslogtreecommitdiff
path: root/perl.h
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2008-02-26 23:22:30 +0000
committerNicholas Clark <nick@ccl4.org>2008-02-26 23:22:30 +0000
commit5ee72969ee3f7f898f3dfa2b38589b0a66e44b7e (patch)
treebf96c040e0b720173dd3d840b315602cdd04f92a /perl.h
parent8cae9cfd09528977ac407ea965c1c4fb288b28fc (diff)
downloadperl-5ee72969ee3f7f898f3dfa2b38589b0a66e44b7e.tar.gz
If the C library provides malloc_size(), we can use that in the same
places as Perl's malloced_size(), except that we need to be careful of any PERL_TRACK_MEMPOOL manipulations in force. Wrap both as Perl_safesysmalloc_size(), to give a consistent name and interface. p4raw-id: //depot/perl@33379
Diffstat (limited to 'perl.h')
-rw-r--r--perl.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/perl.h b/perl.h
index 7ad31768f0..aec1e263a4 100644
--- a/perl.h
+++ b/perl.h
@@ -4071,6 +4071,12 @@ struct perl_memory_debug_header {
# define INIT_TRACK_MEMPOOL(header, interp)
#endif
+#ifdef MYMALLOC
+# define Perl_safesysmalloc_size(where) Perl_malloced_size(where)
+#else if defined(HAS_MALLOC_SIZE)
+# define Perl_safesysmalloc_size(where) \
+ (malloc_size(((char *)(where)) - sTHX) - sTHX)
+#endif
typedef int (CPERLscope(*runops_proc_t)) (pTHX);
typedef void (CPERLscope(*share_proc_t)) (pTHX_ SV *sv);