Commit Diff


commit - 3ba0a2ed9248c03ceb66583587fba9b20c77747a
commit + 41d00e9f34296294af1563a9e05bb39c6f428a41
blob - 873ca8d5ceddb912a44260d6afd6ee413d6dc1a3
blob + 5e1032c5d328cdc1ec0d1d83acd13bad81a337bf
--- diff/GNUmakefile
+++ diff/GNUmakefile
@@ -1,10 +1,12 @@
 CFLAGS = -fsanitize=address -fsanitize=undefined -g -O3
 CFLAGS += -Wstrict-prototypes -Wunused-variable
 
-diff: diff.c ../lib/libdiff.a
+SRCS=	diff.c
+LIB=	../lib/libdiff.a
+
+diff: $(SRCS) $(LIB)
 	gcc $(CFLAGS) -I../include -o $@ $^
 
-
 ../lib/libdiff.a: ../lib/*.[hc] ../include/diff/*.h
 	$(MAKE) -C ../lib
 
blob - f8b01eed134fc9c6c5e951a7ac9e05485a653ea7
blob + b9cb5287108c39de112730e222d45dde287c811c
--- include/diff/arraylist.h
+++ include/diff/arraylist.h
@@ -15,23 +15,6 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#ifdef __linux__
-/* stupid shims to compile and test on linux */
-#include <strings.h>
-static inline void *reallocarray(void *buf, size_t n, size_t member_size)
-{
-	return realloc(buf, n * member_size);
-}
-static inline void *recallocarray(void *buf, size_t oldn, size_t n,
-				  size_t member_size)
-{
-	buf = reallocarray(buf, n, member_size);
-	bzero(((char*)buf) + (oldn * member_size), (n - oldn) * member_size);
-	return buf;
-}
-#endif
-
-
 /* Usage:
  *
  * ARRAYLIST(any_type_t) list;
blob - 6db035bb5ae10656a0f6d64973fdd775550f65b3
blob + dbf0f51f200f34e415f06d4604f088e14ea0a0e4
--- lib/GNUmakefile
+++ lib/GNUmakefile
@@ -1,4 +1,4 @@
-srcs = \
+SRCS = \
 	diff_atomize_text.c \
 	diff_main.c \
 	diff_myers.c \
@@ -8,12 +8,17 @@ srcs = \
 	diff_output_unidiff.c \
 	$(END)
 
-objs = $(srcs:.c=.o)
+# Compat sources
+VPATH=         $(CURDIR)/../compat
+SRCS+=         getprogname_linux.c recallocarray.c
+CFLAGS+=       -I$(CURDIR)/../compat/include
 
-libdiff.a: $(objs)
+OBJS = $(SRCS:.c=.o)
+
+libdiff.a: $(OBJS)
 	ar rcs $@ $^
 
-CFLAGS = -fsanitize=address -fsanitize=undefined -g -O3
+CFLAGS += -fsanitize=address -fsanitize=undefined -g -O3
 CFLAGS += -Wstrict-prototypes -Wunused-variable
 
 %.o: %.c ./*.h ../include/diff/*.h
@@ -21,5 +26,5 @@ CFLAGS += -Wstrict-prototypes -Wunused-variable
 
 .PHONY: clean
 clean:
-	-rm $(objs)
+	-rm $(OBJS)
 	-rm libdiff.a