You don't use this option for a null-terminated to_compare. I think you should either remove the len paramter , which works with the static string comparisons you're using now, or always require it, and remove this fallback.