[PATCH 09/15] xkb: Don't check for NULL when pointer can't be NULL

Pauli Nieminen ext-pauli.nieminen at Nokia.com
Wed Jul 28 04:16:17 PDT 2010


On 28/07/10 01:08 +0200, ext Peter Hutterer wrote:
> On Tue, Jul 27, 2010 at 03:09:50PM +0300, Pauli Nieminen wrote:
> > Caller quarantines that pAction pointer is valid.
> 
>          ^^ "guarantees"?
> 

yes.

> same applies here as well as for the other patch, it's not the caller
> guaranteeing that pAction is non-NULL, it's that we dereferernce it later
> unconditionally anyway, so a NULL argument is already invalid.
> 
> Cheers,
>   Peter

That actually tries to say that I checked that callers are already making
sure that paramter is valid pointer because they are passing pointer to local
variable.

My commit messages are clearly not verbose enough.

> 
> > Signed-off-by: Pauli Nieminen <ext-pauli.nieminen at nokia.com>
> > ---
> >  xkb/xkbActions.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
> > index eea3d4a..ddab882 100644
> > --- a/xkb/xkbActions.c
> > +++ b/xkb/xkbActions.c
> > @@ -340,7 +340,7 @@ _XkbFilterLockState(	XkbSrvInfoPtr	xkbi,
> >  			unsigned	keycode,
> >  			XkbAction *	pAction)
> >  {
> > -    if (pAction&&(pAction->type==XkbSA_LockGroup)) {
> > +    if (pAction->type==XkbSA_LockGroup) {
> >  	if (pAction->group.flags&XkbSA_GroupAbsolute)
> >  	     xkbi->state.locked_group= XkbSAGroup(&pAction->group);
> >  	else xkbi->state.locked_group+= XkbSAGroup(&pAction->group);
> > -- 
> > 1.6.3.3
> > 


More information about the xorg-devel mailing list