]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
Do some constification to avoid dubious casts.
authorRoland McGrath <roland@redhat.com>
Thu, 18 Jun 2009 20:56:02 +0000 (13:56 -0700)
committerRoland McGrath <roland@redhat.com>
Thu, 18 Jun 2009 20:56:02 +0000 (13:56 -0700)
libdw/ChangeLog
libdw/dwarf_getaranges.c
libdw/dwarf_getlocation.c
libdw/dwarf_getsrclines.c
libdw/dwarf_nextcu.c
libdw/libdwP.h

index 525bb329b6629dc877fc411b19d0840a09c7e43f..6ae3154ac0dd6b24f1f816f3d20b36568f3bb60d 100644 (file)
@@ -1,3 +1,12 @@
+2009-06-18  Roland McGrath  <roland@redhat.com>
+
+       * libdwP.h (__libdw_read_address_inc): Constify.
+       (__libdw_read_offset_inc): Likewise.
+       * dwarf_getaranges.c: Likewise.
+       * dwarf_getlocation.c: Likewise.
+       * dwarf_getsrclines.c: Likewise.
+       * dwarf_nextcu.c: Likewise.
+
 2009-05-05  Petr Machata  <pmachata@redhat.com>
 
        * libdwP.h (__libdw_formptr): Declare new function.
index 74f04ea571e6e2a616ce29e68a3fc67594feda53..72334f5f618ea893b5fb690e29ae7a81da2973f5 100644 (file)
@@ -1,5 +1,5 @@
 /* Return list address ranges.
-   Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006, 2008 Red Hat, Inc.
+   Copyright (C) 2000-2009 Red Hat, Inc.
    This file is part of Red Hat elfutils.
    Written by Ulrich Drepper <drepper@redhat.com>, 2000.
 
@@ -104,13 +104,13 @@ dwarf_getaranges (dbg, aranges, naranges)
   struct arangelist *arangelist = NULL;
   unsigned int narangelist = 0;
 
-  const char *readp
-    = (const char *) dbg->sectiondata[IDX_debug_aranges]->d_buf;
-  const char *readendp = readp + dbg->sectiondata[IDX_debug_aranges]->d_size;
+  const unsigned char *readp = dbg->sectiondata[IDX_debug_aranges]->d_buf;
+  const unsigned char *readendp
+    = readp + dbg->sectiondata[IDX_debug_aranges]->d_size;
 
   while (readp < readendp)
     {
-      const char *hdrstart = readp;
+      const unsigned char *hdrstart = readp;
 
       /* Each entry starts with a header:
 
@@ -150,7 +150,7 @@ dwarf_getaranges (dbg, aranges, naranges)
 
       Dwarf_Word offset;
       if (__libdw_read_offset_inc (dbg,
-                                  IDX_debug_aranges, (unsigned char **)&readp,
+                                  IDX_debug_aranges, &readp,
                                   length_bytes, &offset, IDX_debug_info, 4))
        return -1;
 
@@ -171,8 +171,7 @@ dwarf_getaranges (dbg, aranges, naranges)
          Dwarf_Word range_address;
          Dwarf_Word range_length;
 
-         if (__libdw_read_address_inc (dbg, IDX_debug_aranges,
-                                       (unsigned char **)&readp,
+         if (__libdw_read_address_inc (dbg, IDX_debug_aranges, &readp,
                                        address_size, &range_address))
            return -1;
 
index f829e72b114921567235a3550f2d803f8f45df85..504db376fc0dbf51252b22b9060a6f1936146e6b 100644 (file)
@@ -1,5 +1,5 @@
 /* Return location expression list.
-   Copyright (C) 2000, 2001, 2002, 2004, 2005, 2006 Red Hat, Inc.
+   Copyright (C) 2000-2009 Red Hat, Inc.
    This file is part of Red Hat elfutils.
    Written by Ulrich Drepper <drepper@redhat.com>, 2000.
 
@@ -151,7 +151,7 @@ getlocation (struct Dwarf_CU *cu, const Dwarf_Block *block,
        {
        case DW_OP_addr:
          /* Address, depends on address size of CU.  */
-         if (__libdw_read_address_inc (dbg, sec_index, (unsigned char **)&data,
+         if (__libdw_read_address_inc (dbg, sec_index, &data,
                                        cu->address_size, &newloc->number))
            return -1;
          break;
index efd0459f59bfe2fcfb5e47ca3525acc5d27acfa5..43fad99af1ae8eeb1348a69b06ab8f735b1eb821 100644 (file)
@@ -424,8 +424,7 @@ dwarf_getsrclines (Dwarf_Die *cudie, Dwarf_Lines **lines, size_t *nlines)
                  /* The value is an address.  The size is defined as
                     apporiate for the target machine.  We use the
                     address size field from the CU header.  */
-                 if (__libdw_read_address_inc (dbg, IDX_debug_line,
-                                               (unsigned char **)&linep,
+                 if (__libdw_read_address_inc (dbg, IDX_debug_line, &linep,
                                                cu->address_size, &address))
                    goto out;
                  break;
index 66cde78a57598a666f9b5dc8baf8dab604568d16..e436e11584ac3cbfaae650f52586f73895c3bbc6 100644 (file)
@@ -1,5 +1,5 @@
 /* Advance to next CU header.
-   Copyright (C) 2002, 2003, 2004, 2005, 2008 Red Hat, Inc.
+   Copyright (C) 2002-2009 Red Hat, Inc.
    This file is part of Red Hat elfutils.
    Written by Ulrich Drepper <drepper@redhat.com>, 2002.
 
@@ -84,8 +84,8 @@ dwarf_nextcu (dwarf, off, next_off, header_sizep, abbrev_offsetp,
 
   /* This points into the .debug_info section to the beginning of the
      CU entry.  */
-  unsigned char *data = dwarf->sectiondata[IDX_debug_info]->d_buf;
-  unsigned char *bytes = data + off;
+  const unsigned char *data = dwarf->sectiondata[IDX_debug_info]->d_buf;
+  const unsigned char *bytes = data + off;
 
   /* The format of the CU header is described in dwarf2p1 7.5.1:
 
index 97a2e042f6837ca3fd04a54a16817d46819083ff..eacc49fc21bfbdd712a6f89abacc488386e8f194 100644 (file)
@@ -511,10 +511,10 @@ __libdw_in_section (Dwarf *dbg, int sec_index,
 
 static inline int
 __libdw_read_address_inc (Dwarf *dbg,
-                         int sec_index, unsigned char **addrp,
+                         int sec_index, const unsigned char **addrp,
                          int width, Dwarf_Addr *ret)
 {
-  unsigned char *addr = *addrp;
+  const unsigned char *addr = *addrp;
   READ_AND_RELOCATE (__libdw_relocate_address, (*ret));
   *addrp = addr;
   return 0;
@@ -531,11 +531,11 @@ __libdw_read_address (Dwarf *dbg,
 
 static inline int
 __libdw_read_offset_inc (Dwarf *dbg,
-                        int sec_index, unsigned char **addrp,
+                        int sec_index, const unsigned char **addrp,
                         int width, Dwarf_Off *ret, int sec_ret,
                         size_t size)
 {
-  unsigned char *addr = *addrp;
+  const unsigned char *addr = *addrp;
   READ_AND_RELOCATE (__libdw_relocate_offset, (*ret));
   *addrp = addr;
   return __libdw_offset_in_section (dbg, sec_ret, *ret, size);