Browse Source

Fix build error under OS X.

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

+ 1
- 2
util.c View File

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

Loading…
Cancel
Save