system.drv16: Merge CreateSystemTimer() into WIN16_CreateSystemTimer().

Francois Gouget fgouget at free.fr
Wed Oct 7 07:55:46 CDT 2009


---

CreateSystemTimer() is used in only one place so it should be made 
static (and WINAPI should be removed), but that would conflict with the 
prototype for the function by the same name declared in winuser16.h. So 
it seemed like the best was to just get rid of it.

I did not take the extra step of renaming WIN16_CreateSystemTimer() to 
CreateSystemTimer(), CreateSystemTimer16() or something else as the 
naming convention was not clear to me. Also, it's possible the 
CreateSystemTimer() prototype in include/wine/winuser16.h should be 
removed but I assumed it somehow applied to the function exported by 
system.drv16.spec but I'm not so sure now. So let me know if further 
changes are desired.


 dlls/system.drv16/system.c |   40 +++++++++++++++++-----------------------
 1 files changed, 17 insertions(+), 23 deletions(-)

diff --git a/dlls/system.drv16/system.c b/dlls/system.drv16/system.c
index 46ab04e..cad8e3f 100644
--- a/dlls/system.drv16/system.c
+++ b/dlls/system.drv16/system.c
@@ -147,26 +147,6 @@ DWORD WINAPI InquireSystem16( WORD code, WORD arg )
 }
 
 
-/***********************************************************************
- *           CreateSystemTimer   (SYSTEM.2)
- */
-WORD WINAPI CreateSystemTimer( WORD rate, SYSTEMTIMERPROC callback )
-{
-    int i;
-    for (i = 0; i < NB_SYS_TIMERS; i++)
-        if (!SYS_Timers[i].callback)  /* Found one */
-        {
-            SYS_Timers[i].rate = (UINT)rate * 1000;
-            if (SYS_Timers[i].rate < SYS_TIMER_RATE)
-                SYS_Timers[i].rate = SYS_TIMER_RATE;
-            SYS_Timers[i].ticks = SYS_Timers[i].rate;
-            SYS_Timers[i].callback = callback;
-            if (++SYS_NbTimers == 1) SYSTEM_StartTicks();
-            return i + 1;  /* 0 means error */
-        }
-    return 0;
-}
-
 /**********************************************************************/
 
 static void call_timer_proc16( WORD timer )
@@ -188,11 +168,25 @@ static void call_timer_proc16( WORD timer )
 
 /**********************************************************************/
 
+/***********************************************************************
+ *           CreateSystemTimer   (SYSTEM.2)
+ */
 WORD WINAPI WIN16_CreateSystemTimer( WORD rate, FARPROC16 proc )
 {
-    WORD ret = CreateSystemTimer( rate, call_timer_proc16 );
-    if (ret) SYS_Timers[ret - 1].callback16 = proc;
-    return ret;
+    int i;
+    for (i = 0; i < NB_SYS_TIMERS; i++)
+        if (!SYS_Timers[i].callback)  /* Found one */
+        {
+            SYS_Timers[i].rate = (UINT)rate * 1000;
+            if (SYS_Timers[i].rate < SYS_TIMER_RATE)
+                SYS_Timers[i].rate = SYS_TIMER_RATE;
+            SYS_Timers[i].ticks = SYS_Timers[i].rate;
+            SYS_Timers[i].callback = call_timer_proc16;
+	    SYS_Timers[i].callback16 = proc;
+            if (++SYS_NbTimers == 1) SYSTEM_StartTicks();
+            return i + 1;  /* 0 means error */
+        }
+    return 0;
 }
 
 
-- 
1.6.3.3



More information about the wine-patches mailing list