[haiku-commits] Re: r40541 - haiku/trunk/src/tests/kits/net/preflet/InterfacesAddOn

  • From: "Axel Dörfler" <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 17 Feb 2011 09:15:09 +0100 (MET)

kallisti5@xxxxxxxxxxx wrote:
> +void
> +NetworkSettings::SetIP(int family, const char* ip)
> +{
> +     if (family == AF_INET6)
> +             fIPv6Addr = ip;
> +     else
> +             fIPv4Addr = ip;

As a suggestion for improvement: why hard-code the families? BNetworkAddress is 
completely family agnostic, and while the UI arguably cannot be, the 
NetworkSettings surely can and should. You could just use a map, list, or even 
a multimap to store them, depending on how you want to implement it.

Bye,
   Axel.


Other related posts: