OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [or1ksim/] [cpu/] [common/] [labels.c] - Diff between revs 19 and 100

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 19 Rev 100
Line 57... Line 57...
void
void
add_label (oraddr_t addr, char *name)
add_label (oraddr_t addr, char *name)
{
{
  struct label_entry **tmp;
  struct label_entry **tmp;
  tmp = &(label_hash[addr % LABELS_HASH_SIZE]);
  tmp = &(label_hash[addr % LABELS_HASH_SIZE]);
  for (; *tmp; tmp = &((*tmp)->next));
  for (; *tmp; tmp = &((*tmp)->next)); // Find the next NULL label entry pointer (loop while the pointer de-refernce is non-NULL)
  *tmp = malloc (sizeof (**tmp));
  *tmp = malloc (sizeof (**tmp)); // allocate space for the pointer to the hash entry pointer
  (*tmp)->name = malloc (strlen (name) + 1);
  (*tmp)->name = malloc (strlen (name) + 1); // now allocate space for the name string
  (*tmp)->addr = addr;
  (*tmp)->addr = addr;
  strcpy ((*tmp)->name, name);
  strcpy ((*tmp)->name, name);
  (*tmp)->next = NULL;
  (*tmp)->next = NULL;
}
}
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.