Lines Matching refs:e_buf

89     struct ending_buf e_buf;  member
121 static void add_line_to_circular_buf(struct ending_buf* e_buf, char* line, ssize_t line_len) { in add_line_to_circular_buf() argument
126 if (e_buf->buf == nullptr) { in add_line_to_circular_buf()
130 if (line_len > e_buf->buf_size) { in add_line_to_circular_buf()
134 free_len = e_buf->buf_size - e_buf->used_len; in add_line_to_circular_buf()
140 e_buf->read = (e_buf->read + needed_space) % e_buf->buf_size; in add_line_to_circular_buf()
141 e_buf->used_len -= needed_space; in add_line_to_circular_buf()
147 cnt = std::min(line_len, e_buf->buf_size - e_buf->write); in add_line_to_circular_buf()
148 memcpy(e_buf->buf + e_buf->write, line, cnt); in add_line_to_circular_buf()
150 memcpy(e_buf->buf, line + cnt, line_len - cnt); in add_line_to_circular_buf()
152 e_buf->used_len += line_len; in add_line_to_circular_buf()
153 e_buf->write = (e_buf->write + line_len) % e_buf->buf_size; in add_line_to_circular_buf()
226 a_buf->e_buf.buf = new_buf; in init_abbr_buf()
227 a_buf->e_buf.alloc_len = ENDING_BUF_SIZE; in init_abbr_buf()
228 a_buf->e_buf.buf_size = ENDING_BUF_SIZE - 1; in init_abbr_buf()
234 free(a_buf->e_buf.buf); in free_abbr_buf()
242 add_line_to_circular_buf(&a_buf->e_buf, linebuf, linelen); in add_line_to_abbr_buf()
257 if (a_buf->e_buf.used_len == a_buf->e_buf.buf_size) { in print_abbr_buf()
261 if (a_buf->e_buf.used_len == 0) { in print_abbr_buf()
268 if (a_buf->e_buf.read < a_buf->e_buf.write) { in print_abbr_buf()
270 print_buf_lines(log_info, a_buf->e_buf.buf + a_buf->e_buf.read, a_buf->e_buf.used_len); in print_abbr_buf()
276 char* nbuf = static_cast<char*>(malloc(a_buf->e_buf.alloc_len)); in print_abbr_buf()
280 int first_chunk_len = a_buf->e_buf.buf_size - a_buf->e_buf.read; in print_abbr_buf()
281 memcpy(nbuf, a_buf->e_buf.buf + a_buf->e_buf.read, first_chunk_len); in print_abbr_buf()
283 memcpy(nbuf + first_chunk_len, a_buf->e_buf.buf, a_buf->e_buf.write); in print_abbr_buf()
284 print_buf_lines(log_info, nbuf, first_chunk_len + a_buf->e_buf.write); in print_abbr_buf()