Lines Matching full:tail
16 /* set mb->head and mb->tail so the buffers look empty */ in membuff_purge()
18 mb->tail = mb->start; in membuff_purge()
36 * if head is ahead of tail, we can write from head until the end of in membuff_putrawflex()
39 if (mb->head >= mb->tail) { in membuff_putrawflex()
50 * if the tail isn't at start of the buffer, then we can in membuff_putrawflex()
53 if ((maxlen < 0 || len < maxlen) && mb->tail != mb->start) { in membuff_putrawflex()
59 /* otherwise now we can write until head almost reaches tail */ in membuff_putrawflex()
62 len = mb->tail - mb->head - 1; in membuff_putrawflex()
106 * in this case head is ahead of tail, so we must return data between in membuff_getraw()
107 *'tail' and 'head' in membuff_getraw()
109 if (mb->head > mb->tail) { in membuff_getraw()
111 *data = mb->tail; in membuff_getraw()
112 len = mb->head - mb->tail; in membuff_getraw()
120 mb->tail += len; in membuff_getraw()
124 * if head is before tail, then we have data between 'tail' and 'end' in membuff_getraw()
128 else if (mb->head < mb->tail) { in membuff_getraw()
130 *data = mb->tail; in membuff_getraw()
131 len = mb->end - mb->tail; in membuff_getraw()
135 mb->tail += len; in membuff_getraw()
136 if (mb->tail == mb->end) in membuff_getraw()
137 mb->tail = mb->start; in membuff_getraw()
141 debug("getraw: maxlen=%d, update=%d, head=%d, tail=%d, data=%d, len=%d", in membuff_getraw()
143 (int)(mb->tail - mb->start), (int)(*data - mb->start), len); in membuff_getraw()
208 return mb->head == mb->tail; in membuff_isempty()
237 debug("makecontig: head=%d, tail=%d, size=%d", in membuff_makecontig()
238 (int)(mb->head - mb->start), (int)(mb->tail - mb->start), in membuff_makecontig()
245 if (mb->tail > mb->head) { in membuff_makecontig()
248 * from ->tail to ->end. We move the stuff from 0 to ->head in membuff_makecontig()
251 topsize = mb->end - mb->tail; in membuff_makecontig()
258 if (mb->head + topsize >= mb->tail) in membuff_makecontig()
265 topsize = mb->head - mb->tail; in membuff_makecontig()
270 memcpy(mb->start, mb->tail, topsize); in membuff_makecontig()
271 debug(" - memcpy(%d, %d, %d)", 0, (int)(mb->tail - mb->start), topsize); in membuff_makecontig()
274 mb->tail = mb->start; in membuff_makecontig()
277 debug(" - head=%d, tail=%d", (int)(mb->head - mb->start), in membuff_makecontig()
278 (int)(mb->tail - mb->start)); in membuff_makecontig()
297 end = mb->head >= mb->tail ? mb->head : mb->end; in membuff_readline()
298 for (len = 0, s = mb->tail; s < end && len < maxlen - 1; str++) { in membuff_readline()
305 if (s == end && mb->tail > mb->head) { in membuff_readline()
320 mb->tail = s == mb->end ? mb->start : s; in membuff_readline()
344 oldtail = mb->tail - mb->start; in membuff_extend_by()
350 mb->tail = mb->start + oldtail; in membuff_extend_by()
352 if (mb->head < mb->tail) { in membuff_extend_by()
353 memmove(mb->tail + by, mb->tail, orig - oldtail); in membuff_extend_by()
354 mb->tail += by; in membuff_extend_by()