Jacek Caban : winedevice: Use static initializer for wine_drivers.
Alexandre Julliard
julliard at winehq.org
Wed Aug 31 11:02:41 CDT 2016
Module: wine
Branch: master
Commit: f40a9d61727914504bdfbc387e997614d35bda43
URL: http://source.winehq.org/git/wine.git/?a=commit;h=f40a9d61727914504bdfbc387e997614d35bda43
Author: Jacek Caban <jacek at codeweavers.com>
Date: Tue Aug 30 21:30:48 2016 +0200
winedevice: Use static initializer for wine_drivers.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
programs/winedevice/device.c | 39 +++++++--------------------------------
1 file changed, 7 insertions(+), 32 deletions(-)
diff --git a/programs/winedevice/device.c b/programs/winedevice/device.c
index 5011e4f..79d56ec 100644
--- a/programs/winedevice/device.c
+++ b/programs/winedevice/device.c
@@ -58,7 +58,13 @@ struct wine_driver
WCHAR name[1];
};
-static struct wine_rb_tree wine_drivers;
+static int wine_drivers_rb_compare( const void *key, const struct wine_rb_entry *entry )
+{
+ const struct wine_driver *driver = WINE_RB_ENTRY_VALUE( entry, const struct wine_driver, entry );
+ return strcmpW( (const WCHAR *)key, driver->name );
+}
+
+static struct wine_rb_tree wine_drivers = { wine_drivers_rb_compare };
static CRITICAL_SECTION drivers_cs;
static CRITICAL_SECTION_DEBUG critsect_debug =
@@ -69,35 +75,6 @@ static CRITICAL_SECTION_DEBUG critsect_debug =
};
static CRITICAL_SECTION drivers_cs = { &critsect_debug, -1, 0, 0, 0, 0 };
-static void *wine_drivers_rb_alloc( size_t size )
-{
- return HeapAlloc( GetProcessHeap(), 0, size );
-}
-
-static void *wine_drivers_rb_realloc( void *ptr, size_t size )
-{
- return HeapReAlloc( GetProcessHeap(), 0, ptr, size );
-}
-
-static void wine_drivers_rb_free( void *ptr )
-{
- HeapFree( GetProcessHeap(), 0, ptr );
-}
-
-static int wine_drivers_rb_compare( const void *key, const struct wine_rb_entry *entry )
-{
- const struct wine_driver *driver = WINE_RB_ENTRY_VALUE( entry, const struct wine_driver, entry );
- return strcmpW( (const WCHAR *)key, driver->name );
-}
-
-static const struct wine_rb_functions wine_drivers_rb_functions =
-{
- wine_drivers_rb_alloc,
- wine_drivers_rb_realloc,
- wine_drivers_rb_free,
- wine_drivers_rb_compare,
-};
-
/* find the LDR_MODULE corresponding to the driver module */
static LDR_MODULE *find_ldr_module( HMODULE module )
{
@@ -534,8 +511,6 @@ static void WINAPI ServiceMain( DWORD argc, LPWSTR *argv )
const WCHAR *driver_name = argv[0];
NTSTATUS status;
- if (wine_rb_init( &wine_drivers, &wine_drivers_rb_functions ))
- return;
if (!(stop_event = CreateEventW( NULL, TRUE, FALSE, NULL )))
return;
if (!(cleanup_group = CreateThreadpoolCleanupGroup()))
More information about the wine-cvs
mailing list