MCPcopy Create free account
hub / github.com/coreutils/coreutils / mbbuf_fill

Function mbbuf_fill

gl/lib/mbbuf.h:119–136  ·  view source on GitHub ↗

Fill the input buffer enough to scan the next character if possible. Return the number of bytes available from the current offset. */

Source from the content-addressed store, hash-verified

117/* Fill the input buffer enough to scan the next character if possible.
118 Return the number of bytes available from the current offset. */
119MBBUF_INLINE idx_t
120mbbuf_fill (mbbuf_t *mbbuf)
121{
122 idx_t available = mbbuf_avail (mbbuf);
123
124 if (available == 0)
125 return mbbuf_topup (mbbuf);
126
127 if (available < MCEL_LEN_MAX && ! mbbuf->eof)
128 {
129 mcel_t g = mcel_scan (mbbuf->buffer + mbbuf->offset,
130 mbbuf->buffer + mbbuf->length);
131 if (g.err)
132 return mbbuf_topup (mbbuf);
133 }
134
135 return available;
136}
137
138/* Consume N bytes from the current buffer. */
139MBBUF_INLINE void

Callers 1

mbbuf_get_charFunction · 0.85

Calls 2

mbbuf_availFunction · 0.85
mbbuf_topupFunction · 0.85

Tested by

no test coverage detected