From 8deb411836f5c7faf15202b29499266f081f5708 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 14 Jul 2009 17:37:42 +0000 Subject: Throughout avoid having to initialize constant UNICODE_STRINGs. * globals.cc: Define constant UNICODE_STRINGs and store in .rdata section. * fhandler_disk_file.cc: Throughout, use readonly UNICODE_STRINGs rather then initializing local UNICODE_STRING variable where applicable. * fhandler_mem.cc (fhandler_dev_mem::open): Ditto. * flock.cc (inode_t::inode_t): Ditto. * mmap.cc: Ditto. * syscalls.cc: Ditto. * mount.cc (fs_info::update): Ditto. * path.cc: Ditto. * ntdll.h (RtlEqualUnicodePathPrefix): Redefine to take prefix as UNICODE_STRING. (RtlEqualUnicodePathSuffix): Redefine to take suffix as UNICODE_STRING. * fhandler_disk_file.cc: Accommodate throughout. * mount.cc (fs_info::update): Ditto. * path.cc (cwdstuff::set): Ditto. * syscalls.cc: Ditto. --- winsup/cygwin/path.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'winsup/cygwin/path.cc') diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 56bf6aece..b8be19f2e 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -448,7 +448,7 @@ get_nt_native_path (const char *path, UNICODE_STRING& upath) { if (path[1] == ':') /* X:\... */ { - RtlAppendUnicodeToString (&upath, L"\\??\\"); + RtlAppendUnicodeStringToString (&upath, &ro_u_natp); str2uni_cat (upath, path); /* The drive letter must be upper case. */ upath.Buffer[4] = towupper (upath.Buffer[4]); @@ -462,13 +462,13 @@ get_nt_native_path (const char *path, UNICODE_STRING& upath) else if ((path[2] != '.' && path[2] != '?') || path[3] != '\\') /* \\server\share\... */ { - RtlAppendUnicodeToString (&upath, L"\\??\\UNC\\"); + RtlAppendUnicodeStringToString (&upath, &ro_u_uncp); str2uni_cat (upath, path + 2); transform_chars (&upath, 8); } else /* \\.\device or \\?\foo */ { - RtlAppendUnicodeToString (&upath, L"\\??\\"); + RtlAppendUnicodeStringToString (&upath, &ro_u_natp); str2uni_cat (upath, path + 4); } return &upath; @@ -3079,7 +3079,7 @@ cwdstuff::set (PUNICODE_STRING nat_cwd, const char *posix_cwd, bool doit) else { len = upath.Length / sizeof (WCHAR) - 4; - if (RtlEqualUnicodePathPrefix (&upath, L"\\??\\UNC\\", TRUE)) + if (RtlEqualUnicodePathPrefix (&upath, &ro_u_uncp, TRUE)) len -= 2; } } -- cgit v1.2.3