RFR-8008118

Martin Buchholz martinrb at google.com
Thu Mar 21 17:10:27 UTC 2013


Please revert this formatting change:

-        for (q = p; (*q != ':') && (*q != '\0'); q++)
-            ;
+        for (q = p; (*q != ':') && (*q != '\0'); q++);
+

I would not introduce variable k and just count down from i, like this:

if (pathv[i] == NULL) {
  for (i--; i >= 0; i--)
    free(pathv[i]);
  return NULL;
}

which looks a little cleaner.


On Thu, Mar 21, 2013 at 8:53 AM, John Zavgren <john.zavgren at oracle.com>wrote:

> All:
> I modified the splitPath() procedure so that when it encounters an OOM
> error it frees allocated memory before exiting.
>
> Thanks!
> John
>
> http://cr.openjdk.java.net/~jzavgren/8008118/webrev.03/
>
> ----- Original Message -----
> From: martinrb at google.com
> To: chris.hegarty at oracle.com
> Cc: john.zavgren at oracle.com, core-libs-dev at openjdk.java.net
> Sent: Wednesday, March 20, 2013 7:32:39 PM GMT -05:00 US/Canada Eastern
> Subject: Re: RFR-8008118
>
>
>
>
> On Wed, Mar 20, 2013 at 4:23 PM, Chris Hegarty <chris.hegarty at oracle.com>wrote:
>
>> Martin,
>>
>> I take your point about the other allocations, but as you say OOM is
>> better than SEGV. So possibly good enough?
>>
>>
> Ah, Thanks Chris, I had forgotten that NEW *does* throw OOME.
>
>
>> If NEW returns NULL, then there will be a pending OOM on the stack.
>>
>>
> good point!
> In that case, this is indeed a clear improvement, and I leave it to John
> whether to undo the allocations in splitPath before returning.
>
> Just add that space after "if", please, before you submit!
>
>
>



More information about the core-libs-dev mailing list