diff options
-rw-r--r-- | bfd/ChangeLog | 5 | ||||
-rw-r--r-- | bfd/vms-lib.c | 16 |
2 files changed, 17 insertions, 4 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index e27dfc6..3755368 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2011-11-23 Tristan Gingold <gingold@adacore.com> + + * vms-lib.c (get_idxlen): Add comments. Fix type in sizeof. + (vms_write_index): Add comments. + 2011-11-22 DJ Delorie <dj@redhat.com> * elf32-rx.c (rx_elf_object_p): Add more checks for "scanning" to diff --git a/bfd/vms-lib.c b/bfd/vms-lib.c index 0584186..b325d74 100644 --- a/bfd/vms-lib.c +++ b/bfd/vms-lib.c @@ -1542,18 +1542,24 @@ get_idxlen (struct lib_index *idx, bfd_boolean is_elfidx) { if (is_elfidx) { + /* 9 is the size of struct vms_elfidx without keyname. */ if (idx->namlen > MAX_KEYLEN) - return 9 + sizeof (struct vms_rfa); + return 9 + sizeof (struct vms_kbn); else return 9 + idx->namlen; } else - return 7 + idx->namlen; + { + /* 7 is the size of struct vms_idx without keyname. */ + return 7 + idx->namlen; + } } -/* Write the index. VBN is the first vbn to be used, and will contain - on return the last vbn. +/* Write the index composed by NBR symbols contained in IDX. + VBN is the first vbn to be used, and will contain on return the last vbn. Can be called with ABFD set to NULL just to size the index. + If not null, TOPVBN will be assigned to the vbn of the root index tree. + IS_ELFIDX is true for elfidx (ie ia64) indexes layout. Return TRUE on success. */ static bfd_boolean @@ -1637,9 +1643,11 @@ vms_write_index (bfd *abfd, } *(unsigned short *)kbn_blk = 0; } + /* Allocate a new block for the keys. */ kbn_vbn = (*vbn)++; kbn_sz = VMS_BLOCK_SIZE - 2; } + /* Size of the chunk written to the current key block. */ if (kl + sizeof (struct vms_kbn) > kbn_sz) kl_chunk = kbn_sz - sizeof (struct vms_kbn); else |