[PATCH] ntdll: Simplify the file_part finder in RtlDosPathNameToNtPathName_U_WithStatus

Gabriel Ivăncescu gabrielopcode at gmail.com
Thu Aug 23 09:15:02 CDT 2018


Path is known to start with \??\ in this block, so strrchrW cannot ever
return NULL, thus there is no reason to check for it.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode at gmail.com>
---
 dlls/ntdll/path.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/ntdll/path.c b/dlls/ntdll/path.c
index ccc95e3..d2e70bb 100644
--- a/dlls/ntdll/path.c
+++ b/dlls/ntdll/path.c
@@ -366,8 +366,8 @@ NTSTATUS WINAPI RtlDosPathNameToNtPathName_U_WithStatus(const WCHAR *dos_path, U
         ntpath->Buffer[1] = '?';  /* change \\?\ to \??\ */
         if (file_part)
         {
-            if ((ptr = strrchrW( ntpath->Buffer, '\\' )) && ptr[1]) *file_part = ptr + 1;
-            else *file_part = NULL;
+            ptr = strrchrW(ntpath->Buffer, '\\');
+            *file_part = ptr[1] ? ptr + 1 : NULL;
         }
         return STATUS_SUCCESS;
     }
-- 
1.9.1




More information about the wine-devel mailing list