IV itmp;
#endif
-#ifdef MYMALLOC
- newmax = malloced_size((void*)AvALLOC(av))/sizeof(SV*) - 1;
+#ifdef Perl_safesysmalloc_size
+ newmax = Perl_safesysmalloc_size((void*)AvALLOC(av)) /
+ sizeof(SV*) - 1;
if (key <= newmax)
goto resized;
Safefree(AvALLOC(av));
AvALLOC(av) = ary;
#endif
-#ifdef MYMALLOC
+#ifdef Perl_safesysmalloc_size
resized:
#endif
ary = AvALLOC(av) + AvMAX(av) + 1;
#endif
/* HMB H.Merijn Brand - a placeholder for preparing Configure patches */
-#if defined(HAS_MALLOC_SIZE) && defined(LOCALTIME_R_NEEDS_TZSET) && defined(HAS_PSEUDOFORK) && defined(USE_DTRACE)
+#if defined(LOCALTIME_R_NEEDS_TZSET) && defined(HAS_PSEUDOFORK) && defined(USE_DTRACE)
/* Not (yet) used at top level, but mention them for metaconfig */
#endif
# 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);
}
}
SvPV_set(sv, s);
-#ifdef MYMALLOC
+#ifdef Perl_safesysmalloc_size
/* Do this here, do it once, do it right, and then we will never get
called back into sv_grow() unless there really is some growing
needed. */
- SvLEN_set(sv, malloced_size(s));
+ SvLEN_set(sv, Perl_safesysmalloc_size(s));
#else
SvLEN_set(sv, newlen);
#endif
allocate = (flags & SV_HAS_TRAILING_NUL)
? len + 1 :
-#ifdef MYMALLOC
+#ifdef Perl_safesysmalloc_size
len + 1;
#else
PERL_STRLEN_ROUNDUP(len + 1);
ptr = (char*) saferealloc (ptr, allocate);
#endif
}
-#ifdef MYMALLOC
- SvLEN_set(sv, malloced_size(ptr));
+#ifdef Perl_safesysmalloc_size
+ SvLEN_set(sv, Perl_safesysmalloc_size(ptr));
#else
SvLEN_set(sv, allocate);
#endif