> On 20 Oct 2016, at 14:03, Langer, Christoph <[email protected]> wrote:
>
> Hi Pavel,
>
> overall this looks good. I've got a few minor remarks:
>
> 1. What about using the macro CHECK_NULL_RETURN in NetworkInterface_winXP.c?
>
> 2. in Java_java_net_TwoStacksPlainDatagramSocketImpl_peekData:
>
> You could move
> 1178 /* make sure receive() picks up the right fd */
> 1179 (*env)->SetIntField(env, this, pdsi_fduseID, fduse);
> into the else branch above and set port to -1 in the n<0 branches. That way
> -1 will be returned always and the free(fullPacket) is also invoked if
> necessary with less lines of code :) But that's probably a matter of taste ;-)
>
> Best regards
> Christoph
Hi Christoph,
Thanks a lot for looking into this! I would prefer to be a bit more explicit in
both cases. And indeed I considered to do exactly what you described in the 2nd
point, but then I saw this pattern in several different places (just grep it) in
this file:
if (packetBufferLen > MAX_BUFFER_LEN) {
free(fullPacket);
}
So for consistency's sake maybe we should keep it as it is? I appreciate it
looks a bit wordy.
Thanks!