summaryrefslogtreecommitdiff
path: root/sci-astronomy/sextractor/files/sextractor-2.19.5-have-malloc.patch
blob: dd10d4a2c3cd23e4f41b598f1b3f990b85c0fab1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Author: Justin Pryzby <justinpryzby@users.sf.net>
Description: (guess) Define rpl_malloc if not there.
--- a/src/misc.c
+++ b/src/misc.c
@@ -34,6 +34,8 @@
 #include	<time.h>
 #include	<sys/time.h>
 
+#include <sys/types.h>
+
 #include	"define.h"
 #include	"globals.h"
 
@@ -153,3 +155,18 @@
   }
 
 
+#if !HAVE_MALLOC
+#undef malloc
+
+// Allocate an N-byte block of memory from the heap.  If N is zero,
+// allocate a 1-byte block.
+void *rpl_malloc(size_t n)
+{
+	void *malloc();
+	if (0==n) {
+		n = 1;
+	}
+
+	return malloc(n);
+}
+#endif