This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[vms/committed]: More const in vms-misc.c and vms-alpha.c
- From: Tristan Gingold <gingold at adacore dot com>
- To: binutils <binutils at sourceware dot org>
- Date: Fri, 11 Jun 2010 17:14:43 +0200
- Subject: [vms/committed]: More const in vms-misc.c and vms-alpha.c
Hi,
while reading the code, I have found a few place to put the 'const' keyword.
Committed.
Tristan.
bfd/
2010-06-11 Tristan Gingold <gingold@adacore.com>
* vms-misc.c (_bfd_vms_output_counted): Make VALUE argument const.
Adjust cast.
(_bfd_vms_output_dump): Make DATA argument const, adjust cast.
* vms.h (_bfd_vms_output_counted, _bfd_vms_output_dump): Adjust.
* vms-alpha.c (evax_section_flags): Make it const.
(vms_secflag_by_name): Remove unused ABFD argument.
Make SECTION_FLAGS and NAME arguments const. Clarify comment.
(vms_esecflag_by_name): Make SECTION_FLAGS and NAME arguments const.
(_bfd_vms_slurp_egsd): Adjust call to vms_secflag_by_name.
(_bfd_vms_write_egsd): Remove useless cast.
===================================================================
RCS file: /cvs/src/src/bfd/vms-alpha.c,v
retrieving revision 1.21
diff -c -r1.21 vms-alpha.c
*** vms-alpha.c 2 Jun 2010 08:01:30 -0000 1.21
--- vms-alpha.c 11 Jun 2010 15:09:31 -0000
***************
*** 936,942 ****
/* These flags are deccrtl/vaxcrtl (openVMS 6.2 Alpha) compatible. */
! static struct sec_flags_struct evax_section_flags[] =
{
{ EVAX_ABS_NAME,
(EGPS__V_SHR),
--- 936,942 ----
/* These flags are deccrtl/vaxcrtl (openVMS 6.2 Alpha) compatible. */
! static const struct sec_flags_struct evax_section_flags[] =
{
{ EVAX_ABS_NAME,
(EGPS__V_SHR),
***************
*** 995,1006 ****
(SEC_IN_MEMORY | SEC_DATA | SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD) }
};
! /* Retrieve bfd section flags by name and size. */
static flagword
! vms_secflag_by_name (bfd *abfd ATTRIBUTE_UNUSED,
! struct sec_flags_struct *section_flags,
! char *name,
int hassize)
{
int i = 0;
--- 995,1005 ----
(SEC_IN_MEMORY | SEC_DATA | SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD) }
};
! /* Retrieve BFD section flags by name and size. */
static flagword
! vms_secflag_by_name (const struct sec_flags_struct *section_flags,
! const char *name,
int hassize)
{
int i = 0;
***************
*** 1021,1032 ****
return section_flags[i].flags_always;
}
! /* Retrieve vms section flags by name and size. */
static flagword
! vms_esecflag_by_name (struct sec_flags_struct *section_flags,
! char *name,
! int hassize)
{
int i = 0;
--- 1020,1031 ----
return section_flags[i].flags_always;
}
! /* Retrieve VMS section flags by name and size. */
static flagword
! vms_esecflag_by_name (const struct sec_flags_struct *section_flags,
! const char *name,
! int hassize)
{
int i = 0;
***************
*** 1144,1150 ****
vms_section_data (section)->flags = old_flags;
vms_section_data (section)->no_flags = 0;
section->size = bfd_getl32 (egps->alloc);
! new_flags = vms_secflag_by_name (abfd, evax_section_flags, name,
section->size > 0);
if (!(old_flags & EGPS__V_NOMOD))
{
--- 1143,1149 ----
vms_section_data (section)->flags = old_flags;
vms_section_data (section)->no_flags = 0;
section->size = bfd_getl32 (egps->alloc);
! new_flags = vms_secflag_by_name (evax_section_flags, name,
section->size > 0);
if (!(old_flags & EGPS__V_NOMOD))
{
***************
*** 3319,3325 ****
/* Don't know if this is necessary for the linker but for now it keeps
vms_slurp_gsd happy. */
! sname = (char *)section->name;
if (*sname == '.')
{
/* Remove leading dot. */
--- 3318,3324 ----
/* Don't know if this is necessary for the linker but for now it keeps
vms_slurp_gsd happy. */
! sname = section->name;
if (*sname == '.')
{
/* Remove leading dot. */
Index: vms-misc.c
===================================================================
RCS file: /cvs/src/src/bfd/vms-misc.c,v
retrieving revision 1.36
diff -c -r1.36 vms-misc.c
*** vms-misc.c 28 May 2010 09:57:03 -0000 1.36
--- vms-misc.c 11 Jun 2010 15:09:31 -0000
***************
*** 348,354 ****
/* Output c-string as counted string. */
void
! _bfd_vms_output_counted (struct vms_rec_wr *recwr, char *value)
{
int len;
--- 348,354 ----
/* Output c-string as counted string. */
void
! _bfd_vms_output_counted (struct vms_rec_wr *recwr, const char *value)
{
int len;
***************
*** 366,378 ****
return;
}
_bfd_vms_output_byte (recwr, (unsigned int) len & 0xff);
! _bfd_vms_output_dump (recwr, (unsigned char *) value, len);
}
/* Output character area. */
void
! _bfd_vms_output_dump (struct vms_rec_wr *recwr, unsigned char *data, int len)
{
vms_debug2 ((6, "_bfd_vms_output_dump (%d)\n", len));
--- 366,378 ----
return;
}
_bfd_vms_output_byte (recwr, (unsigned int) len & 0xff);
! _bfd_vms_output_dump (recwr, (const unsigned char *)value, len);
}
/* Output character area. */
void
! _bfd_vms_output_dump (struct vms_rec_wr *recwr, const unsigned char *data, int len)
{
vms_debug2 ((6, "_bfd_vms_output_dump (%d)\n", len));
Index: vms.h
===================================================================
RCS file: /cvs/src/src/bfd/vms.h,v
retrieving revision 1.21
diff -c -r1.21 vms.h
*** vms.h 27 May 2010 13:43:44 -0000 1.21
--- vms.h 11 Jun 2010 15:09:32 -0000
***************
*** 131,138 ****
extern void _bfd_vms_output_short (struct vms_rec_wr *, unsigned);
extern void _bfd_vms_output_long (struct vms_rec_wr *, unsigned long);
extern void _bfd_vms_output_quad (struct vms_rec_wr *, bfd_vma);
! extern void _bfd_vms_output_counted (struct vms_rec_wr *, char *);
! extern void _bfd_vms_output_dump (struct vms_rec_wr *, unsigned char *, int);
extern void _bfd_vms_output_fill (struct vms_rec_wr *, int, int);
extern int _bfd_vms_convert_to_var_unix_filename (const char *);
--- 131,138 ----
extern void _bfd_vms_output_short (struct vms_rec_wr *, unsigned);
extern void _bfd_vms_output_long (struct vms_rec_wr *, unsigned long);
extern void _bfd_vms_output_quad (struct vms_rec_wr *, bfd_vma);
! extern void _bfd_vms_output_counted (struct vms_rec_wr *, const char *);
! extern void _bfd_vms_output_dump (struct vms_rec_wr *, const unsigned char *, int);
extern void _bfd_vms_output_fill (struct vms_rec_wr *, int, int);
extern int _bfd_vms_convert_to_var_unix_filename (const char *);