OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-6.8/] [bfd/] [elf-strtab.c] - Diff between revs 157 and 225

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

Rev 157 Rev 225
Line 66... Line 66...
                         const char *string)
                         const char *string)
{
{
  /* Allocate the structure if it has not already been allocated by a
  /* Allocate the structure if it has not already been allocated by a
     subclass.  */
     subclass.  */
  if (entry == NULL)
  if (entry == NULL)
    entry = bfd_hash_allocate (table, sizeof (struct elf_strtab_hash_entry));
    entry = (struct bfd_hash_entry *)
 
        bfd_hash_allocate (table, sizeof (struct elf_strtab_hash_entry));
  if (entry == NULL)
  if (entry == NULL)
    return NULL;
    return NULL;
 
 
  /* Call the allocation method of the superclass.  */
  /* Call the allocation method of the superclass.  */
  entry = bfd_hash_newfunc (entry, table, string);
  entry = bfd_hash_newfunc (entry, table, string);
Line 95... Line 96...
_bfd_elf_strtab_init (void)
_bfd_elf_strtab_init (void)
{
{
  struct elf_strtab_hash *table;
  struct elf_strtab_hash *table;
  bfd_size_type amt = sizeof (struct elf_strtab_hash);
  bfd_size_type amt = sizeof (struct elf_strtab_hash);
 
 
  table = bfd_malloc (amt);
  table = (struct elf_strtab_hash *) bfd_malloc (amt);
  if (table == NULL)
  if (table == NULL)
    return NULL;
    return NULL;
 
 
  if (!bfd_hash_table_init (&table->table, elf_strtab_hash_newfunc,
  if (!bfd_hash_table_init (&table->table, elf_strtab_hash_newfunc,
                            sizeof (struct elf_strtab_hash_entry)))
                            sizeof (struct elf_strtab_hash_entry)))
Line 110... Line 111...
 
 
  table->sec_size = 0;
  table->sec_size = 0;
  table->size = 1;
  table->size = 1;
  table->alloced = 64;
  table->alloced = 64;
  amt = sizeof (struct elf_strtab_hasn_entry *);
  amt = sizeof (struct elf_strtab_hasn_entry *);
  table->array = bfd_malloc (table->alloced * amt);
  table->array = (struct elf_strtab_hash_entry **)
 
      bfd_malloc (table->alloced * amt);
  if (table->array == NULL)
  if (table->array == NULL)
    {
    {
      free (table);
      free (table);
      return NULL;
      return NULL;
    }
    }
Line 164... Line 166...
      BFD_ASSERT (entry->len > 0);
      BFD_ASSERT (entry->len > 0);
      if (tab->size == tab->alloced)
      if (tab->size == tab->alloced)
        {
        {
          bfd_size_type amt = sizeof (struct elf_strtab_hash_entry *);
          bfd_size_type amt = sizeof (struct elf_strtab_hash_entry *);
          tab->alloced *= 2;
          tab->alloced *= 2;
          tab->array = bfd_realloc_or_free (tab->array, tab->alloced * amt);
          tab->array = (struct elf_strtab_hash_entry **)
 
              bfd_realloc_or_free (tab->array, tab->alloced * amt);
          if (tab->array == NULL)
          if (tab->array == NULL)
            return (bfd_size_type) -1;
            return (bfd_size_type) -1;
        }
        }
 
 
      entry->u.index = tab->size++;
      entry->u.index = tab->size++;
Line 309... Line 312...
     cycles.  */
     cycles.  */
  size_t i;
  size_t i;
 
 
  /* Sort the strings by suffix and length.  */
  /* Sort the strings by suffix and length.  */
  amt = tab->size * sizeof (struct elf_strtab_hash_entry *);
  amt = tab->size * sizeof (struct elf_strtab_hash_entry *);
  array = bfd_malloc (amt);
  array = (struct elf_strtab_hash_entry **) bfd_malloc (amt);
  if (array == NULL)
  if (array == NULL)
    goto alloc_failure;
    goto alloc_failure;
 
 
  for (i = 1, a = array; i < tab->size; ++i)
  for (i = 1, a = array; i < tab->size; ++i)
    {
    {

powered by: WebSVN 2.1.0

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