Deleted Added
full compact
hash.c (78828) hash.c (89857)
1/* hash.c -- hash table routines for BFD
2 Copyright 1993, 1994, 1995, 1997, 1999, 2001
3 Free Software Foundation, Inc.
4 Written by Steve Chamberlain <sac@cygnus.com>
5
6This file is part of BFD, the Binary File Descriptor library.
7
8This program is free software; you can redistribute it and/or modify

--- 568 unchanged lines hidden (view full) ---

577 bfd_hash_lookup (&(t)->table, (string), (create), (copy)))
578
579/* Create a new strtab. */
580
581struct bfd_strtab_hash *
582_bfd_stringtab_init ()
583{
584 struct bfd_strtab_hash *table;
1/* hash.c -- hash table routines for BFD
2 Copyright 1993, 1994, 1995, 1997, 1999, 2001
3 Free Software Foundation, Inc.
4 Written by Steve Chamberlain <sac@cygnus.com>
5
6This file is part of BFD, the Binary File Descriptor library.
7
8This program is free software; you can redistribute it and/or modify

--- 568 unchanged lines hidden (view full) ---

577 bfd_hash_lookup (&(t)->table, (string), (create), (copy)))
578
579/* Create a new strtab. */
580
581struct bfd_strtab_hash *
582_bfd_stringtab_init ()
583{
584 struct bfd_strtab_hash *table;
585 bfd_size_type amt = sizeof (struct bfd_strtab_hash);
585
586
586 table = ((struct bfd_strtab_hash *)
587 bfd_malloc (sizeof (struct bfd_strtab_hash)));
587 table = (struct bfd_strtab_hash *) bfd_malloc (amt);
588 if (table == NULL)
589 return NULL;
590
591 if (! bfd_hash_table_init (&table->table, strtab_hash_newfunc))
592 {
593 free (table);
594 return NULL;
595 }

--- 110 unchanged lines hidden (view full) ---

706{
707 register boolean xcoff;
708 register struct strtab_hash_entry *entry;
709
710 xcoff = tab->xcoff;
711
712 for (entry = tab->first; entry != NULL; entry = entry->next)
713 {
588 if (table == NULL)
589 return NULL;
590
591 if (! bfd_hash_table_init (&table->table, strtab_hash_newfunc))
592 {
593 free (table);
594 return NULL;
595 }

--- 110 unchanged lines hidden (view full) ---

706{
707 register boolean xcoff;
708 register struct strtab_hash_entry *entry;
709
710 xcoff = tab->xcoff;
711
712 for (entry = tab->first; entry != NULL; entry = entry->next)
713 {
714 register const char *str;
715 register size_t len;
714 const char *str;
715 size_t len;
716
717 str = entry->root.string;
718 len = strlen (str) + 1;
719
720 if (xcoff)
721 {
722 bfd_byte buf[2];
723
724 /* The output length includes the null byte. */
716
717 str = entry->root.string;
718 len = strlen (str) + 1;
719
720 if (xcoff)
721 {
722 bfd_byte buf[2];
723
724 /* The output length includes the null byte. */
725 bfd_put_16 (abfd, len, buf);
726 if (bfd_write ((PTR) buf, 1, 2, abfd) != 2)
725 bfd_put_16 (abfd, (bfd_vma) len, buf);
726 if (bfd_bwrite ((PTR) buf, (bfd_size_type) 2, abfd) != 2)
727 return false;
728 }
729
727 return false;
728 }
729
730 if (bfd_write ((PTR) str, 1, len, abfd) != len)
730 if (bfd_bwrite ((PTR) str, (bfd_size_type) len, abfd) != len)
731 return false;
732 }
733
734 return true;
735}
731 return false;
732 }
733
734 return true;
735}