diff options
author | Michael Haggerty <mhagger@alum.mit.edu> | 2017-10-14 08:58:14 +0200 |
---|---|---|
committer | Michael Haggerty <mhagger@alum.mit.edu> | 2017-10-14 08:58:14 +0200 |
commit | 5efe9d125f09a44e1581cf7d37cf4d36161f5d4d (patch) | |
tree | 73e259e7211a8cb46258d038da719a7190fccb57 | |
parent | b28825a1fa152cc33e957083faef6fdb7dff1a44 (diff) | |
download | libgit2-5efe9d125f09a44e1581cf7d37cf4d36161f5d4d.tar.gz |
Introduce a new `XDL_INLINE` macro and use it instead of `inline`
`inline` is not portable enough, and the `xdiff` code doesn't import
the `GIT_INLINE` macro. So introduce a new `XDL_INLINE` macro (with
the same definition as `GIT_INLINE`). Use the new macro to inline two
functions in `xdiffi.c`.
-rw-r--r-- | src/xdiff/xdiffi.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/xdiff/xdiffi.c b/src/xdiff/xdiffi.c index e830eb0f6..3e65b6ce5 100644 --- a/src/xdiff/xdiffi.c +++ b/src/xdiff/xdiffi.c @@ -31,7 +31,12 @@ #define XDL_SNAKE_CNT 20 #define XDL_K_HEUR 4 - +/** Declare a function as always inlined. */ +#if defined(_MSC_VER) +# define XDL_INLINE(type) static __inline type +#else +# define XDL_INLINE(type) static inline type +#endif typedef struct s_xdpsplit { long i1, i2; @@ -735,7 +740,7 @@ static void group_init(xdfile_t *xdf, struct xdlgroup *g) * Move g to describe the next (possibly empty) group in xdf and return 0. If g * is already at the end of the file, do nothing and return -1. */ -static inline int group_next(xdfile_t *xdf, struct xdlgroup *g) +XDL_INLINE(int) group_next(xdfile_t *xdf, struct xdlgroup *g) { if (g->end == xdf->nrec) return -1; @@ -751,7 +756,7 @@ static inline int group_next(xdfile_t *xdf, struct xdlgroup *g) * Move g to describe the previous (possibly empty) group in xdf and return 0. * If g is already at the beginning of the file, do nothing and return -1. */ -static inline int group_previous(xdfile_t *xdf, struct xdlgroup *g) +XDL_INLINE(int) group_previous(xdfile_t *xdf, struct xdlgroup *g) { if (g->start == 0) return -1; |