MCPcopy Create free account
hub / github.com/defold/defold / buffer_get

Function buffer_get

engine/script/src/luasocket/buffer.c:259–272  ·  view source on GitHub ↗

-------------------------------------------------------------------------*\ * Return any data available in buffer, or get more data from transport layer * if buffer is empty \*-------------------------------------------------------------------------*/

Source from the content-addressed store, hash-verified

257* if buffer is empty
258\*-------------------------------------------------------------------------*/
259static int buffer_get(p_buffer buf, const char **data, size_t *count) {
260 int err = IO_DONE;
261 p_io io = buf->io;
262 p_timeout tm = buf->tm;
263 if (buffer_isempty(buf)) {
264 size_t got;
265 err = io->recv(io->ctx, buf->data, BUF_SIZE, &got, tm);
266 buf->first = 0;
267 buf->last = got;
268 }
269 *count = buf->last - buf->first;
270 *data = buf->data + buf->first;
271 return err;
272}

Callers 3

recvrawFunction · 0.85
recvallFunction · 0.85
recvlineFunction · 0.85

Calls 1

buffer_isemptyFunction · 0.85

Tested by

no test coverage detected