On 2016-04-21 at 14:04:05 +0200, Vadim Kochan <[email protected]> wrote:
> On Thu, Apr 21, 2016 at 2:53 PM, Tobias Klauser <[email protected]> wrote:
> > On 2016-04-17 at 19:31:30 +0200, Vadim Kochan <[email protected]> wrote:
> >> Add new module ui.c which is responsible to render
> >> different kinds of UI widgets - tables, etc.
> >>
> >> Implemented generic API for print table-like list of elements.
> >> This table API might be used for print flows in curses or text mode.
> >>
> >> Signed-off-by: Vadim Kochan <[email protected]>
> >
> > Looks good in general, a few minor nits below.
> >
> >> ---
> >> ui.c | 142
> >> +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >> ui.h | 53 +++++++++++++++++++++++++
> >
> > How about calling the module ui_table, which is a bit more specific?
> > Also all function names already start with "ui_table_".
>
> I thought that ui.c might keep other UI helpers (widgets), so I called
> it just "ui", so if
> there will be some other UI widget, then ui_xxx naming will be still OK.
Hm, ok. I just think UI might be a bit too generic (also given that it
is only used by flowtop). But we can still rename/split later on if need
be...
> >> +static struct ui_col *ui_table_col_get(struct ui_table *tbl, uint32_t id)
> >> +{
> >> + struct ui_col *col;
> >> +
> >> + list_for_each_entry(col, &tbl->cols, entry) {
> >> + if (col->id == id)
> >> + return col;
> >> + }
> >> +
> >> + /* Should not happen in normal case */
> >> + panic("Invalid column id %u\n", id);
> >
> > I'd rather omit the panic() here, return NULL and gracefully handle (if
> > possible) NULL returns in the callers.
> >
>
> Hm, for me it looks like more programmers's issue so may be
> bug_on(...) will be better ?
> But I will still think on it more ...
In my opinion we should never panic() based on a programming error but
only use it e.g. if syscalls fail. bug_on() is certainly better suited
here.
--
You received this message because you are subscribed to the Google Groups
"netsniff-ng" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.