Branch: refs/heads/master Author: Colomban Wendling ban@herbesfolles.org Committer: Colomban Wendling ban@herbesfolles.org Date: Sun, 05 Jun 2022 21:11:20 UTC Commit: 668f5d07eef16e227402eab09141c738b315d94b https://github.com/geany/geany-plugins/commit/668f5d07eef16e227402eab09141c7...
Log Message: ----------- git-changebar: Simplify libgit2 version checks
Introduce a custom macro for libgit2 version checks for them to be both easier to read and write.
Modified Paths: -------------- git-changebar/src/gcb-plugin.c
Modified: git-changebar/src/gcb-plugin.c 14 lines changed, 11 insertions(+), 3 deletions(-) =================================================================== @@ -32,11 +32,19 @@ #include <geany.h> #include <document.h>
-#if ! defined (LIBGIT2_VER_MINOR) || ( (LIBGIT2_VER_MAJOR == 0) && (LIBGIT2_VER_MINOR < 22) ) +#ifdef LIBGIT2_VER_MINOR +# define CHECK_LIBGIT2_VERSION(MAJOR, MINOR) \ + ((LIBGIT2_VER_MAJOR == (MAJOR) && LIBGIT2_VER_MINOR >= (MINOR)) || \ + LIBGIT2_VER_MAJOR > (MAJOR)) +#else /* ! defined(LIBGIT2_VER_MINOR) */ +# define CHECK_LIBGIT2_VERSION(MAJOR, MINOR) 0 +#endif + +#if ! CHECK_LIBGIT2_VERSION(0, 22) # define git_libgit2_init git_threads_init # define git_libgit2_shutdown git_threads_shutdown #endif -#if ! defined (LIBGIT2_VER_MINOR) || ( (LIBGIT2_VER_MAJOR == 0) && (LIBGIT2_VER_MINOR < 23) ) +#if ! CHECK_LIBGIT2_VERSION(0, 23) /* 0.23 added @p binary_cb */ # define git_diff_buffers(old_buffer, old_len, old_as_path, \ new_buffer, new_len, new_as_path, options, \ @@ -45,7 +53,7 @@ new_buffer, new_len, new_as_path, options, \ file_cb, hunk_cb, line_cb, payload) #endif -#if ! defined (LIBGIT2_VER_MINOR) || ( (LIBGIT2_VER_MAJOR == 0) && (LIBGIT2_VER_MINOR < 28) ) +#if ! CHECK_LIBGIT2_VERSION(0, 28) # define git_buf_dispose git_buf_free # define git_error_last giterr_last #endif
-------------- This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
plugins-commits@lists.geany.org