Lines Matching full:a_buf
97 struct abbr_buf a_buf;
101 static void add_line_to_abbr_buf(struct abbr_buf *a_buf, char *linebuf, int linelen);
178 add_line_to_abbr_buf(&log_info->a_buf, line, len);
220 static void init_abbr_buf(struct abbr_buf *a_buf) {
223 memset(a_buf, 0, sizeof(struct abbr_buf));
226 a_buf->b_buf.buf = new_buf;
227 a_buf->b_buf.alloc_len = BEGINNING_BUF_SIZE;
228 a_buf->b_buf.buf_size = BEGINNING_BUF_SIZE - 1;
232 a_buf->e_buf.buf = new_buf;
233 a_buf->e_buf.alloc_len = ENDING_BUF_SIZE;
234 a_buf->e_buf.buf_size = ENDING_BUF_SIZE - 1;
238 static void free_abbr_buf(struct abbr_buf *a_buf) {
239 free(a_buf->b_buf.buf);
240 free(a_buf->e_buf.buf);
243 static void add_line_to_abbr_buf(struct abbr_buf *a_buf, char *linebuf, int linelen) {
244 if (!a_buf->beginning_buf_full) {
245 a_buf->beginning_buf_full =
246 add_line_to_linear_buf(&a_buf->b_buf, linebuf, linelen);
248 if (a_buf->beginning_buf_full) {
249 add_line_to_circular_buf(&a_buf->e_buf, linebuf, linelen);
254 struct abbr_buf *a_buf = &log_info->a_buf;
257 if (a_buf->b_buf.alloc_len) {
258 print_buf_lines(log_info, a_buf->b_buf.buf, a_buf->b_buf.used_len);
264 if (a_buf->e_buf.used_len == a_buf->e_buf.buf_size) {
268 if (a_buf->e_buf.used_len == 0) {
275 if (a_buf->e_buf.read < a_buf->e_buf.write) {
277 print_buf_lines(log_info, a_buf->e_buf.buf + a_buf->e_buf.read,
278 a_buf->e_buf.used_len);
284 char * nbuf = malloc(a_buf->e_buf.alloc_len);
288 int first_chunk_len = a_buf->e_buf.buf_size - a_buf->e_buf.read;
289 memcpy(nbuf, a_buf->e_buf.buf + a_buf->e_buf.read, first_chunk_len);
291 memcpy(nbuf + first_chunk_len, a_buf->e_buf.buf, a_buf->e_buf.write);
292 print_buf_lines(log_info, nbuf, first_chunk_len + a_buf->e_buf.write);
327 init_abbr_buf(&log_info.a_buf);
462 free_abbr_buf(&log_info.a_buf);