From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48028) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aiGmz-0000pC-Bi for qemu-devel@nongnu.org; Tue, 22 Mar 2016 03:31:42 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aiGmv-0007bO-BW for qemu-devel@nongnu.org; Tue, 22 Mar 2016 03:31:41 -0400 Received: from qemu.weilnetz.de ([37.221.198.45]:39137) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aiGmv-0007bK-5k for qemu-devel@nongnu.org; Tue, 22 Mar 2016 03:31:37 -0400 From: Stefan Weil Date: Tue, 22 Mar 2016 08:31:33 +0100 Message-Id: <1458631893-12812-1-git-send-email-sw@weilnetz.de> Subject: [Qemu-devel] [PATCH] disas/microblaze: Add missing 'const' attributes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: "Edgar E. Iglesias" , Stefan Weil Making the opcode list 'const' saves memory. Some function arguments and local variables needed 'const', too. Add also 'static' to two local functions. Signed-off-by: Stefan Weil --- disas/microblaze.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/disas/microblaze.c b/disas/microblaze.c index 91b30ac..780b388 100644 --- a/disas/microblaze.c +++ b/disas/microblaze.c @@ -272,7 +272,7 @@ enum microblaze_instr_type { #define MAX_OPCODES 280 -static struct op_code_struct { +static const struct op_code_struct { const char *name; short inst_type; /* registers and immediate values involved */ short inst_offset_type; /* immediate vals offset from PC? (= 1 for branches) */ @@ -664,8 +664,8 @@ get_field_unsigned_imm (long instr) } */ -char * -get_field_special (long instr, struct op_code_struct * op) +static char * +get_field_special(long instr, const struct op_code_struct *op) { char tmpstr[25]; char spr[6]; @@ -729,14 +729,14 @@ get_field_special (long instr, struct op_code_struct * op) return(strdup(tmpstr)); } -unsigned long +static unsigned long read_insn_microblaze (bfd_vma memaddr, struct disassemble_info *info, - struct op_code_struct **opr) + const struct op_code_struct **opr) { unsigned char ibytes[4]; int status; - struct op_code_struct * op; + const struct op_code_struct *op; unsigned long inst; status = info->read_memory_func (memaddr, ibytes, 4, info); @@ -770,7 +770,7 @@ print_insn_microblaze (bfd_vma memaddr, struct disassemble_info * info) fprintf_function fprintf_func = info->fprintf_func; void * stream = info->stream; unsigned long inst, prev_inst; - struct op_code_struct * op, *pop; + const struct op_code_struct *op, *pop; int immval = 0; bfd_boolean immfound = FALSE; static bfd_vma prev_insn_addr = -1; /*init the prev insn addr */ -- 2.1.4