Logo Search packages:      
Sourcecode: bglibs version File versions

unsigned str_countof ( const str s,
const char *  list 
)

Count the number of instances of a list of characters

Definition at line 21 of file countof.c.

References s, and str_buildmap().

{
  const char* ptr;
  unsigned pos;
  unsigned count;
  int map[256];
  
  str_buildmap(map, list);
  count = 0;
  for (pos = 0, ptr = s->s; pos < s->len; ++ptr, ++pos)
    if (map[*(unsigned char*)ptr] >= 0) ++count;
  return count;
}


Generated by  Doxygen 1.6.0   Back to index