Lines Matching refs:a_buf
96 struct abbr_buf a_buf;
100 static void add_line_to_abbr_buf(struct abbr_buf *a_buf, char *linebuf, int linelen);
173 add_line_to_abbr_buf(&log_info->a_buf, line, len);
215 static void init_abbr_buf(struct abbr_buf *a_buf) {
218 memset(a_buf, 0, sizeof(struct abbr_buf));
221 a_buf->b_buf.buf = new_buf;
222 a_buf->b_buf.alloc_len = BEGINNING_BUF_SIZE;
223 a_buf->b_buf.buf_size = BEGINNING_BUF_SIZE - 1;
227 a_buf->e_buf.buf = new_buf;
228 a_buf->e_buf.alloc_len = ENDING_BUF_SIZE;
229 a_buf->e_buf.buf_size = ENDING_BUF_SIZE - 1;
233 static void free_abbr_buf(struct abbr_buf *a_buf) {
234 free(a_buf->b_buf.buf);
235 free(a_buf->e_buf.buf);
238 static void add_line_to_abbr_buf(struct abbr_buf *a_buf, char *linebuf, int linelen) {
239 if (!a_buf->beginning_buf_full) {
240 a_buf->beginning_buf_full =
241 add_line_to_linear_buf(&a_buf->b_buf, linebuf, linelen);
243 if (a_buf->beginning_buf_full) {
244 add_line_to_circular_buf(&a_buf->e_buf, linebuf, linelen);
249 struct abbr_buf *a_buf = &log_info->a_buf;
252 if (a_buf->b_buf.alloc_len) {
253 print_buf_lines(log_info, a_buf->b_buf.buf, a_buf->b_buf.used_len);
259 if (a_buf->e_buf.used_len == a_buf->e_buf.buf_size) {
263 if (a_buf->e_buf.used_len == 0) {
270 if (a_buf->e_buf.read < a_buf->e_buf.write) {
272 print_buf_lines(log_info, a_buf->e_buf.buf + a_buf->e_buf.read,
273 a_buf->e_buf.used_len);
279 char * nbuf = malloc(a_buf->e_buf.alloc_len);
283 int first_chunk_len = a_buf->e_buf.buf_size - a_buf->e_buf.read;
284 memcpy(nbuf, a_buf->e_buf.buf + a_buf->e_buf.read, first_chunk_len);
286 memcpy(nbuf + first_chunk_len, a_buf->e_buf.buf, a_buf->e_buf.write);
287 print_buf_lines(log_info, nbuf, first_chunk_len + a_buf->e_buf.write);
323 init_abbr_buf(&log_info.a_buf);
436 free_abbr_buf(&log_info.a_buf);