diff options
author | Trevor Saunders <tbsaunde+binutils@tbsaunde.org> | 2016-04-02 07:57:10 -0400 |
---|---|---|
committer | Trevor Saunders <tbsaunde+binutils@tbsaunde.org> | 2016-04-03 19:10:33 -0400 |
commit | f73e41ef3703be34db1c7e08271e6ac8bd758144 (patch) | |
tree | da16961e959aceb6ae62e40313cc24a267f14ec8 | |
parent | d0a9981f372e636508b9a235017f2aba565e435d (diff) | |
download | gdb-f73e41ef3703be34db1c7e08271e6ac8bd758144.zip gdb-f73e41ef3703be34db1c7e08271e6ac8bd758144.tar.gz gdb-f73e41ef3703be34db1c7e08271e6ac8bd758144.tar.bz2 |
avr: simplify some option parsing with strcasecmp ()
Instead of canonicalizing the argument we can just use a case insensitive
compare.
gas/ChangeLog:
2016-04-03 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
* config/tc-avr.c (md_parse_option): Use strcasecmp () to compare
strings.
-rw-r--r-- | gas/ChangeLog | 5 | ||||
-rw-r--r-- | gas/config/tc-avr.c | 13 |
2 files changed, 6 insertions, 12 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog index 6c76391..8d6ba9b 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2016-04-03 Trevor Saunders <tbsaunde+binutils@tbsaunde.org> + + * config/tc-avr.c (md_parse_option): Use strcasecmp () to compare + strings. + 2016-04-02 Alan Modra <amodra@gmail.com> PR 19896 diff --git a/gas/config/tc-avr.c b/gas/config/tc-avr.c index 852002f..999ffb4 100644 --- a/gas/config/tc-avr.c +++ b/gas/config/tc-avr.c @@ -562,22 +562,11 @@ md_parse_option (int c, const char *arg) case OPTION_MMCU: { int i; - char *s = xmalloc (strlen (arg) + 1); - - { - char *t = s; - const char *arg1 = arg; - - do - *t = TOLOWER (*arg1++); - while (*t++); - } for (i = 0; mcu_types[i].name; ++i) - if (strcmp (mcu_types[i].name, s) == 0) + if (strcasecmp (mcu_types[i].name, arg) == 0) break; - free (s); if (!mcu_types[i].name) { show_mcu_list (stderr); |