From 87226107f4b8914cabd8d0417255bf78ad944ec6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Fri, 14 Nov 2025 17:35:53 +0100 Subject: [PATCH] [WIDL] Minor cleanups following wine-10.0 sync (#8461) Addendum to commit 8608467b84 (PR #8305). - Remove redundant `#ifndef __REACTOS__ ... #endif` inside such an already existing block. See https://github.com/reactos/reactos/pull/8305#discussion_r2510118529 - Move the `getenv("TEMP")` ReactOS-specific fix to a better place. - Reduce diff with respect to what we had prior to the sync. See https://github.com/reactos/reactos/pull/8305#discussion_r2509976210 --- sdk/tools/tools.h | 12 ++++-------- sdk/tools/widl/parser.y | 2 +- sdk/tools/widl/widl.c | 2 -- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/sdk/tools/tools.h b/sdk/tools/tools.h index fd21807cbf6..7531020771b 100644 --- a/sdk/tools/tools.h +++ b/sdk/tools/tools.h @@ -382,14 +382,6 @@ static inline char *make_temp_dir(void) char *name; const char *tmpdir = NULL; -#ifdef __REACTOS__ -#ifdef _WIN32 - if (!(tmpdir = getenv("TEMP"))) tmpdir = "temp"; -#else - if (!(tmpdir = getenv("TMPDIR"))) tmpdir = "/tmp"; -#endif -#endif - for (count = 0; count < 0x8000; count++) { if (tmpdir) @@ -400,7 +392,11 @@ static inline char *make_temp_dir(void) value += 7777; if (errno == EACCES && !tmpdir) { +#if defined(__REACTOS__) && defined(_WIN32) + if (!(tmpdir = getenv("TEMP"))) tmpdir = "temp"; +#else if (!(tmpdir = getenv("TMPDIR"))) tmpdir = "/tmp"; +#endif } free( name ); } diff --git a/sdk/tools/widl/parser.y b/sdk/tools/widl/parser.y index 0e879688d58..c2ee30cc32c 100644 --- a/sdk/tools/widl/parser.y +++ b/sdk/tools/widl/parser.y @@ -2157,7 +2157,7 @@ static type_t *reg_typedefs( struct location where, decl_spec_t *decl_spec, decl type->attrs = attrs; } -#ifdef __REACTOS__ /* r53187 / 5bf224e */ +#ifdef __REACTOS__ /* r53187 / 5bf224e */ /* Append the SWITCHTYPE attribute to a non-encapsulated union if it does not already have it. */ if (type_get_type_detect_alias(type) == TYPE_UNION && is_attr(attrs, ATTR_SWITCHTYPE) && diff --git a/sdk/tools/widl/widl.c b/sdk/tools/widl/widl.c index 19348c70dc3..da755dfaf01 100644 --- a/sdk/tools/widl/widl.c +++ b/sdk/tools/widl/widl.c @@ -686,13 +686,11 @@ int open_typelib( const char *name ) TRYOPEN( strmake( "%s/wine%s/%s", libdir, pe_dir, name )); TRYOPEN( strmake( "%s/wine/%s", libdir, name )); } -#ifndef __REACTOS__ for (i = 0; i < ARRAY_SIZE(default_dirs); i++) { if (i && !strcmp( default_dirs[i], default_dirs[0] )) continue; TRYOPEN( strmake( "%s%s/%s", default_dirs[i], pe_dir, name )); } -#endif } #endif