Cleanup the Mac build

- use strlen instead of strnlen
- extern the circular buffer constants in the header