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