lkml.org 
[lkml]   [2019]   [Dec]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 07/12] perf hists browser: Allow passing an initial hotkey
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

\
 
 \ /
  Last update: 2019-12-19 22:45    [W:0.084 / U:2.312 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site