From 3b90a9dfbefc9da1a0b812b0a4bc4135070ea5c5 Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Fri, 15 Dec 2023 16:51:21 +0000 Subject: [PATCH 1/2] Add CI --- .github/workflows/main.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..2655786 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,29 @@ +name: CI Build + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + workflow_dispatch: + +jobs: + build: + strategy: + matrix: + platform: + - ubuntu-latest + - macos-latest + - windows-latest + + runs-on: ${{ matrix.platform }} + + steps: + - name: Check out repository + uses: actions/checkout@v3 + - name: Build + run: | + mkdir build + cd build + cmake .. + cmake --build . From 77b9f1bfe295069c7759cddf15325c0989a8d99b Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Fri, 15 Dec 2023 16:56:47 +0000 Subject: [PATCH 2/2] win32: don't include regex by default Windows doesn't have a regex library (or regex.h) by default. Don't try to compile it in unless `XDL_REGEX` is defined. Otherwise, error with `REG_ASSERT` if the regex functionality is attempted to be used. --- git-xdiff.h | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/git-xdiff.h b/git-xdiff.h index d812d0d..4091d22 100644 --- a/git-xdiff.h +++ b/git-xdiff.h @@ -16,7 +16,6 @@ #include #include #include -#include /* Work around C90-conformance issues */ #if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) @@ -47,8 +46,23 @@ #define XDL_BUG(msg) do { fprintf(stderr, "fatal: %s\n", msg); exit(128); } while(0) -#define xdl_regex_t regex_t -#define xdl_regmatch_t regmatch_t +#if defined(_MSC_VER) && !defined(XDL_REGEX) + +# define xdl_regex_t void * +# define xdl_regmatch_t void * + +inline int xdl_regexec_buf( + const xdl_regex_t *preg, const char *buf, size_t size, + size_t nmatch, xdl_regmatch_t pmatch[], int eflags) +{ + return 15; /* REG_ASSERT */ +} + +#else +# include + +# define xdl_regex_t regex_t +# define xdl_regmatch_t regmatch_t inline int xdl_regexec_buf( const xdl_regex_t *preg, const char *buf, size_t size, @@ -60,4 +74,6 @@ inline int xdl_regexec_buf( return regexec(preg, buf, nmatch, pmatch, eflags | REG_STARTEND); } +#endif /* XDL_NO_REGEX */ + #endif