Commit 250751be46d8a42b2727fc71a628e05914f60a76

Daniel Mendler 2019-05-07T09:32:59

tommath.h: do not expose stdlib.h

diff --git a/demo/shared.h b/demo/shared.h
index 7a7b88f..7d74004 100644
--- a/demo/shared.h
+++ b/demo/shared.h
@@ -1,4 +1,5 @@
 #include <string.h>
+#include <stdlib.h>
 #include <time.h>
 
 /*
diff --git a/tommath.h b/tommath.h
index 2ffcb68..754e19d 100644
--- a/tommath.h
+++ b/tommath.h
@@ -4,7 +4,6 @@
 #ifndef BN_H_
 #define BN_H_
 
-#include <stdlib.h>
 #include <stdint.h>
 #include <limits.h>
 
diff --git a/tommath_private.h b/tommath_private.h
index 1f5c40d..c400454 100644
--- a/tommath_private.h
+++ b/tommath_private.h
@@ -41,6 +41,7 @@ extern "C" {
 /* define heap macros */
 #ifndef MP_MALLOC
 /* default to libc stuff */
+#   include <stdlib.h>
 #   define MP_MALLOC(size)                   malloc(size)
 #   define MP_REALLOC(mem, oldsize, newsize) realloc(mem, newsize)
 #   define MP_CALLOC(nmemb, size)            calloc(nmemb, size)