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 . 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