| 1743 | */ |
| 1744 | |
| 1745 | static ulong get_sort(uint count,...) |
| 1746 | { |
| 1747 | va_list args; |
| 1748 | va_start(args,count); |
| 1749 | ulong sort=0; |
| 1750 | |
| 1751 | /* Should not use this function with more than 4 arguments for compare. */ |
| 1752 | DBUG_ASSERT(count <= 4); |
| 1753 | |
| 1754 | while (count--) |
| 1755 | { |
| 1756 | char *start, *str= va_arg(args,char*); |
| 1757 | uint chars= 0; |
| 1758 | uint wild_pos= 0; |
| 1759 | |
| 1760 | /* |
| 1761 | wild_pos |
| 1762 | 0 if string is empty |
| 1763 | 1 if string is a single muilt-wildcard |
| 1764 | character('%') |
| 1765 | first wildcard position + 1 if string containg wildcards and |
| 1766 | non-wildcard characters |
| 1767 | */ |
| 1768 | |
| 1769 | if ((start= str)) |
| 1770 | { |
| 1771 | for (; *str ; str++) |
| 1772 | { |
| 1773 | if (*str == wild_prefix && str[1]) |
| 1774 | str++; |
| 1775 | else if (*str == wild_many || *str == wild_one) |
| 1776 | { |
| 1777 | wild_pos= (uint) (str - start) + 1; |
| 1778 | if (!(wild_pos == 1 && *str == wild_many && *(++str) == '\0')) |
| 1779 | wild_pos++; |
| 1780 | break; |
| 1781 | } |
| 1782 | chars= 128; // Marker that chars existed |
| 1783 | } |
| 1784 | } |
| 1785 | sort= (sort << 8) + (wild_pos ? min(wild_pos, 127U) : chars); |
| 1786 | } |
| 1787 | va_end(args); |
| 1788 | return sort; |
| 1789 | } |
| 1790 | |
| 1791 | |
| 1792 | static int acl_compare(ACL_ACCESS *a,ACL_ACCESS *b) |
no outgoing calls
no test coverage detected