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

Function mbbuf_get_char

gl/lib/mbbuf.h:150–166  ·  view source on GitHub ↗

Get the next character in the buffer, filling it from FP if necessary. If an invalid multi-byte character is seen, we assume the program wants to fall back to the read byte. */

Source from the content-addressed store, hash-verified

148 If an invalid multi-byte character is seen, we assume the program wants to
149 fall back to the read byte. */
150MBBUF_INLINE mcel_t
151mbbuf_get_char (mbbuf_t *mbbuf)
152{
153 idx_t available = mbbuf_fill (mbbuf);
154 if (available <= 0)
155 return (mcel_t) { .ch = MBBUF_EOF };
156 mcel_t g = mcel_scan (mbbuf->buffer + mbbuf->offset,
157 mbbuf->buffer + mbbuf->length);
158 if (! g.err)
159 mbbuf->offset += g.len;
160 else
161 {
162 /* Assume the program will emit the byte, but keep the error flag. */
163 g.ch = (unsigned char) mbbuf->buffer[mbbuf->offset++];
164 }
165 return g;
166}
167
168/* Returns a pointer to the first byte in the previously read character from
169 mbbuf_get_char. */

Callers 7

expandFunction · 0.85
unexpandFunction · 0.85
fold_fileFunction · 0.85
mbbuf_get_saved_charFunction · 0.85
skip_whitespace_runFunction · 0.85
scan_mb_delim_fieldFunction · 0.85
cut_characters_modeFunction · 0.85

Calls 1

mbbuf_fillFunction · 0.85

Tested by

no test coverage detected