[6/8] widl: Null-check pointers with [size_is]

Michael Karcher wine at mkarcher.dialup.fu-berlin.de
Sat Jan 10 17:39:35 CST 2009


Am Samstag, den 10.01.2009, 23:10 +0000 schrieb Rob Shearman:
> >
> > +int is_var_declptr(const var_t *v)
> > +{
> > +  return is_declptr(v->type);
> > +}
> > +
> Again, this function doesn't seem to improve readability of the code.
> I would just move the checking of the type of v into cant_be_null.

I didn't add it for readability, but because we already had is_var_ptr
and I suspected that the intention was to abstract over the way the type
is stored in var_t. If using var->type in client code is not a problem,
I happily remove that function. Moving the check to cant_be_null is a
nice idea, I consider renaming the function "needs_null_check" then, as
cant_be_null(<integer variable>) == 0 might be surprising to the casual
reader, as integers might very well be zero.

> Note: there appears to be a bug in the current code where it walks
> pointers looking for the pointer attribute, instead of walking just
> aliases, so that should probably be fixed too.
Yeah. That function could really use a rewrite. I suppose I don't have
to check at that point that a pointer type attribute is not applied to
an alias that is not an pointer at all.

I will try to use all your helpful suggestions to submit a better series
tomorrow (and to the right address, of course!)

Regards,
  Michael Karcher




More information about the wine-devel mailing list