Re: top: merge duplicate code into helper functions

2018-11-01 Thread Todd C. Miller
On Wed, 31 Oct 2018 23:38:58 +0100, Klemens Nanni wrote: > New diff free of side-effects in filteruser(), rest unchanged. OK millert@ - todd

Re: top: merge duplicate code into helper functions

2018-10-31 Thread Klemens Nanni
On Tue, Oct 30, 2018 at 02:24:46PM -0600, Todd C. Miller wrote: > I really dislike the side-effect in filteruser(), see below. > Otherwise looks good. New diff free of side-effects in filteruser(), rest unchanged. > > +static int > > +filteruser(char buf[]) > > +{ > > + char *bufp = buf; > > +

Re: top: merge duplicate code into helper functions

2018-10-30 Thread Klemens Nanni
On Tue, Oct 30, 2018 at 02:24:46PM -0600, Todd C. Miller wrote: > I really dislike the side-effect in filteruser(), see below. > > +static int > > +filteruser(char buf[]) > > +{ > > + char *bufp = buf; > > + uid_t *uidp; > > + > > + if (bufp[0] == '-') { > > + bufp++[0] = ' '; > >

Re: top: merge duplicate code into helper functions

2018-10-30 Thread Todd C. Miller
On Tue, 30 Oct 2018 21:09:29 +0100, Klemens Nanni wrote: > This introduces filteruser() and filterpid(), where the first one can > now easily be extended to support matching numeric UIDs. The latter one > is now used by the `highlight` command as well. I really dislike the side-effect in filterus

Re: top: merge duplicate code into helper functions

2018-10-30 Thread Klemens Nanni
Another approach to merging code from options and interactive commands. This introduces filteruser() and filterpid(), where the first one can now easily be extended to support matching numeric UIDs. The latter one is now used by the `highlight` command as well. Feedback? OK? Index: top.c ===