| 300 | of length LINE_LEN in the large buffer, in the lines buffer of B. */ |
| 301 | |
| 302 | static void |
| 303 | keep_new_line (struct buffer_record *b, char *line_start, idx_t line_len) |
| 304 | { |
| 305 | struct line *l; |
| 306 | |
| 307 | /* If there is no existing area to keep line info, get some. */ |
| 308 | if (b->line_start == NULL) |
| 309 | b->line_start = b->curr_line = new_line_control (); |
| 310 | |
| 311 | /* If existing area for lines is full, get more. */ |
| 312 | if (b->curr_line->used == CTRL_SIZE) |
| 313 | { |
| 314 | b->curr_line->next = new_line_control (); |
| 315 | b->curr_line = b->curr_line->next; |
| 316 | } |
| 317 | |
| 318 | l = b->curr_line; |
| 319 | |
| 320 | /* Record the start of the line, and update counters. */ |
| 321 | l->starts[l->insert_index].str = line_start; |
| 322 | l->starts[l->insert_index].len = line_len; |
| 323 | l->used++; |
| 324 | l->insert_index++; |
| 325 | } |
| 326 | |
| 327 | /* Scan the buffer in B for newline characters |
| 328 | and record the line start locations and lengths in B. |
no test coverage detected