[PATCH weston] don't attempt to start input method if path is empty

Pekka Paalanen ppaalanen at gmail.com
Tue Jun 9 23:57:37 PDT 2015


On Wed, 10 Jun 2015 08:48:01 +1000
Peter Hutterer <peter.hutterer at who-t.net> wrote:

> On Tue, Jun 09, 2015 at 03:00:26PM -0700, Jon A. Cruz wrote:
> > Instead of a full strcmp against an empty string, could we just check
> > the first char?
> > 
> >     if (!text_backend->input_method.path[0])
> 
> does this really gain us anything worthwhile?

Nope. It would make it harder to understand what this is testing, and
this is nowhere near a performance-critical path either, assuming such
change would even have any effect.

Jon, please use reply-to-all, you didn't CC Murray here.

> > On 06/09/2015 01:28 PM, Murray Calavera wrote:
> > > This allows a user to explicitly disable the input
> > > method by setting path to blank;
> > > 
> > > Signed-off-by: Murray Calavera <murray.calavera at gmail.com>
> > > ---
> > >  src/text-backend.c | 3 +++
> > >  1 file changed, 3 insertions(+)
> > > 
> > > diff --git a/src/text-backend.c b/src/text-backend.c
> > > index 64a3c1b..3c349d4 100644
> > > --- a/src/text-backend.c
> > > +++ b/src/text-backend.c
> > > @@ -957,6 +957,9 @@ launch_input_method(struct text_backend *text_backend)
> > >  	if (!text_backend->input_method.path)
> > >  		return;
> > >  
> > > +	if (strcmp(text_backend->input_method.path, "") == 0)
> > > +		return;
> > > +
> > >  	if (text_backend->input_method.process.pid != 0)
> > >  		return;

Reviewed-by: Pekka Paalanen <pekka.paalanen at collabora.co.uk>


Thanks,
pq


More information about the wayland-devel mailing list