From 32fbaef5e77e1fbe08ad35c933ff4ed7f61217f8 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sat, 5 Aug 2017 03:37:47 +0200
Subject: [PATCH] include: Move interlocked_inc/dec to port.h.

---
 dlls/ntdll/critsection.c | 10 ----------
 dlls/ntdll/threadpool.c  | 10 ----------
 include/wine/port.h      | 14 +++++++++++++-
 3 files changed, 13 insertions(+), 21 deletions(-)

diff --git a/dlls/ntdll/critsection.c b/dlls/ntdll/critsection.c
index 42e432c8f65..6b17cebe058 100644
--- a/dlls/ntdll/critsection.c
+++ b/dlls/ntdll/critsection.c
@@ -40,16 +40,6 @@
 WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
 WINE_DECLARE_DEBUG_CHANNEL(relay);
 
-static inline LONG interlocked_inc( PLONG dest )
-{
-    return interlocked_xchg_add( dest, 1 ) + 1;
-}
-
-static inline LONG interlocked_dec( PLONG dest )
-{
-    return interlocked_xchg_add( dest, -1 ) - 1;
-}
-
 static inline void small_pause(void)
 {
 #ifdef __i386__
diff --git a/dlls/ntdll/threadpool.c b/dlls/ntdll/threadpool.c
index bf7449cdfa6..b8dc8273702 100644
--- a/dlls/ntdll/threadpool.c
+++ b/dlls/ntdll/threadpool.c
@@ -331,16 +331,6 @@ static void tp_object_prepare_shutdown( struct threadpool_object *object );
 static BOOL tp_object_release( struct threadpool_object *object );
 static struct threadpool *default_threadpool = NULL;
 
-static inline LONG interlocked_inc( PLONG dest )
-{
-    return interlocked_xchg_add( dest, 1 ) + 1;
-}
-
-static inline LONG interlocked_dec( PLONG dest )
-{
-    return interlocked_xchg_add( dest, -1 ) - 1;
-}
-
 static void CALLBACK process_rtl_work_item( TP_CALLBACK_INSTANCE *instance, void *userdata )
 {
     struct rtl_work_item *item = userdata;
diff --git a/include/wine/port.h b/include/wine/port.h
index e32818e5455..470ba66cb50 100644
--- a/include/wine/port.h
+++ b/include/wine/port.h
@@ -501,6 +501,16 @@ static inline __int64 interlocked_cmpxchg64( __int64 *dest, __int64 xchg, __int6
 extern __int64 interlocked_cmpxchg64( __int64 *dest, __int64 xchg, __int64 compare );
 #endif
 
+static inline int interlocked_inc( int *dest )
+{
+    return interlocked_xchg_add( dest, 1 ) + 1;
+}
+
+static inline int interlocked_dec( int *dest )
+{
+    return interlocked_xchg_add( dest, -1 ) - 1;
+}
+
 #else /* NO_LIBWINE_PORT */
 
 #define __WINE_NOT_PORTABLE(func) func##_is_not_portable func##_is_not_portable
@@ -511,9 +521,11 @@ extern __int64 interlocked_cmpxchg64( __int64 *dest, __int64 xchg, __int64 compa
 #define getopt_long_only        __WINE_NOT_PORTABLE(getopt_long_only)
 #define interlocked_cmpxchg     __WINE_NOT_PORTABLE(interlocked_cmpxchg)
 #define interlocked_cmpxchg_ptr __WINE_NOT_PORTABLE(interlocked_cmpxchg_ptr)
+#define interlocked_dec         __WINE_NOT_PORTABLE(interlocked_dec)
+#define interlocked_inc         __WINE_NOT_PORTABLE(interlocked_inc)
 #define interlocked_xchg        __WINE_NOT_PORTABLE(interlocked_xchg)
-#define interlocked_xchg_ptr    __WINE_NOT_PORTABLE(interlocked_xchg_ptr)
 #define interlocked_xchg_add    __WINE_NOT_PORTABLE(interlocked_xchg_add)
+#define interlocked_xchg_ptr    __WINE_NOT_PORTABLE(interlocked_xchg_ptr)
 #define lstat                   __WINE_NOT_PORTABLE(lstat)
 #define pread                   __WINE_NOT_PORTABLE(pread)
 #define pwrite                  __WINE_NOT_PORTABLE(pwrite)
-- 
2.20.1

