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.
This commit is contained in:
Corinna Vinschen
2009-07-14 17:37:42 +00:00
parent 472345a06c
commit 8deb411836
10 changed files with 98 additions and 75 deletions

View File

@@ -1040,32 +1040,32 @@ extern "C"
}
/* Check if prefix is a prefix of path. */
inline
BOOLEAN NTAPI RtlEqualUnicodePathPrefix (PUNICODE_STRING path, PCWSTR prefix,
BOOLEAN NTAPI RtlEqualUnicodePathPrefix (PUNICODE_STRING path,
PUNICODE_STRING prefix,
BOOLEAN caseinsensitive)
{
UNICODE_STRING p, pref;
UNICODE_STRING p;
RtlInitUnicodeString (&pref, prefix);
RtlInitCountedUnicodeString (&p, path->Buffer,
pref.Length < path->Length
? pref.Length : path->Length);
return RtlEqualUnicodeString (&p, &pref, caseinsensitive);
prefix->Length < path->Length
? prefix->Length : path->Length);
return RtlEqualUnicodeString (&p, prefix, caseinsensitive);
}
/* Check if sufffix is a sufffix of path. */
inline
BOOL NTAPI RtlEqualUnicodePathSuffix (PUNICODE_STRING path, PCWSTR suffix,
BOOL NTAPI RtlEqualUnicodePathSuffix (PUNICODE_STRING path,
PUNICODE_STRING suffix,
BOOLEAN caseinsensitive)
{
UNICODE_STRING p, suf;
UNICODE_STRING p;
RtlInitUnicodeString (&suf, suffix);
if (suf.Length < path->Length)
if (suffix->Length < path->Length)
RtlInitCountedUnicodeString (&p, (PWCHAR) ((PBYTE) path->Buffer
+ path->Length - suf.Length),
suf.Length);
+ path->Length - suffix->Length),
suffix->Length);
else
RtlInitCountedUnicodeString (&p, path->Buffer, path->Length);
return RtlEqualUnicodeString (&p, &suf, caseinsensitive);
return RtlEqualUnicodeString (&p, suffix, caseinsensitive);
}
/* Implemented in strfuncs.cc. Create a Hex UNICODE_STRING from a given
64 bit integer value. If append is TRUE, append the hex string,