summaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorTristan Gingold <gingold@adacore.com>2010-05-24 10:50:27 +0000
committerTristan Gingold <gingold@adacore.com>2010-05-24 10:50:27 +0000
commitf46cd3493b8004b1fa376d4b9d0fe5598dcf3e9e (patch)
tree9eb0d17b5a4544c40718c392d454768eb95e03c5 /bfd
parent18c0fec3bb82d05f1273a619f4eebb89439342e0 (diff)
downloadgdb-f46cd3493b8004b1fa376d4b9d0fe5598dcf3e9e.tar.gz
2010-05-24 Tristan Gingold <gingold@adacore.com>
* vms-alpha.c (add_symbol_entry): New function extrated from ... (add_symbol): ... adjusted.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/vms-alpha.c46
2 files changed, 31 insertions, 22 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 30078b4fb6e..0ef88f73682 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,10 +1,7 @@
2010-05-24 Tristan Gingold <gingold@adacore.com>
- * vms-alpha.c (struct vms_private_data_struct): Add section_max
- field.
- (_bfd_vms_slurp_egsd): Put PSC into the sections array.
- (vms_new_section_hook): Do not put section in the sections
- array.
+ * vms-alpha.c (add_symbol_entry): New function extrated from ...
+ (add_symbol): ... adjusted.
2010-05-24 Tristan Gingold <gingold@adacore.com>
diff --git a/bfd/vms-alpha.c b/bfd/vms-alpha.c
index b2f205e5c8f..0a8850126da 100644
--- a/bfd/vms-alpha.c
+++ b/bfd/vms-alpha.c
@@ -1043,23 +1043,12 @@ vms_esecflag_by_name (struct sec_flags_struct *section_flags,
return section_flags[i].vflags_always;
}
-/* Input routines. */
+/* Add SYM to the symbol table of ABFD.
+ Return FALSE in case of error. */
-static struct vms_symbol_entry *
-add_symbol (bfd *abfd, const unsigned char *ascic)
+static bfd_boolean
+add_symbol_entry (bfd *abfd, struct vms_symbol_entry *sym)
{
- 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)
@@ -1076,10 +1065,33 @@ add_symbol (bfd *abfd, const unsigned char *ascic)
(PRIV (max_sym_count) * sizeof (struct vms_symbol_entry *)));
}
if (PRIV (syms) == NULL)
- return NULL;
+ return FALSE;
}
- PRIV (syms)[PRIV (gsd_sym_count)++] = entry;
+ PRIV (syms)[PRIV (gsd_sym_count)++] = sym;
+ return TRUE;
+}
+
+/* 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;
}