Skip to content

Commit 5efe9d1

Browse files
committed
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`.
1 parent b28825a commit 5efe9d1

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/xdiff/xdiffi.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,12 @@
3131
#define XDL_SNAKE_CNT 20
3232
#define XDL_K_HEUR 4
3333

34-
34+
/** Declare a function as always inlined. */
35+
#if defined(_MSC_VER)
36+
# define XDL_INLINE(type) static __inline type
37+
#else
38+
# define XDL_INLINE(type) static inline type
39+
#endif
3540

3641
typedef struct s_xdpsplit {
3742
long i1, i2;
@@ -735,7 +740,7 @@ static void group_init(xdfile_t *xdf, struct xdlgroup *g)
735740
* Move g to describe the next (possibly empty) group in xdf and return 0. If g
736741
* is already at the end of the file, do nothing and return -1.
737742
*/
738-
static inline int group_next(xdfile_t *xdf, struct xdlgroup *g)
743+
XDL_INLINE(int) group_next(xdfile_t *xdf, struct xdlgroup *g)
739744
{
740745
if (g->end == xdf->nrec)
741746
return -1;
@@ -751,7 +756,7 @@ static inline int group_next(xdfile_t *xdf, struct xdlgroup *g)
751756
* Move g to describe the previous (possibly empty) group in xdf and return 0.
752757
* If g is already at the beginning of the file, do nothing and return -1.
753758
*/
754-
static inline int group_previous(xdfile_t *xdf, struct xdlgroup *g)
759+
XDL_INLINE(int) group_previous(xdfile_t *xdf, struct xdlgroup *g)
755760
{
756761
if (g->start == 0)
757762
return -1;

0 commit comments

Comments
 (0)