Browse Source

Fix build error under OS X.

Georgi Chorbadzhiyski 6 years ago
parent
commit
8ef5febf04
2 changed files with 7 additions and 2 deletions
  1. 6
    0
      Makefile
  2. 1
    2
      util.c

+ 6
- 0
Makefile View File

@@ -14,8 +14,14 @@ CFLAGS ?= -O2 -ggdb -pipe -ffunction-sections -fdata-sections \
14 14
  -Wshadow -Wformat-security -Wstrict-prototypes -Wno-unused-parameter \
15 15
  -Wredundant-decls -Wold-style-definition
16 16
 
17
+uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
18
+
17 19
 LDFLAGS ?= -Wl,--gc-sections
18 20
 
21
+ifeq ($(uname_S),Darwin)
22
+LDFLAGS :=
23
+endif
24
+
19 25
 DEFS += -D_FILE_OFFSET_BITS=64
20 26
 
21 27
 FUNCS_DIR = libfuncs

+ 1
- 2
util.c View File

@@ -15,7 +15,6 @@
15 15
 #include <stdlib.h>
16 16
 #include <string.h>
17 17
 #include <inttypes.h>
18
-#include <malloc.h>
19 18
 #include <unistd.h>
20 19
 
21 20
 #include "util.h"
@@ -32,7 +31,7 @@ void die(const char *fmt, ...) {
32 31
 }
33 32
 
34 33
 void *xmalloc(size_t size) {
35
-	void *ret = memalign(16, size);
34
+	void *ret = malloc(size);
36 35
 	if (!ret)
37 36
 		die("Can't alloc %ld bytes\n", (unsigned long)size);
38 37
 	return ret;

Loading…
Cancel
Save