diff options
author | Patrick Steinhardt <ps@pks.im> | 2019-04-16 10:56:18 +0200 |
---|---|---|
committer | Patrick Steinhardt <ps@pks.im> | 2019-04-16 11:52:30 +0200 |
commit | b106620d038bc764329a29c234ffad5903479634 (patch) | |
tree | 02d60a0b955c60451930b33f6821a257d1a273e3 | |
parent | d1cfd79a477a440c5f0929c34e817da202227ec7 (diff) | |
download | libgit2-b106620d038bc764329a29c234ffad5903479634.tar.gz |
examples: move MSVC compatibility macros into common header
We currently have two locations in our examples where we define
the same compatibility wrappers for MSVC. Move them into
"common.h" to avoid duplication and make them available to other
examples.
-rw-r--r-- | examples/blame.c | 5 | ||||
-rw-r--r-- | examples/common.h | 5 | ||||
-rw-r--r-- | examples/merge.c | 4 |
3 files changed, 5 insertions, 9 deletions
diff --git a/examples/blame.c b/examples/blame.c index 0ddbfc68a..fa586b31e 100644 --- a/examples/blame.c +++ b/examples/blame.c @@ -14,11 +14,6 @@ #include "common.h" -#ifdef _MSC_VER -#define snprintf sprintf_s -#define strcasecmp strcmpi -#endif - /** * This example demonstrates how to invoke the libgit2 blame API to roughly * simulate the output of `git blame` and a few of its command line arguments. diff --git a/examples/common.h b/examples/common.h index ac1c067dd..c1d444e1d 100644 --- a/examples/common.h +++ b/examples/common.h @@ -26,6 +26,11 @@ #endif #endif +#ifdef _MSC_VER +#define snprintf sprintf_s +#define strcasecmp strcmpi +#endif + #define ARRAY_SIZE(x) (sizeof(x)/sizeof(*x)) #define UNUSED(x) (void)(x) diff --git a/examples/merge.c b/examples/merge.c index a275ecbeb..8ddb79b84 100644 --- a/examples/merge.c +++ b/examples/merge.c @@ -15,10 +15,6 @@ #include "common.h" #include <assert.h> -#ifdef _MSC_VER -#define snprintf sprintf_s -#endif - /** The following example demonstrates how to do merges with libgit2. * * It will merge whatever commit-ish you pass in into the current branch. |