From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 2EB13138335 for ; Thu, 7 Jun 2018 14:09:46 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A4AF2E0AF7; Thu, 7 Jun 2018 14:09:44 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 63096E0AEF for ; Thu, 7 Jun 2018 14:09:44 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id E2CEC335CA3 for ; Thu, 7 Jun 2018 14:09:42 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 0E2302C8 for ; Thu, 7 Jun 2018 14:09:41 +0000 (UTC) From: "Mike Frysinger" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" Message-ID: <1528380349.5dffe6dcfa021c0621fb7e6c76812f9c08747039.vapier@gentoo> Subject: [gentoo-commits] proj/pax-utils:master commit in: / X-VCS-Repository: proj/pax-utils X-VCS-Files: dumpelf.c X-VCS-Directories: / X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: 5dffe6dcfa021c0621fb7e6c76812f9c08747039 X-VCS-Branch: master Date: Thu, 7 Jun 2018 14:09:41 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 5d0e3a2c-d0ea-4249-be14-7420dcdc8279 X-Archives-Hash: 18011a7271aae3232bd854a5d350652d commit: 5dffe6dcfa021c0621fb7e6c76812f9c08747039 Author: Mike Frysinger gentoo org> AuthorDate: Fri Mar 3 21:29:52 2017 +0000 Commit: Mike Frysinger gentoo org> CommitDate: Thu Jun 7 14:05:49 2018 +0000 URL: https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=5dffe6dc dumpelf: constify misc pointers Mark all possible pointers const since we don't modify anything. dumpelf.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/dumpelf.c b/dumpelf.c index 6ba37fc..405beba 100644 --- a/dumpelf.c +++ b/dumpelf.c @@ -55,7 +55,7 @@ static void dumpelf(const char *filename, size_t file_cnt) /* setup the struct to namespace this elf */ #define MAKE_STRUCT(B) \ if (elf->elf_class == ELFCLASS ## B) { \ - Elf ## B ## _Ehdr *ehdr = EHDR ## B (elf->ehdr); \ + const Elf ## B ## _Ehdr *ehdr = EHDR ## B (elf->ehdr); \ b = B; \ printf( \ "Elf%1$i_Dyn dumpedelf_dyn_%2$zu[];\n" \ @@ -300,7 +300,7 @@ static void dump_phdr(elfobj *elf, const void *phdr_void, size_t phdr_cnt) if (elf->elf_class == ELFCLASS ## B) { \ const Elf ## B ## _Phdr *phdr = PHDR ## B (phdr_void); \ Elf ## B ## _Off offset = EGET(phdr->p_offset); \ - void *vdata = elf->vdata + offset; \ + const void *vdata = elf->vdata + offset; \ uint32_t p_type = EGET(phdr->p_type); \ printf("/* Program Header #%zu 0x%tX */\n{\n", \ phdr_cnt, (uintptr_t)phdr_void - elf->udata); \ @@ -356,7 +356,7 @@ static void dump_shdr(elfobj *elf, const void *shdr_void, size_t shdr_cnt, const size_t i; /* Make sure the string is valid. */ - if ((void *)section_name >= elf->data_end) + if ((const void *)section_name >= elf->data_end) section_name = ""; else if (memchr(section_name, 0, elf->len - (section_name - elf->data)) == NULL) section_name = ""; @@ -388,8 +388,8 @@ static void dump_shdr(elfobj *elf, const void *shdr_void, size_t shdr_cnt, const } else if (!VALID_RANGE(elf, offset, size)) { \ printf(" /* corrupt section header ! */ "); \ } else if (size && be_verbose) { \ - void *vdata = elf->vdata + offset; \ - unsigned char *data = vdata; \ + const void *vdata = elf->vdata + offset; \ + const unsigned char *data = vdata; \ switch (type) { \ case SHT_PROGBITS: { \ if (strcmp(section_name, ".interp") == 0) { \ @@ -420,7 +420,7 @@ static void dump_shdr(elfobj *elf, const void *shdr_void, size_t shdr_cnt, const break; \ } \ case SHT_DYNSYM: { \ - Elf##B##_Sym *sym = vdata; \ + const Elf##B##_Sym *sym = vdata; \ printf("\n\t/%c section dump:\n", '*'); \ if (EGET(shdr->sh_entsize) < sizeof(*sym)) \ printf(" /* corrupt section ! */ "); \ @@ -443,7 +443,7 @@ static void dump_shdr(elfobj *elf, const void *shdr_void, size_t shdr_cnt, const dump_notes(elf, B, vdata, vdata + EGET(shdr->sh_size)); \ break; \ case SHT_GNU_LIBLIST: { \ - Elf##B##_Lib *lib = vdata; \ + const Elf##B##_Lib *lib = vdata; \ printf("\n\t/%c section dump:\n", '*'); \ if (EGET(shdr->sh_entsize) < sizeof(*lib)) \ printf(" /* corrupt section ! */ "); \