Code review comment for lp:~rene-hummen/hipl/puzzle-fixes

Revision history for this message
Christof Mroz (christof-mroz) wrote :

On Tue, 12 Apr 2011 13:15:56 +0200, René Hummen
<email address hidden> wrote:

>>> + ipv6_addr_copy(&compute_puzzle.initiator_hit, &initiator_hit);
>>> + ipv6_addr_copy(&compute_puzzle.responder_hit, &responder_hit);
>>
>> struct in6_addr can be copied using assignment AFAIK (there are more
>> instances of this).
>
> I don't see why a simple assignment should be sufficient with the
> following struct definition:

All I know is that the following works:

struct in6_addr a,b;
// ...
a = b;

I personally prefer this over an explicit byte copy... unless
ipv6_addr_copy does something extra. Assignment of structs is really
nothing else than a typesafe version of memcpy(&a, &b, sizeof(a)).

> In each case, in6_addr contains array, so we would merely copy pointers,
> right?

I'd say yes: an IPv6 address is essentially an opaque array of 16 bytes.

« Back to merge proposal