Esempio n. 1
0
static struct symbol *
iter_name_next_linear (const char *name, struct dict_iterator *iterator)
{
  const struct dictionary *dict = DICT_ITERATOR_DICT (iterator);
  int i, nsyms = DICT_LINEAR_NSYMS (dict);
  struct symbol *sym, *retval = NULL;

  for (i = DICT_ITERATOR_INDEX (iterator) + 1; i < nsyms; ++i)
    {
      sym = DICT_LINEAR_SYM (dict, i);
      /* APPLE LOCAL begin psym equivalences  */
      if ((strcmp_iw (SYMBOL_SEARCH_NAME (sym), name) == 0)
	  || (psym_equivalences
	      && psym_name_match (SYMBOL_SEARCH_NAME (sym), name)))
      /* APPLE LOCAL end psym equivalences  */
	{
	  retval = sym;
	  break;
	}
    }

  DICT_ITERATOR_INDEX (iterator) = i;
  
  return retval;
}
Esempio n. 2
0
static struct symbol *
iter_name_first_hashed (const struct dictionary *dict,
			const char *name,
			struct dict_iterator *iterator)
{
  unsigned int hash_index
    = msymbol_hash_iw (name) % DICT_HASHED_NBUCKETS (dict);
  struct symbol *sym;

  DICT_ITERATOR_DICT (iterator) = dict;

  /* Loop through the symbols in the given bucket, breaking when SYM
     first matches.  If SYM never matches, it will be set to NULL;
     either way, we have the right return value.  */
  
  for (sym = DICT_HASHED_BUCKET (dict, hash_index);
       sym != NULL;
       sym = sym->hash_next)
    {
      /* Warning: the order of arguments to strcmp_iw matters!  */
      if (strcmp_iw (SYMBOL_SEARCH_NAME (sym), name) == 0)
	{
	  break;
	}
	
    }

  DICT_ITERATOR_CURRENT (iterator) = sym;
  return sym;
}
Esempio n. 3
0
static struct symbol *
iter_name_next_hashed (const char *name, struct dict_iterator *iterator)
{
  struct symbol *next;

  for (next = DICT_ITERATOR_CURRENT (iterator)->hash_next;
       next != NULL;
       next = next->hash_next)
    {
      if (strcmp_iw (SYMBOL_SEARCH_NAME (next), name) == 0)
	break;
    }

  DICT_ITERATOR_CURRENT (iterator) = next;

  return next;
}
Esempio n. 4
0
static struct symbol *
iter_name_next_linear (const char *name, struct dict_iterator *iterator)
{
  const struct dictionary *dict = DICT_ITERATOR_DICT (iterator);
  int i, nsyms = DICT_LINEAR_NSYMS (dict);
  struct symbol *sym, *retval = NULL;

  for (i = DICT_ITERATOR_INDEX (iterator) + 1; i < nsyms; ++i)
    {
      sym = DICT_LINEAR_SYM (dict, i);
      if (strcmp_iw (SYMBOL_SEARCH_NAME (sym), name) == 0)
	{
	  retval = sym;
	  break;
	}
    }

  DICT_ITERATOR_INDEX (iterator) = i;
  
  return retval;
}
Esempio n. 5
0
static struct symbol *
iter_name_next_hashed (const char *name, struct dict_iterator *iterator)
{
  struct symbol *next;

  for (next = DICT_ITERATOR_CURRENT (iterator)->hash_next;
       next != NULL;
       next = next->hash_next)
    {
      /* APPLE LOCAL begin psym equivalences  */
      if ((strcmp_iw (SYMBOL_SEARCH_NAME (next), name) == 0)
	  || (psym_equivalences
	      && psym_name_match (SYMBOL_SEARCH_NAME (next), name)))
      /* APPLE LOCAL end psym equivalences  */
	break;
    }

  DICT_ITERATOR_CURRENT (iterator) = next;

  return next;
}