diff --git a/cmake/SelectRegex.cmake b/cmake/SelectRegex.cmake index d1c09ae44..f2a41b593 100644 --- a/cmake/SelectRegex.cmake +++ b/cmake/SelectRegex.cmake @@ -56,9 +56,9 @@ elseif(USE_REGEX STREQUAL "builtin") add_feature_info("Regular expressions" ON "using bundled implementation") set(GIT_REGEX_BUILTIN 1) - add_subdirectory("${PROJECT_SOURCE_DIR}/deps/pcre" "${PROJECT_BINARY_DIR}/deps/pcre") - list(APPEND LIBGIT2_DEPENDENCY_INCLUDES "${PROJECT_SOURCE_DIR}/deps/pcre") - list(APPEND LIBGIT2_DEPENDENCY_OBJECTS $) + add_subdirectory("${PROJECT_SOURCE_DIR}/deps/pcre2" "${PROJECT_BINARY_DIR}/deps/pcre2") + list(APPEND LIBGIT2_DEPENDENCY_INCLUDES "${PROJECT_SOURCE_DIR}/deps/pcre2") + list(APPEND LIBGIT2_DEPENDENCY_OBJECTS $) else() message(FATAL_ERROR "unknown setting to ${OPTION_NAME}: ${USE_REGEX}") endif() diff --git a/src/util/regexp.c b/src/util/regexp.c index eb4582247..84d5b607c 100644 --- a/src/util/regexp.c +++ b/src/util/regexp.c @@ -7,7 +7,7 @@ #include "regexp.h" -#if defined(GIT_REGEX_BUILTIN) || defined(GIT_REGEX_PCRE) +#if defined(GIT_REGEX_PCRE) int git_regexp_compile(git_regexp *r, const char *pattern, int flags) { @@ -73,7 +73,7 @@ out: return 0; } -#elif defined(GIT_REGEX_PCRE2) +#elif defined(GIT_REGEX_BUILTIN) || defined(GIT_REGEX_PCRE2) int git_regexp_compile(git_regexp *r, const char *pattern, int flags) { diff --git a/src/util/regexp.h b/src/util/regexp.h index d0862b107..aa9aae2ec 100644 --- a/src/util/regexp.h +++ b/src/util/regexp.h @@ -10,8 +10,13 @@ #include "git2_util.h" -#if defined(GIT_REGEX_BUILTIN) || defined(GIT_REGEX_PCRE) -# include "pcre.h" +#if defined(GIT_REGEX_BUILTIN) +# define PCRE2_CODE_UNIT_WIDTH 8 +# include "pcre2.h" +typedef pcre2_code *git_regexp; +# define GIT_REGEX_INIT NULL +#elif defined(GIT_REGEX_PCRE) +# include typedef pcre *git_regexp; # define GIT_REGEX_INIT NULL #elif defined(GIT_REGEX_PCRE2)