/* Splits the given string into segments. You should call one of the macros coap_split_path() or coap_split_query() instead. */
static size_t coap_split_path_impl(const unsigned char *s, size_t length, segment_handler_t h, void *data)
/* Splits the given string into segments. You should call one of the macros coap_split_path() or coap_split_query() instead. */
static size_t coap_split_path_impl(const unsigned char *s, size_t length, segment_handler_t h, void *data)
{
  const unsigned char *p, *q;
  p = q = s;
  while (length > 0 && !strnchr((unsigned char *)"?#", 2, *q)) {
    if (*q == '/') {
      if (!dots((unsigned char *)p, q - p)) {
	h((unsigned char *)p, q - p, data);
      }
      p = q + 1;
    }
    q++;
    length--;
  }
  if (!dots((unsigned char *)p, q - p)) {
    h((unsigned char *)p, q - p, data);
  }
  return q - s;
}