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/mmap.cc | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'winsup/cygwin/mmap.cc') diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc index 799b3f701..df4cb457a 100644 --- a/winsup/cygwin/mmap.cc +++ b/winsup/cygwin/mmap.cc @@ -835,14 +835,12 @@ mmap64 (void *addr, size_t len, int prot, int flags, int fd, _off64_t off) /* You can't create mappings with PAGE_EXECUTE protection if the file isn't explicitely opened with EXECUTE access. */ - UNICODE_STRING fname; OBJECT_ATTRIBUTES attr; NTSTATUS status; HANDLE h; IO_STATUS_BLOCK io; - RtlInitUnicodeString (&fname, L""); - InitializeObjectAttributes (&attr, &fname, fh->pc.objcaseinsensitive (), + InitializeObjectAttributes (&attr, &ro_u_empty, fh->pc.objcaseinsensitive (), fh->get_handle (), NULL); status = NtOpenFile (&h, fh->get_access () | GENERIC_EXECUTE | SYNCHRONIZE, @@ -1622,11 +1620,8 @@ fhandler_dev_mem::mmap (caddr_t *addr, size_t len, int prot, return INVALID_HANDLE_VALUE; } - UNICODE_STRING memstr; - RtlInitUnicodeString (&memstr, L"\\device\\physicalmemory"); - OBJECT_ATTRIBUTES attr; - InitializeObjectAttributes (&attr, &memstr, + InitializeObjectAttributes (&attr, &ro_u_pmem, OBJ_CASE_INSENSITIVE | OBJ_INHERIT, NULL, NULL); -- cgit v1.2.3