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.
On Tue, 12 Apr 2011 13:15:56 +0200, René Hummen
<email address hidden> wrote:
>>> + ipv6_addr_ copy(&compute_ puzzle. initiator_ hit, &initiator_hit); copy(&compute_ puzzle. responder_ hit, &responder_hit);
>>> + ipv6_addr_
>>
>> 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.