mirror of
https://github.com/libgit2/libgit2.git
synced 2026-06-22 06:26:26 +00:00
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.
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user