* Note: takes ownership of 'path', which happens to be what the only * caller needs. */
| 288 | * caller needs. |
| 289 | */ |
| 290 | static void line_log_data_insert(struct line_log_data **list, |
| 291 | char *path, |
| 292 | long begin, long end) |
| 293 | { |
| 294 | struct line_log_data *ip; |
| 295 | struct line_log_data *p = search_line_log_data(*list, path, &ip); |
| 296 | |
| 297 | if (p) { |
| 298 | range_set_append_unsafe(&p->ranges, begin, end); |
| 299 | free(path); |
| 300 | return; |
| 301 | } |
| 302 | |
| 303 | CALLOC_ARRAY(p, 1); |
| 304 | p->path = path; |
| 305 | range_set_append(&p->ranges, begin, end); |
| 306 | if (ip) { |
| 307 | p->next = ip->next; |
| 308 | ip->next = p; |
| 309 | } else { |
| 310 | p->next = *list; |
| 311 | *list = p; |
| 312 | } |
| 313 | } |
| 314 | |
| 315 | struct collect_diff_cbdata { |
| 316 | struct diff_ranges *diff; |
no test coverage detected