Re: [PATCH 07/12] perf hists browser: Allow passing an initial hotkey

Jiri Olsa
2019-12-19T21:44:40Z

On Thu, Dec 19, 2019 at 02:26:42PM -0300, Arnaldo Carvalho de Melo wrote:
> Em Wed, Dec 18, 2019 at 03:23:21PM +0100, Jiri Olsa escreveu:
> > On Wed, Dec 18, 2019 at 11:08:31AM -0300, Arnaldo Carvalho de Melo wrote:
> > > Em Wed, Dec 18, 2019 at 09:08:18AM +0100, Jiri Olsa escreveu:
> > > > On Tue, Dec 17, 2019 at 11:48:23AM -0300, Arnaldo Carvalho de Melo wrote:
> > > > > + if (key)
> > > > > + goto do_hotkey;
> > > > > +
> > > > > while (1) {
> > > > > key = ui_browser__run(&browser->b, delay_secs);
> > > > > -
> > > > > +do_hotkey:
>
> > > > or we could switch the 'swtich' and ui_browser__run, and get rid of the goto, like:
>
> > > > while (1) {
> > > > switch (key) {
> > > > ...
> > > > }
> > > >
> > > > key = ui_browser__run(&browser->b, delay_secs);
> > > > }
>
> > > I think those are equivalent and having the test like I did is more
> > > clear, i.e. "has this key been provided" instead of going to the switch
> > > just to hit the default case for the zero in key and call
> > > ui_browser__run().
>
> > sure, I just don't like goto other than for error handling,
> > looks too hacky to me ;-) but of course it's your call
>
> How about the one below?

looks good, thanks

jirka