Home | History | Annotate | Download | only in logwrapper

Lines Matching full:e_buf

86     struct ending_buf e_buf;
120 static void add_line_to_circular_buf(struct ending_buf *e_buf,
127 if (e_buf->buf == NULL) {
131 if (line_len > e_buf->buf_size) {
135 free_len = e_buf->buf_size - e_buf->used_len;
141 e_buf->read = (e_buf->read + needed_space) % e_buf->buf_size;
142 e_buf->used_len -= needed_space;
148 cnt = MIN(line_len, e_buf->buf_size - e_buf->write);
149 memcpy(e_buf->buf + e_buf->write, line, cnt);
151 memcpy(e_buf->buf, line + cnt, line_len - cnt);
153 e_buf->used_len += line_len;
154 e_buf->write = (e_buf->write + line_len) % e_buf->buf_size;
228 a_buf->e_buf.buf = new_buf;
229 a_buf->e_buf.alloc_len = ENDING_BUF_SIZE;
230 a_buf->e_buf.buf_size = ENDING_BUF_SIZE - 1;
236 free(a_buf->e_buf.buf);
245 add_line_to_circular_buf(&a_buf->e_buf, linebuf, linelen);
260 if (a_buf->e_buf.used_len == a_buf->e_buf.buf_size) {
264 if (a_buf->e_buf.used_len == 0) {
271 if (a_buf->e_buf.read < a_buf->e_buf.write) {
273 print_buf_lines(log_info, a_buf->e_buf.buf + a_buf->e_buf.read,
274 a_buf->e_buf.used_len);
280 char * nbuf = malloc(a_buf->e_buf.alloc_len);
284 int first_chunk_len = a_buf->e_buf.buf_size - a_buf->e_buf.read;
285 memcpy(nbuf, a_buf->e_buf.buf + a_buf->e_buf.read, first_chunk_len);
287 memcpy(nbuf + first_chunk_len, a_buf->e_buf.buf, a_buf->e_buf.write);
288 print_buf_lines(log_info, nbuf, first_chunk_len + a_buf->e_buf.write);