[19075] in Kerberos_V5_Development
Re: Questions about iter check in profile_iterator()
daemon@ATHENA.MIT.EDU (Will Fiveash)
Wed Jan 14 17:38:45 2015
Date: Wed, 14 Jan 2015 16:37:18 -0600
From: Will Fiveash <will.fiveash@oracle.com>
To: Greg Hudson <ghudson@mit.edu>, Neng Xue <neng.xue@oracle.com>,
krbdev@mit.edu
Message-ID: <20150114223718.GB3807@oracle.com>
Mail-Followup-To: Greg Hudson <ghudson@mit.edu>,
Neng Xue <neng.xue@oracle.com>, krbdev@mit.edu
MIME-Version: 1.0
Content-Disposition: inline
In-Reply-To: <20150114214501.GA3807@oracle.com>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: krbdev-bounces@mit.edu
On Wed, Jan 14, 2015 at 03:45:01PM -0600, Will Fiveash wrote:
> On Mon, Jan 12, 2015 at 10:40:39PM -0500, Greg Hudson wrote:
> >
> > On 01/12/2015 08:13 PM, Will Fiveash wrote:
> > > So in the profile_iterator call to profile_node_iterator() the
> > > &iter->idata arg is iter_p for profile_node_iterator? Seems odd to me.
> >
> > I don't see what is odd about that. iter->idata holds the node iterator
> > state.
>
> Eh, looking at the code more I see what's going on so nevermind.
And looking more I think that in the public header there should be:
struct prof_iter;
typedef struct prof_iter *prof_iter;
and the profile_iterator declaration:
profile_iterator(void **iter_p,...
should instead be:
profile_iterator(prof_iter *iter_p,...
{
struct profile_iterator *iter = (struct profile_iterator *) *iter_p;
etc... This would allow the compiler type checking to catch caller
errors like:
void* iterator = NULL;
...
profile_iterator (iterator, &realm_name, &dummy_value);
which should be:
profile_iterator (&iterator, &realm_name, &dummy_value);
^
Those type of calling errors can currently slip by the compiler.
--
Will Fiveash
Oracle Solaris Software Engineer
_______________________________________________
krbdev mailing list krbdev@mit.edu
https://mailman.mit.edu/mailman/listinfo/krbdev