| 733 | } |
| 734 | |
| 735 | static struct attr_stack *read_attr_from_buf(char *buf, size_t length, |
| 736 | const char *path, unsigned flags) |
| 737 | { |
| 738 | struct attr_stack *res; |
| 739 | char *sp; |
| 740 | int lineno = 0; |
| 741 | |
| 742 | if (!buf) |
| 743 | return NULL; |
| 744 | if (length >= ATTR_MAX_FILE_SIZE) { |
| 745 | warning(_("ignoring overly large gitattributes blob '%s'"), path); |
| 746 | free(buf); |
| 747 | return NULL; |
| 748 | } |
| 749 | |
| 750 | CALLOC_ARRAY(res, 1); |
| 751 | for (sp = buf; *sp;) { |
| 752 | char *ep; |
| 753 | int more; |
| 754 | |
| 755 | ep = strchrnul(sp, '\n'); |
| 756 | more = (*ep == '\n'); |
| 757 | *ep = '\0'; |
| 758 | handle_attr_line(res, sp, path, ++lineno, flags); |
| 759 | sp = ep + more; |
| 760 | } |
| 761 | free(buf); |
| 762 | |
| 763 | return res; |
| 764 | } |
| 765 | |
| 766 | static struct attr_stack *read_attr_from_blob(struct index_state *istate, |
| 767 | const struct object_id *tree_oid, |
no test coverage detected