commit aa8d6f0a79d91bc66bbe2a9b2a1e555b21f9afac from: Neels Hofmeyr date: Sun May 03 04:10:05 2020 UTC Revert "Remove __linux__ shim" This reverts commit 4db88d74a79c9f7a3b792d21e337d36621a2370a. commit - d0a628e3806179efc9a1bb53342391c3c92d6a9d commit + aa8d6f0a79d91bc66bbe2a9b2a1e555b21f9afac blob - b343617f463879fda7cf9cdf9f98c0af4af65f9c blob + 6a93346a36aec9b051dd69e032f67fc019162212 --- diff/diff.c +++ diff/diff.c @@ -29,6 +29,16 @@ #include #include +#ifdef __linux__ +/* stupid shims to compile and test on linux */ +#define __dead + +static const char *getprogname() +{ + return "diff"; +} +#endif + __dead void usage(void); int diffreg(char *, char *, int); char *mmapfile(const char *, struct stat *); blob - db835ae4d16c7b4d8631e5e0ac7fb837546f3e89 blob + 395468a8c29ce7c6d5ca5283a1a1aa247acb3d87 --- include/diff/arraylist.h +++ include/diff/arraylist.h @@ -17,6 +17,22 @@ #pragma once +#ifdef __linux__ +/* stupid shims to compile and test on linux */ +#include +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;