+ if (comps > url_max_occurences)
+ {
+ hash_size = next_table_prime(comps);
+ hash = alloca(hash_size * sizeof(*hash));
+ next = alloca(comps * sizeof(*next));
+ memset(hash, 255, hash_size * sizeof(*hash));
+ for (i=0; i<comps; i++)
+ {
+ j = comp[i].hash % hash_size;
+ for (k = hash[j]; ~k && (comp[i].hash != comp[k].hash || comp[i].length != comp[k].length ||
+ memcmp(comp[k].start, comp[i].start, comp[i].length)); k = next[k]);
+ if (!~k)
+ {
+ next[i] = hash[j];
+ hash[j] = i;
+ comp[i].count = 1;
+ }
+ else
+ {
+ if (comp[k].count++ >= url_max_occurences)
+ return 1;
+ }
+ }
+ }