Change 11152 by gsar@latte-gsar on 2001/07/05 00:52:57
fix the binary compatibility issue when building with/without
usemymalloc by exporting Perl_malloc() et al as simple wrappers
around the system functions (this allows most extensions built
using one mode to coexist with perls built in the other mode)
XXX the Perl_mfree() wrapper might need to do return(free()) on
platforms where Free_t isn't "void"
Affected files ...
... //depot/perl/embed.h#270 edit
... //depot/perl/embed.pl#254 edit
... //depot/perl/makedef.pl#74 edit
... //depot/perl/proto.h#316 edit
... //depot/perl/util.c#286 edit
Differences ...
==== //depot/perl/embed.h#270 (text+w) ====
Index: perl/embed.h
--- perl/embed.h.~1~ Wed Jul 4 19:00:05 2001
+++ perl/embed.h Wed Jul 4 19:00:05 2001
@@ -3084,11 +3084,11 @@
# if defined(PERL_IMPLICIT_SYS)
# endif
#endif
-#if defined(MYMALLOC)
#define malloc Perl_malloc
#define calloc Perl_calloc
#define realloc Perl_realloc
#define mfree Perl_mfree
+#if defined(MYMALLOC)
#define malloced_size Perl_malloced_size
#endif
#define get_context Perl_get_context
==== //depot/perl/embed.pl#254 (xtext) ====
Index: perl/embed.pl
--- perl/embed.pl.~1~ Wed Jul 4 19:00:05 2001
+++ perl/embed.pl Wed Jul 4 19:00:05 2001
@@ -1359,11 +1359,11 @@
# endif
#endif
-#if defined(MYMALLOC)
Ajnop |Malloc_t|malloc |MEM_SIZE nbytes
Ajnop |Malloc_t|calloc |MEM_SIZE elements|MEM_SIZE size
Ajnop |Malloc_t|realloc |Malloc_t where|MEM_SIZE nbytes
Ajnop |Free_t |mfree |Malloc_t where
+#if defined(MYMALLOC)
jnp |MEM_SIZE|malloced_size |void *p
#endif
==== //depot/perl/makedef.pl#74 (text) ====
Index: perl/makedef.pl
--- perl/makedef.pl.~1~ Wed Jul 4 19:00:05 2001
+++ perl/makedef.pl Wed Jul 4 19:00:05 2001
@@ -473,10 +473,6 @@
emit_symbols [qw(
Perl_dump_mstats
Perl_get_mstats
- Perl_malloc
- Perl_mfree
- Perl_realloc
- Perl_calloc
Perl_strdup
Perl_putenv
)];
@@ -496,10 +492,6 @@
PL_malloc_mutex
Perl_dump_mstats
Perl_get_mstats
- Perl_malloc
- Perl_mfree
- Perl_realloc
- Perl_calloc
Perl_malloced_size
)];
}
==== //depot/perl/proto.h#316 (text+w) ====
Index: perl/proto.h
--- perl/proto.h.~1~ Wed Jul 4 19:00:05 2001
+++ perl/proto.h Wed Jul 4 19:00:05 2001
@@ -24,11 +24,11 @@
# endif
#endif
-#if defined(MYMALLOC)
PERL_CALLCONV Malloc_t Perl_malloc(MEM_SIZE nbytes);
PERL_CALLCONV Malloc_t Perl_calloc(MEM_SIZE elements, MEM_SIZE size);
PERL_CALLCONV Malloc_t Perl_realloc(Malloc_t where, MEM_SIZE nbytes);
PERL_CALLCONV Free_t Perl_mfree(Malloc_t where);
+#if defined(MYMALLOC)
PERL_CALLCONV MEM_SIZE Perl_malloced_size(void *p);
#endif
==== //depot/perl/util.c#286 (text) ====
Index: perl/util.c
--- perl/util.c.~1~ Wed Jul 4 19:00:05 2001
+++ perl/util.c Wed Jul 4 19:00:05 2001
@@ -336,6 +336,37 @@
#endif /* LEAKTEST */
+/* These must be defined when not using Perl's malloc for binary
+ * compatibility */
+
+#ifndef MYMALLOC
+
+Malloc_t Perl_malloc (MEM_SIZE nbytes)
+{
+ dTHXs;
+ return PerlMem_malloc(nbytes);
+}
+
+Malloc_t Perl_calloc (MEM_SIZE elements, MEM_SIZE size)
+{
+ dTHXs;
+ return PerlMem_calloc(elements, size);
+}
+
+Malloc_t Perl_realloc (Malloc_t where, MEM_SIZE nbytes)
+{
+ dTHXs;
+ return PerlMem_realloc(where, nbytes);
+}
+
+Free_t Perl_mfree (Malloc_t where)
+{
+ dTHXs;
+ PerlMem_free(where);
+}
+
+#endif
+
/* copy a string up to some (non-backslashed) delimiter, if any */
char *
End of Patch.