aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Gingold <gingold@adacore.com>2010-11-04 16:17:44 +0000
committerTristan Gingold <gingold@adacore.com>2010-11-04 16:17:44 +0000
commitdd7f9124e97e5a72beba9b34a7ff5e384b9c159d (patch)
tree513d396204c04bcca988dbbb705af06b1b45ece3
parent802d48223b68e962dd8d96b20977f7406b9d4d91 (diff)
downloadgdb-dd7f9124e97e5a72beba9b34a7ff5e384b9c159d.zip
gdb-dd7f9124e97e5a72beba9b34a7ff5e384b9c159d.tar.gz
gdb-dd7f9124e97e5a72beba9b34a7ff5e384b9c159d.tar.bz2
2010-11-04 Tristan Gingold <gingold@adacore.com>
* vms-lib.c (vms_write_index): Fix thinko: reverse the loop. Use bfd_zmalloc instead of bfd_malloc. Fix comment.
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/vms-lib.c9
2 files changed, 10 insertions, 4 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index b31bfa4..f18a7dd 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,8 @@
+2010-11-04 Tristan Gingold <gingold@adacore.com>
+
+ * vms-lib.c (vms_write_index): Fix thinko: reverse the loop.
+ Use bfd_zmalloc instead of bfd_malloc. Fix comment.
+
2010-11-04 Kai Tietz <kai.tietz@onevision.com>
* coffcode.h (GNU_LINKONCE_WT): New.
diff --git a/bfd/vms-lib.c b/bfd/vms-lib.c
index 6e86df3..6ab78ea 100644
--- a/bfd/vms-lib.c
+++ b/bfd/vms-lib.c
@@ -1591,7 +1591,7 @@ vms_write_index (bfd *abfd,
/* Allocate first index block. */
level = 1;
if (abfd != NULL)
- rblk[0] = bfd_malloc (sizeof (struct vms_indexdef));
+ rblk[0] = bfd_zmalloc (sizeof (struct vms_indexdef));
blk[0].vbn = (*vbn)++;
blk[0].len = 0;
blk[0].lastlen = 0;
@@ -1698,7 +1698,7 @@ vms_write_index (bfd *abfd,
/* Need to create a parent. */
if (abfd != NULL)
{
- rblk[level] = bfd_malloc (sizeof (struct vms_indexdef));
+ rblk[level] = bfd_zmalloc (sizeof (struct vms_indexdef));
bfd_putl32 (*vbn, rblk[j]->parent);
}
blk[level].vbn = (*vbn)++;
@@ -1717,7 +1717,8 @@ vms_write_index (bfd *abfd,
memcpy (rblk[j + 1]->keys + blk[j + 1].len,
rblk[j]->keys + blk[j].len,
blk[j].lastlen);
- /* Fix the entry (which in always the first field of an entry. */
+ /* Fix the entry (which in always the first field of an
+ entry. */
rfa = (struct vms_rfa *)(rblk[j + 1]->keys + blk[j + 1].len);
bfd_putl32 (blk[j].vbn, rfa->vbn);
bfd_putl16 (RFADEF__C_INDEX, rfa->offset);
@@ -1806,7 +1807,7 @@ vms_write_index (bfd *abfd,
return TRUE;
/* Flush. */
- for (j = 0; j < level; j++)
+ for (j = level - 1; j >= 0; j--)
{
if (j > 0)
{