This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[vms/committed]: split add_symbol in two


Hi,

this is preliminary work.  The function add_symbol is split in two to make the difference between adding
a new vms symbol to the bfd and creating one from a string.  The later uses to former to add the symbol.

Tristan.

bfd/
2010-05-24  Tristan Gingold  <gingold@adacore.com>

	* vms-alpha.c (add_symbol_entry): New function extrated from ...
	(add_symbol): ... adjusted.

diff -c -r1.14 vms-alpha.c
*** bfd/vms-alpha.c	24 May 2010 10:41:52 -0000	1.14
--- bfd/vms-alpha.c	24 May 2010 10:45:32 -0000
***************
*** 1043,1065 ****
    return section_flags[i].vflags_always;
  }
  
! /* Input routines.  */
  
! static struct vms_symbol_entry *
! add_symbol (bfd *abfd, const unsigned char *ascic)
  {
-   struct vms_symbol_entry *entry;
-   int len;
- 
-   len = *ascic++;
-   entry = (struct vms_symbol_entry *)bfd_zalloc (abfd, sizeof (*entry) + len);
-   if (entry == NULL)
-     return NULL;
-   entry->namelen = len;
-   memcpy (entry->name, ascic, len);
-   entry->name[len] = 0;
-   entry->owner = abfd;
- 
    if (PRIV (gsd_sym_count) >= PRIV (max_sym_count))
      {
        if (PRIV (max_sym_count) == 0)
--- 1043,1054 ----
    return section_flags[i].vflags_always;
  }
  
! /* Add SYM to the symbol table of ABFD.
!    Return FALSE in case of error.  */
  
! static bfd_boolean
! add_symbol_entry (bfd *abfd, struct vms_symbol_entry *sym)
  {
    if (PRIV (gsd_sym_count) >= PRIV (max_sym_count))
      {
        if (PRIV (max_sym_count) == 0)
***************
*** 1076,1085 ****
               (PRIV (max_sym_count) * sizeof (struct vms_symbol_entry *)));
          }
        if (PRIV (syms) == NULL)
!         return NULL;
      }
  
!   PRIV (syms)[PRIV (gsd_sym_count)++] = entry;
    return entry;
  }
  
--- 1065,1097 ----
               (PRIV (max_sym_count) * sizeof (struct vms_symbol_entry *)));
          }
        if (PRIV (syms) == NULL)
!         return FALSE;
      }
  
! 
! /* Create a symbol whose name is ASCIC and add it to ABFD.
!    Return NULL in case of error.  */
! 
! static struct vms_symbol_entry *
! add_symbol (bfd *abfd, const unsigned char *ascic)
! {
!   struct vms_symbol_entry *entry;
!   int len;
! 
!   len = *ascic++;
!   entry = (struct vms_symbol_entry *)bfd_zalloc (abfd, sizeof (*entry) + len);
!   if (entry == NULL)
!     return NULL;
!   entry->namelen = len;
!   memcpy (entry->name, ascic, len);
!   entry->name[len] = 0;
!   entry->owner = abfd;
! 
!   if (!add_symbol_entry (abfd, entry))
!     return NULL;
    return entry;
  }
  


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]