All pastes #385017 Raw Edit

Untitled

public text v1 · immutable
·published 2007-03-07 15:07 UTC
rendered paste body
char *constmap(cm,s,len)
struct constmap *cm;
char *s;
int len;
{
  constmap_hash h;
  int pos;
  h = hash(s,len);
  pos = cm->first[h & cm->mask];
  while (pos != -1) {
    if (h == cm->hash[pos])
      if (len == cm->inputlen[pos])
        if (!case_diffb(cm->input[pos],len,s))
	  return cm->input[pos] + cm->inputlen[pos] + 1;
    pos = cm->next[pos];
  }
  return 0;
}