Logo Search packages:      
Sourcecode: bglibs version File versions

void str_buildmap ( int  map[256],
const char *  list 
)

Build a map from the list of characters.

Each byte in the output map contains either -1 if the corresponding character was not present in the input string, or the offset of the last instance of the character in the list.

Definition at line 27 of file buildmap.c.

Referenced by str_countof(), str_findnextof(), and str_findprevof().

{
  unsigned i;
  for (i = 0; i < 256; i++)
    map[i] = -1;
  for (i = 0; *list; i++, list++)
    map[*(unsigned char*)list] = i;
}


Generated by  Doxygen 1.6.0   Back to index