From: Trevor Saunders Date: Mon, 23 May 2016 04:35:40 +0000 (-0400) Subject: xtensa: remove a sentinal X-Git-Tag: binutils-2_27~94 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e066bf5f74fd776657accf02dececb7df120412f;p=external%2Fbinutils.git xtensa: remove a sentinal gas/ChangeLog: 2016-06-27 Trevor Saunders * config/tc-xtensa.c (xtensa_elf_suffix): Use ARRAY_SIZE instead of a sentinal element. (map_suffix_reloc_to_operator): Likewise. (map_operator_to_reloc): Likewise. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index 5f85ad5..131782c 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,12 @@ 2016-06-27 Trevor Saunders + * config/tc-xtensa.c (xtensa_elf_suffix): Use ARRAY_SIZE instead of a + sentinal element. + (map_suffix_reloc_to_operator): Likewise. + (map_operator_to_reloc): Likewise. + +2016-06-27 Trevor Saunders + * config/tc-nds32.c (md_begin): Use ARRAY_SIZE instead of a sentinal element in relax_table. diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c index 5840135..d062044 100644 --- a/gas/config/tc-xtensa.c +++ b/gas/config/tc-xtensa.c @@ -377,7 +377,6 @@ static struct suffix_reloc_map suffix_relocs[] = SUFFIX_MAP ("tlscall", BFD_RELOC_XTENSA_TLS_CALL, O_tlscall), SUFFIX_MAP ("tpoff", BFD_RELOC_XTENSA_TLS_TPOFF, O_tpoff), SUFFIX_MAP ("dtpoff", BFD_RELOC_XTENSA_TLS_DTPOFF, O_dtpoff), - { (char *) 0, 0, BFD_RELOC_UNUSED, 0 } }; @@ -1717,7 +1716,7 @@ xtensa_elf_suffix (char **str_p, expressionS *exp_p) char *str2; int ch; int len; - struct suffix_reloc_map *ptr; + unsigned int i; if (*str++ != '@') return BFD_RELOC_NONE; @@ -1734,10 +1733,10 @@ xtensa_elf_suffix (char **str_p, expressionS *exp_p) len = str2 - ident; ch = ident[0]; - for (ptr = &suffix_relocs[0]; ptr->length > 0; ptr++) - if (ch == ptr->suffix[0] - && len == ptr->length - && memcmp (ident, ptr->suffix, ptr->length) == 0) + for (i = 0; i < ARRAY_SIZE (suffix_relocs); i++) + if (ch == suffix_relocs[i].suffix[0] + && len == suffix_relocs[i].length + && memcmp (ident, suffix_relocs[i].suffix, suffix_relocs[i].length) == 0) { /* Now check for "identifier@suffix+constant". */ if (*str == '-' || *str == '+') @@ -1758,7 +1757,7 @@ xtensa_elf_suffix (char **str_p, expressionS *exp_p) } *str_p = str; - return ptr->reloc; + return suffix_relocs[i].reloc; } return BFD_RELOC_UNUSED; @@ -1769,14 +1768,14 @@ xtensa_elf_suffix (char **str_p, expressionS *exp_p) static operatorT map_suffix_reloc_to_operator (bfd_reloc_code_real_type reloc) { - struct suffix_reloc_map *sfx; operatorT operator = O_illegal; + unsigned int i; - for (sfx = &suffix_relocs[0]; sfx->suffix; sfx++) + for (i = 0; i < ARRAY_SIZE (suffix_relocs); i++) { - if (sfx->reloc == reloc) + if (suffix_relocs[i].reloc == reloc) { - operator = sfx->operator; + operator = suffix_relocs[i].operator; break; } } @@ -1789,14 +1788,14 @@ map_suffix_reloc_to_operator (bfd_reloc_code_real_type reloc) static bfd_reloc_code_real_type map_operator_to_reloc (unsigned char operator, bfd_boolean is_literal) { - struct suffix_reloc_map *sfx; + unsigned int i; bfd_reloc_code_real_type reloc = BFD_RELOC_UNUSED; - for (sfx = &suffix_relocs[0]; sfx->suffix; sfx++) + for (i = 0; i < ARRAY_SIZE (suffix_relocs); i++) { - if (sfx->operator == operator) + if (suffix_relocs[i].operator == operator) { - reloc = sfx->reloc; + reloc = suffix_relocs[i].reloc; break; } }