Changeset 486


Ignore:
Timestamp:
Jul 30, 2003, 8:12:12 PM (22 years ago)
Author:
bird
Message:

removed last revision (wrong commit).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/src/emxomf/grow.c

    • Property cvs2svn:cvs-rev changed from 1.2 to 1.3
    r485 r486  
    332332  return strpool_addn (p, s, strlen (s));
    333333}
    334 
    335 
    336 /* Add the string S of LEN characters to the string pool P.  The
    337    string must not contain null characters. A pointer to a string of
    338    the string pool is returned.  If a string identical to S already
    339    exists in the string pool, a pointer to that string is returned.
    340    Otherwise, a new string entry is added to the string pool. */
    341 
    342 const char *strpool_look (struct strpool *p, const char *s, int len)
    343 {
    344   unsigned hash;
    345   int i;
    346   struct string *v;
    347 
    348   hash = 0;
    349   for (i = 0; i < len; ++i)
    350     hash = hash * 65599 + s[i];
    351   hash %= STRPOOL_HASH_SIZE;
    352   for (v = p->table[hash]; v != NULL; v = v->next)
    353     if (strlen (v->string) == len && memcmp (v->string, s, len) == 0)
    354       return v->string;
    355   v = xmalloc (sizeof (*v) + len);
    356   memcpy (v->string, s, len);
    357   v->string[len] = 0;
    358   v->next = p->table[hash];
    359   p->table[hash] = v;
    360   return v->string;
    361 }
    362 
Note: See TracChangeset for help on using the changeset viewer.