293 // local prefix table |
293 // local prefix table |
294 size_t s_prefix_table[CX_STRSTR_SBO_SIZE]; |
294 size_t s_prefix_table[CX_STRSTR_SBO_SIZE]; |
295 |
295 |
296 // check needle length and use appropriate prefix table |
296 // check needle length and use appropriate prefix table |
297 // if the pattern exceeds static prefix table, allocate on the heap |
297 // if the pattern exceeds static prefix table, allocate on the heap |
298 bool useheap = needle.length >= CX_STRSTR_SBO_SIZE; |
298 const bool useheap = needle.length >= CX_STRSTR_SBO_SIZE; |
299 register size_t *ptable = useheap ? calloc(needle.length + 1, |
299 register size_t *ptable = useheap ? calloc(needle.length + 1, |
300 sizeof(size_t)) : s_prefix_table; |
300 sizeof(size_t)) : s_prefix_table; |
301 |
301 |
302 // keep counter in registers |
302 // keep counter in registers |
303 register size_t i, j; |
303 register size_t i, j; |