summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKen Brown <kbrown@cornell.edu>2014-08-30 22:40:00 -0400
committerKen Brown <kbrown@cornell.edu>2014-08-30 22:40:00 -0400
commitf356dedfe3abd145c8f302c9be6b5e5ed9acacfc (patch)
treefdd20983d24fe06e6e8892a2320f9af046138120 /src
parentced5a8f219b31402480b60c370d0045afe74a531 (diff)
downloademacs-f356dedfe3abd145c8f302c9be6b5e5ed9acacfc.tar.gz
Fix bug#18368 with broken build on AIX due to HYBRID_MALLOC changes.
* src/gmalloc.c: Don't include <stdlib.h>. Declare system malloc and friends before defining hybrid_malloc and friends if HYBRID_MALLOC is defined. (Bug#18368)
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog6
-rw-r--r--src/gmalloc.c18
2 files changed, 17 insertions, 7 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 00ec5dcf3d6..8f2e01f8cf9 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
+2014-08-31 Ken Brown <kbrown@cornell.edu>
+
+ * gmalloc.c: Don't include <stdlib.h>. Declare system malloc and
+ friends before defining hybrid_malloc and friends if HYBRID_MALLOC
+ is defined. (Bug#18368)
+
2014-08-30 Paul Eggert <eggert@cs.ucla.edu>
Vector-sorting fixes (Bug#18361).
diff --git a/src/gmalloc.c b/src/gmalloc.c
index f4a32c79ca1..2682b07ee47 100644
--- a/src/gmalloc.c
+++ b/src/gmalloc.c
@@ -19,13 +19,6 @@ License along with this library. If not, see <http://www.gnu.org/licenses/>.
The author may be reached (Email) at the address mike@ai.mit.edu,
or (US mail) as Mike Haertel c/o Free Software Foundation. */
-/* If HYBRID_MALLOC is defined in config.h, then conf_post.h #defines
- malloc and friends as macros before including stdlib.h. In this
- file we will need the prototypes for the system malloc, so we must
- include stdlib.h before config.h. And we have to do this
- unconditionally, since HYBRID_MALLOC hasn't been defined yet. */
-#include <stdlib.h>
-
#include <config.h>
#if defined HAVE_PTHREAD && !defined HYBRID_MALLOC
@@ -1725,6 +1718,17 @@ valloc (size_t size)
#undef aligned_alloc
#undef free
+/* Declare system malloc and friends. */
+extern void *malloc (size_t size);
+extern void *realloc (void *ptr, size_t size);
+extern void *calloc (size_t nmemb, size_t size);
+extern void free (void *ptr);
+#ifdef HAVE_ALIGNED_ALLOC
+extern void *aligned_alloc (size_t alignment, size_t size);
+#elif defined HAVE_POSIX_MEMALIGN
+extern int posix_memalign (void **memptr, size_t alignment, size_t size);
+#endif
+
/* See the comments near the beginning of this file for explanations
of the following functions. */