Esempio n. 1
0
//
// MetaKey
//
// If the given key string is already interned, the metakey_t structure that
// stores it will be returned. If not, it will be added to the collection of
// keys and hashed by name.
//
static metakey_t &MetaKey(const char *key)
{
   metakey_t *keyObj;

   // Do we already have this key?
   if(!(keyObj = metaKeyHash.objectForKey(key)))
   {
      keyObj = &metaKeys.addNew();
      keyObj->key     = estrdup(key);
      keyObj->index   = metaKeys.getLength() - 1;
      keyObj->unmodHC = ENCStringHashKey::HashCode(key);

      // hash it
      metaKeyHash.addObject(keyObj, keyObj->unmodHC);
   }

   return *keyObj;
}