DCCP protocol discussions
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@redhat.com>
To: dccp@vger.kernel.org
Subject: Re: [PATCH 2/5] dccp: Implement lookup table for
Date: Wed, 24 Sep 2008 13:58:22 +0000	[thread overview]
Message-ID: <20080924135822.GI9588@ghostprotocols.net> (raw)
In-Reply-To: <1222068117-13401-3-git-send-email-gerrit@erg.abdn.ac.uk>

Em Wed, Sep 24, 2008 at 06:41:20AM +0200, Gerrit Renker escreveu:
> | > | > --- a/include/linux/dccp.h
> | > | > +++ b/include/linux/dccp.h
> | > | >  
> | > | > +
> | > | > +static int dccp_feat_default_value(u8 feat_num)
> | > | > +{
> | > | > +	int idx = dccp_feat_index(feat_num);
> | > | > +
> | > | > +	return idx < 0 ? : dccp_feat_table[idx].default_value;
> | > | > +}
> <snip>
> | > | 
> | > It is the first value. The test is only there to avoid accessing the
> | > array with an invalid index, which would happen if an unknown `feat_num'
> | > is passed - as for unknown features there is no default value.
> | 
> | The above explanation would be good to have as a comment, as it was not
> | so obvious from a first sight. I think that even having it explicit
> | would be clearer:
> | 
> | return idx < 0 ? 1 : dccp_feat_table[idx].default_value;
> | 
> | But then, if an unknown feat num is passed shouldn't the code bailout in
> | some other fashion than returning the result of a boolean expression and
> | not accessing the defaults table?
> | 
> Yes thank you. It is necessary to check this, since only in the current
> state of code the use of the function is consistent.  If the code gets
> changed later on then there will be no warning.
> 
> I have worked on this function yesterday evening with regard to above
> feedback. If you could either check again when the patch is submitted
> later, or have a look at the online version in the test tree on
> http://eden-feed.erg.abdn.ac.uk/cgi-bin/gitweb.cgi?p‹cp_exp.git;a=commitdiff;h∞708121bfeb309db88e1b3a97cf851069bcafe1

Looks ok now, thanks.

- Arnaldo
--
To unsubscribe from this list: send the line "unsubscribe dccp" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2008-09-24 13:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-22  7:21 [PATCH 2/5] dccp: Implement lookup table for feature-negotiation information Gerrit Renker
2008-09-22 14:21 ` [PATCH 2/5] dccp: Implement lookup table for Arnaldo Carvalho de Melo
2008-09-22 15:45 ` Gerrit Renker
2008-09-22 16:49 ` Arnaldo Carvalho de Melo
2008-09-22 17:00 ` Arnaldo Carvalho de Melo
2008-09-23  3:20 ` David Miller
2008-09-24  4:41 ` Gerrit Renker
2008-09-24 13:58 ` Arnaldo Carvalho de Melo [this message]
2008-10-04  9:13 ` [PATCH 2/5] dccp: Implement lookup table for feature-negotiation information Gerrit Renker
2008-10-11  7:31 ` [PATCH 2/5] dccp: Implement lookup table for feature-negotiation Gerrit Renker
2008-11-05  6:52 ` Gerrit Renker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080924135822.GI9588@ghostprotocols.net \
    --to=acme@redhat.com \
    --cc=dccp@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox