Commit 5efe9d125f09a44e1581cf7d37cf4d36161f5d4d

Michael Haggerty 2017-10-14T08:58:14

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`.

diff --git a/src/xdiff/xdiffi.c b/src/xdiff/xdiffi.c
index e830eb0..3e65b6c 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;