Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
bgColor#FFcccc
size_t count_whitespace(char const *s, size_t length) {
  char const *t = s;

  /* possibly *t < 0 */
  while (isspace(*t) && (t - s < length))  /* possibly *t < 0 */
    ++t;
  return t - s;
}

Compliant Solution (Unsigned Char)

...

Code Block
bgColor#ccccff
size_t count_whitespace(
  const unsigned char *s, 
  size_t length) 
{
  const unsigned char *t = s;
  while (isspace(*t) && (t - s < length))
    ++t;
  return t - s;
}

...

Code Block
bgColor#ccccff
size_t count_whitespace(
  char const *s, 
  size_t length) 
{
  char const *t = s;
  while (isspace((unsigned char)*t) && (t - s < length))
    ++t;
  return t - s;
}

...