Skip to content

Commit 63d8cd1

Browse files
committed
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.
1 parent 27b8b31 commit 63d8cd1

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/apply.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@
2424
#include "reader.h"
2525
#include "index.h"
2626

27-
#define apply_err(...) \
28-
( git_error_set(GIT_ERROR_PATCH, __VA_ARGS__), GIT_EAPPLYFAIL )
29-
3027
typedef struct {
3128
/* The lines that we allocate ourself are allocated out of the pool.
3229
* (Lines may have been allocated out of the diff.)
@@ -35,6 +32,18 @@ typedef struct {
3532
git_vector lines;
3633
} patch_image;
3734

35+
static int apply_err(const char *fmt, ...) GIT_FORMAT_PRINTF(1, 2);
36+
static int apply_err(const char *fmt, ...)
37+
{
38+
va_list ap;
39+
40+
va_start(ap, fmt);
41+
git_error_vset(GIT_ERROR_PATCH, fmt, ap);
42+
va_end(ap);
43+
44+
return GIT_EAPPLYFAIL;
45+
}
46+
3847
static void patch_line_init(
3948
git_diff_line *out,
4049
const char *in,

0 commit comments

Comments
 (0)