lkml.org 
[lkml]   [2014]   [Nov]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 20/26 v5] seq_buf: Add seq_buf_can_fit() helper function
From
Date
On Mon, 2014-11-17 at 19:27 -0500, Steven Rostedt wrote:
> On Mon, 17 Nov 2014 16:07:33 -0800
> Joe Perches <joe@perches.com> wrote:
>
> > On Mon, 2014-11-17 at 12:36 -0500, Steven Rostedt wrote:
> > > On Fri, 14 Nov 2014 23:59:07 -0500
> > > Steven Rostedt <rostedt@goodmis.org> wrote:
> > >
> > > > From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
> > > >
> > > > Add a seq_buf_can_fit() helper function that removes the possible mistakes
> > > > of comparing the seq_buf length plus added data compared to the size of
> > > > the buffer.
> > []
> > > > +static bool seq_buf_can_fit(struct seq_buf *s, size_t len)
> > > > +{
> > > > + return s->len + len < s->size;
> > > > +}
> > > > +
> >
> > Why is this useful?
>
> Places the logic in one place and makes the next patch much shorter.

What "logic" does it place in one place and
how does it matter?

I don't see it making mistakes more or less
likely, I just see it being used to avoid
setting the overflow state which seems like
more of an error than anything else.

Why avoid setting overflow at all?




\
 
 \ /
  Last update: 2014-11-18 02:01    [W:1.320 / U:0.560 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site