/* Get the string length, limited to a given length  */
size_t sl_strnlen(char *str, size_t max_len)
/* Get the string length, limited to a given length  */
size_t sl_strnlen(char *str, size_t max_len)
{
  size_t len = 0;
  if (str == NULL) {
    return len;
  }
  while ((*str != '\0') && (len < max_len)) {
    str++;
    len++;
  }
  return len;
}