MCPcopy Create free account
hub / github.com/git/git / is_hfs_dot_generic

Function is_hfs_dot_generic

utf8.c:741–773  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

739}
740
741static int is_hfs_dot_generic(const char *path,
742 const char *needle, size_t needle_len)
743{
744 ucs_char_t c;
745
746 c = next_hfs_char(&path);
747 if (c != '.')
748 return 0;
749
750 /*
751 * there's a great deal of other case-folding that occurs
752 * in HFS+, but this is enough to catch our fairly vanilla
753 * hard-coded needles.
754 */
755 for (; needle_len > 0; needle++, needle_len--) {
756 c = next_hfs_char(&path);
757
758 /*
759 * We know our needles contain only ASCII, so we clamp here to
760 * make the results of tolower() sane.
761 */
762 if (c > 127)
763 return 0;
764 if (tolower(c) != *needle)
765 return 0;
766 }
767
768 c = next_hfs_char(&path);
769 if (c && !is_dir_sep(c))
770 return 0;
771
772 return 1;
773}
774
775/*
776 * Inline wrapper to make sure the compiler resolves strlen() on literals at

Callers 1

is_hfs_dot_strFunction · 0.85

Calls 1

next_hfs_charFunction · 0.85

Tested by

no test coverage detected