mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-21 14:47:03 +01:00
common/iobuf.h: Clarify semantics of nofast. Simplify implementation.
* common/iobuf.h (struct iobuf_struct): Clarify semantics of nofast. Simplify use of nofast to implement just these semantics. -- Signed-off-by: Neal H. Walfield <neal@g10code.com>.
This commit is contained in:
parent
e8c0b6abf8
commit
12fc56bcb5
@ -1651,7 +1651,7 @@ iobuf_push_filter2 (iobuf_t a,
|
||||
/* disable nlimit for the new stream */
|
||||
a->ntotal = b->ntotal + b->nbytes;
|
||||
a->nlimit = a->nbytes = 0;
|
||||
a->nofast &= ~1;
|
||||
a->nofast = 0;
|
||||
/* make a link from the new stream to the original stream */
|
||||
a->chain = b;
|
||||
|
||||
@ -2124,9 +2124,9 @@ void
|
||||
iobuf_set_limit (iobuf_t a, off_t nlimit)
|
||||
{
|
||||
if (nlimit)
|
||||
a->nofast |= 1;
|
||||
a->nofast = 1;
|
||||
else
|
||||
a->nofast &= ~1;
|
||||
a->nofast = 0;
|
||||
a->nlimit = nlimit;
|
||||
a->ntotal += a->nbytes;
|
||||
a->nbytes = 0;
|
||||
@ -2308,7 +2308,7 @@ iobuf_seek (iobuf_t a, off_t newpos)
|
||||
a->d.start = 0;
|
||||
a->nbytes = 0;
|
||||
a->nlimit = 0;
|
||||
a->nofast &= ~1;
|
||||
a->nofast = 0;
|
||||
a->ntotal = newpos;
|
||||
a->error = 0;
|
||||
/* remove filters, but the last */
|
||||
|
@ -75,7 +75,11 @@ struct iobuf_struct
|
||||
off_t nlimit;
|
||||
off_t nbytes; /* Used together with nlimit. */
|
||||
off_t ntotal; /* Total bytes read (position of stream). */
|
||||
int nofast; /* Used by the iobuf_get (). */
|
||||
|
||||
/* Whether we need to read from the filter one byte at a time or
|
||||
whether we can do bulk reads. We need to read one byte at a time
|
||||
if a limit (set via iobuf_set_limit) is active. */
|
||||
int nofast;
|
||||
struct
|
||||
{
|
||||
size_t size; /* Allocated size */
|
||||
|
Loading…
x
Reference in New Issue
Block a user