RFR 8207016 : [win] Avoid redundant native memory allocation in getFinalPath()
Ivan Gerasimov
ivan.gerasimov at oracle.com
Mon Jul 16 17:44:46 UTC 2018
Thank you Alan for review!
On 7/16/18 5:05 AM, Alan Bateman wrote:
> On 11/07/2018 03:33, Ivan Gerasimov wrote:
>> Hello!
>>
>> File src/java.base/windows/native/libjava/WinNTFileSystem_md.c
>> The function getFinalPath() is wrapper for
>> GetFinalPathNameByHandleW(), which is used to resolve the symlinks on
>> Windows.
>>
>> If the resulting string begins with a prefix "\\?\" or "\\?\UNC", a
>> copy without the prefix is created and returned.
>>
>> Instead of creating the copy, we can override the result with
>> memmove() to avoid allocating extra native memory.
>> The result of getFinalPath() is short living anyway, so a few unused
>> bytes at the end of the buffer should not be a problem.
>>
>> The advantage is a shorter code and minus one point of possible failure.
>>
>> Would you please help review it?
>>
>> BUG: https://bugs.openjdk.java.net/browse/JDK-8207016
>> Webrev: http://cr.openjdk.java.net/~igerasim/8207016/00/webrev/
> I think this looks okay.
>
> -Alan
>
--
With kind regards,
Ivan Gerasimov
More information about the core-libs-dev
mailing list