Module: wine Branch: master Commit: b2accddffe37ea650cca2892367ff1e5dda12f2d URL: http://source.winehq.org/git/wine.git/?a=commit;h=b2accddffe37ea650cca289236...
Author: Huw Davies huw@codeweavers.com Date: Mon Apr 16 13:18:41 2012 +0100
winspool: Simplify cups function loading.
---
dlls/winspool.drv/info.c | 27 ++++++++++++++------------- 1 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/dlls/winspool.drv/info.c b/dlls/winspool.drv/info.c index a5b065c..e958022 100644 --- a/dlls/winspool.drv/info.c +++ b/dlls/winspool.drv/info.c @@ -469,12 +469,19 @@ static BOOL add_printer_driver(WCHAR *name) }
#ifdef SONAME_LIBCUPS -static typeof(cupsFreeDests) *pcupsFreeDests; -static typeof(cupsGetDests) *pcupsGetDests; -static typeof(cupsGetPPD) *pcupsGetPPD; -static typeof(cupsPrintFile) *pcupsPrintFile; + static void *cupshandle;
+#define CUPS_FUNCS \ + DO_FUNC(cupsFreeDests); \ + DO_FUNC(cupsGetDests); \ + DO_FUNC(cupsGetPPD); \ + DO_FUNC(cupsPrintFile); + +#define DO_FUNC(f) static typeof(f) *p##f +CUPS_FUNCS; +#undef DO_FUNC + static BOOL CUPS_LoadPrinters(void) { int i, nrofdests; @@ -493,15 +500,9 @@ static BOOL CUPS_LoadPrinters(void) } TRACE("%p: %s loaded\n", cupshandle, SONAME_LIBCUPS);
-#define DYNCUPS(x) \ - p##x = wine_dlsym(cupshandle, #x, NULL,0); \ - if (!p##x) return FALSE; - - DYNCUPS(cupsFreeDests); - DYNCUPS(cupsGetPPD); - DYNCUPS(cupsGetDests); - DYNCUPS(cupsPrintFile); -#undef DYNCUPS +#define DO_FUNC(x) p##x = wine_dlsym( cupshandle, #x, NULL, 0 ); if (!p##x) return FALSE; + CUPS_FUNCS; +#undef DO_FUNC
if(RegCreateKeyW(HKEY_LOCAL_MACHINE, PrintersW, &hkeyPrinters) != ERROR_SUCCESS) {