Fill the input buffer enough to scan the next character if possible. Return the number of bytes available from the current offset. */
| 117 | /* Fill the input buffer enough to scan the next character if possible. |
| 118 | Return the number of bytes available from the current offset. */ |
| 119 | MBBUF_INLINE idx_t |
| 120 | mbbuf_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. */ |
| 139 | MBBUF_INLINE void |
no test coverage detected