summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2019-06-16 11:17:17 +0200
committerPatrick Steinhardt <ps@pks.im>2019-08-01 11:57:06 +0200
commit63d8cd189e7eb9a410f04283cbe46d3d3f0a1924 (patch)
tree863fedec59491d8a953da777ffa6ca7f2800522d
parent27b8b31e2955ec264a9b748c8e5328e2c8e04419 (diff)
downloadlibgit2-63d8cd189e7eb9a410f04283cbe46d3d3f0a1924.tar.gz
apply: remove use of variadic error macro
The macro `apply_err` is implemented as a variadic macro, which are not defined by C89. Convert it to a variadic function, instead.
-rw-r--r--src/apply.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/apply.c b/src/apply.c
index 55b1a397f..1ee9291d3 100644
--- a/src/apply.c
+++ b/src/apply.c
@@ -24,9 +24,6 @@
#include "reader.h"
#include "index.h"
-#define apply_err(...) \
- ( git_error_set(GIT_ERROR_PATCH, __VA_ARGS__), GIT_EAPPLYFAIL )
-
typedef struct {
/* The lines that we allocate ourself are allocated out of the pool.
* (Lines may have been allocated out of the diff.)
@@ -35,6 +32,18 @@ typedef struct {
git_vector lines;
} patch_image;
+static int apply_err(const char *fmt, ...) GIT_FORMAT_PRINTF(1, 2);
+static int apply_err(const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ git_error_vset(GIT_ERROR_PATCH, fmt, ap);
+ va_end(ap);
+
+ return GIT_EAPPLYFAIL;
+}
+
static void patch_line_init(
git_diff_line *out,
const char *in,