RFR JDK-8007609
Alan Bateman
Alan.Bateman at oracle.com
Fri Feb 8 20:17:18 UTC 2013
On 08/02/2013 17:03, John Zavgren wrote:
> Greetings:
> I posted a new webrev image:
> http://cr.openjdk.java.net/~jzavgren/8007609/webrev.03/
> <http://cr.openjdk.java.net/%7Ejzavgren/8007609/webrev.03/>
>
> The sole "functional" revision is contained in the following small
> code snippet:
>
> - /* retry with a buffer of the right size */
> - result = (WCHAR*)realloc(result, (len+1) *
> sizeof(WCHAR));
> - if (result != NULL) {
> - len = (*GetFinalPathNameByHandle_func)(h, result,
> len, 0);
> - } else {
> + /* retry the procedure with a buffer of the right
> size. */
> + WCHAR * newResult = (WCHAR*)realloc(result, (len+1) *
> sizeof(WCHAR));
> + if (newResult != NULL) {
> + result = newResult;
> + len = (*GetFinalPathNameByHandle_func)(h,
> newResult, len, 0);
> + } else
>
> and, the innovation is the use of a local variable to hold the
> attempted memory reallocation. This makes the code simpler and easier
> to understand.
>
> I introduced a huge number of additional changes in the file that are
> my attempt to make the file consistent with our style guidelines.
>
> Changes include:
> 1.) elimination of tab characters.
> 2.) spelling, punctuation, and grammar corrections in the comments.
> 3.) truncation of lines that exceed 80 characters
> 4.) correction of indentation, line wrapping, etc.
I think the "functional" changes in L121-126 are fine and fixes the
issue that this bug is about.
I'm not sure what to say about all the re-formatting. Some of it is okay
(there is some old code here) but some of the proposed changes make the
code a lot less readable (in my view). An example of proposed change
that gets on my goat is the removal of the careful alignment of the
parameters to CreateFileW. The fixes to typos in comments in other areas
are of course welcome.
So I'm okay with the fix to the issue and would be happy to sponsor the
bug fix portion of the proposed change.
-Alan.
More information about the core-libs-dev
mailing list