| 462 | } |
| 463 | |
| 464 | static char *find_name_gnu(struct strbuf *root, |
| 465 | const char *line, |
| 466 | int p_value) |
| 467 | { |
| 468 | struct strbuf name = STRBUF_INIT; |
| 469 | char *cp; |
| 470 | |
| 471 | /* |
| 472 | * Proposed "new-style" GNU patch/diff format; see |
| 473 | * https://lore.kernel.org/git/7vll0wvb2a.fsf@assigned-by-dhcp.cox.net/ |
| 474 | */ |
| 475 | if (unquote_c_style(&name, line, NULL)) { |
| 476 | strbuf_release(&name); |
| 477 | return NULL; |
| 478 | } |
| 479 | |
| 480 | for (cp = name.buf; p_value; p_value--) { |
| 481 | cp = strchr(cp, '/'); |
| 482 | if (!cp) { |
| 483 | strbuf_release(&name); |
| 484 | return NULL; |
| 485 | } |
| 486 | cp++; |
| 487 | } |
| 488 | |
| 489 | strbuf_remove(&name, 0, cp - name.buf); |
| 490 | if (root->len) |
| 491 | strbuf_insert(&name, 0, root->buf, root->len); |
| 492 | return squash_slash(strbuf_detach(&name, NULL)); |
| 493 | } |
| 494 | |
| 495 | static size_t sane_tz_len(const char *line, size_t len) |
| 496 | { |
no test coverage detected