MCPcopy Create free account
hub / github.com/apache/httpd / char_buffer_read

Function char_buffer_read

modules/ssl/ssl_engine_io.c:348–369  ·  view source on GitHub ↗

Copy up to INL bytes from the char_buffer BUFFER into IN. Note * that due to the strange way this API is designed/used, the * char_buffer object is used to cache a segment of inctx->buffer, and * then this function called to copy (part of) that segment to the * beginning of inctx->buffer. So the segments to copy cannot be * presumed to be non-overlapping, and memmove must be used. */

Source from the content-addressed store, hash-verified

346 * beginning of inctx->buffer. So the segments to copy cannot be
347 * presumed to be non-overlapping, and memmove must be used. */
348static int char_buffer_read(char_buffer_t *buffer, char *in, int inl)
349{
350 if (!buffer->length) {
351 return 0;
352 }
353
354 if (buffer->length > inl) {
355 /* we have enough to fill the caller's buffer */
356 memmove(in, buffer->value, inl);
357 buffer->value += inl;
358 buffer->length -= inl;
359 }
360 else {
361 /* swallow remainder of the buffer */
362 memmove(in, buffer->value, buffer->length);
363 inl = buffer->length;
364 buffer->value = NULL;
365 buffer->length = 0;
366 }
367
368 return inl;
369}
370
371static int char_buffer_write(char_buffer_t *buffer, char *in, int inl)
372{

Callers 1

ssl_io_input_readFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected