Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Development mailing list

Subject: Re: [OMPI devel] [OMPI svn-full] svn:open-mpi r24665
From: Ralph Castain (rhc_at_[hidden])
Date: 2011-05-02 08:19:19


On May 2, 2011, at 1:48 AM, Rainer Keller wrote:

> Ralph,
> two issues:
>
> On Friday 29 April 2011 19:56:15 rhc_at_[hidden] wrote:
>> Author: rhc
>> Date: 2011-04-29 13:56:15 EDT (Fri, 29 Apr 2011)
>> New Revision: 24665
>> URL: https://svn.open-mpi.org/trac/ompi/changeset/24665
>>
>> Log:
>> Cover all the netmask values
>>
>> Text files modified:
>> trunk/opal/util/if.c | 103 +++++++++++++++++++++++++++++++++++++--
>> 1 files changed, 96 insertions(+), 7 deletions(-)
>>
>> Modified: trunk/opal/util/if.c
>> ===========================================================================
>> === --- trunk/opal/util/if.c (original)
>> +++ trunk/opal/util/if.c 2011-04-29 13:56:15 EDT (Fri, 29 Apr 2011)
>> @@ -534,13 +534,102 @@
>> * much of the addr to use: e.g., /16
>> */
>> pval = strtol(msk, NULL, 10);
>> - if (24 == pval) {
>> - *mask = 0xFFFFFF00;
>> - } else if (16 == pval) {
>> - *mask = 0xFFFF0000;
>> - } else if (8 == pval) {
>> - *mask = 0xFF000000;
>> - } else {
>> + switch(pval) {
>> + case 30:
>> + *mask = parse_dots("255.255.255.252");
>> + break;
>> + case 29:
>> + *mask = parse_dots("255.255.255.248");
>> + break;
>> + case 28:
>> + *mask = parse_dots("255.255.255.240");
>> + break;
>> + case 27:
>> + *mask = parse_dots("255.255.255.224");
>> + break;
>> + case 26:
>> + *mask = parse_dots("255.255.255.192");
>> + break;
>> + case 25:
>> + *mask = parse_dots("255.255.255.128");
>> + break;
>> + case 24:
>> + break;
>> + *mask = parse_dots("255.255.255.0");
>> + break;
> 1 issue: buglet in
> case 24 -> break then parse_dots, then break again ,-]

Ick - will fix. Thanks!

>
> Well, the other issue Tim already mentioned. I would vote for making the code
> readable, aka short.

I guess I disagree - to me, clearly seeing the resulting netmask is more important than creating short code.

It isn't like we increase the maintenance load with the extra lines, guys. This code should never change.

>
> Thanks!
> Rainer
> --
> ----------------------------------------------------------------
> Dr.-Ing. Rainer Keller http://www.hlrs.de/people/keller
> HLRS Tel: ++49 (0)711-685 6 5858
> Nobelstrasse 19 Fax: ++49 (0)711-685 6 5832
> 70550 Stuttgart email: keller_at_[hidden]
> Germany AIM/Skype:rusraink
> _______________________________________________
> devel mailing list
> devel_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/devel