[PATCH] Deprecate malloc_(sg)et state.
Ondřej Bílka
neleai@seznam.cz
Tue Mar 4 12:35:00 GMT 2014
Hi,
I asked at emacs-devel how much are these needed.
It turned out that there is already a configure check to use alternative
when malloc_set_state is not available. Replacement is bit slower but
there was agreement that improving malloc has higher priority.
See following thread:
http://lists.gnu.org/archive/html/emacs-devel/2014-02/msg00541.html
What needs to be added to following patch? A test for malloc_set_state
naturaly cannot compile so how link that? Also what write to NEWS?
* malloc/malloc.c: Make malloc_get_state and malloc_set_state
compatibility symbols.
* malloc/tst-mallocstate.c: Disable test.
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 9a45707..36d94e2 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -5180,6 +5180,13 @@ weak_alias (__malloc_trim, malloc_trim)
weak_alias (__malloc_get_state, malloc_get_state)
weak_alias (__malloc_set_state, malloc_set_state)
+#include <shlib-compat.h>
+#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_20)
+
+compat_symbol (libc, malloc_get_state, malloc_get_state, GLIBC_2_0);
+compat_symbol (libc, malloc_set_state, malloc_set_state, GLIBC_2_0);
+
+#endif
/* ------------------------------------------------------------
History:
diff --git a/malloc/tst-mallocstate.c b/malloc/tst-mallocstate.c
index 69c4500..eec2e5a 100644
--- a/malloc/tst-mallocstate.c
+++ b/malloc/tst-mallocstate.c
@@ -32,6 +32,7 @@ merror (const char *msg)
int
main (void)
{
+/*
void *p1, *p2;
void *save_state;
long i;
@@ -56,7 +57,9 @@ main (void)
merror ("malloc_get_state () failed.");
break;
}
+ */
/*free (malloc (10)); This could change the top chunk! */
+ /*
malloc_set_state (save_state);
p1 = realloc (p1, i * 4 + 4);
if (p1 == NULL)
@@ -72,6 +75,7 @@ main (void)
free (p1);
return errors != 0;
+*/
}
/*
More information about the Libc-alpha
mailing list