From: Tristan Gingold Date: Wed, 23 Nov 2011 11:22:22 +0000 (+0000) Subject: 2011-11-23 Tristan Gingold X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=91ea3caed73075bebeaa2d0626b14fb7410cd15d;p=binutils-gdb.git 2011-11-23 Tristan Gingold * vms-lib.c (get_idxlen): Add comments. Fix type in sizeof. (vms_write_index): Add comments. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index e27dfc6c590..3755368cbd2 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2011-11-23 Tristan Gingold + + * vms-lib.c (get_idxlen): Add comments. Fix type in sizeof. + (vms_write_index): Add comments. + 2011-11-22 DJ Delorie * 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 0584186014b..b325d7411bb 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