* [PATCH] avr: simplify some option parsing with strcasecmp ()
@ 2016-04-02 17:54 tbsaunde+binutils
2016-04-03 22:55 ` Alan Modra
0 siblings, 1 reply; 2+ messages in thread
From: tbsaunde+binutils @ 2016-04-02 17:54 UTC (permalink / raw)
To: binutils; +Cc: Trevor Saunders
From: Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
Hi,
Instead of canonicalizing the argument we can just use a case insensitive
compare.
built and regtested a cross to avr-elf, ok?
Trev
gas/ChangeLog:
2016-04-02 Trevor Saunders <tbsaunde+binutils@tbsaunde.org>
* config/tc-avr.c (md_parse_option): Use strcasecmp () to compare
strings.
---
gas/config/tc-avr.c | 13 +------------
1 file changed, 1 insertion(+), 12 deletions(-)
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);
--
2.1.4
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] avr: simplify some option parsing with strcasecmp ()
2016-04-02 17:54 [PATCH] avr: simplify some option parsing with strcasecmp () tbsaunde+binutils
@ 2016-04-03 22:55 ` Alan Modra
0 siblings, 0 replies; 2+ messages in thread
From: Alan Modra @ 2016-04-03 22:55 UTC (permalink / raw)
To: tbsaunde+binutils; +Cc: binutils
On Sat, Apr 02, 2016 at 01:59:02PM -0400, tbsaunde+binutils@tbsaunde.org wrote:
> * config/tc-avr.c (md_parse_option): Use strcasecmp () to compare
> strings.
OK.
--
Alan Modra
Australia Development Lab, IBM
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-04-03 22:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-02 17:54 [PATCH] avr: simplify some option parsing with strcasecmp () tbsaunde+binutils
2016-04-03 22:55 ` Alan Modra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).