[PATCH 1/2] getopt.c: warning fix (signed/unsigned comparison) -, strlen() returns size_t, so no need to cast

Freddie Chopin freddie_chopin@op.pl
Fri Nov 8 19:36:00 GMT 2013


This patch fixes compiler warning - it's a trivial change.

Regards,
FCh
-------------- next part --------------
From 79d4bc6f9d3ef6d047c4ab6309c7e7f180c71e48 Mon Sep 17 00:00:00 2001
From: Freddie Chopin <freddie.chopin@gmail.com>
Date: Fri, 8 Nov 2013 20:21:41 +0100
Subject: [PATCH 1/2] getopt.c: warning fix (signed/unsigned comparison) -
 strlen() returns size_t, so no need to cast

---
 newlib/libc/stdlib/getopt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/newlib/libc/stdlib/getopt.c b/newlib/libc/stdlib/getopt.c
index 2bea694..c2bd060 100644
--- a/newlib/libc/stdlib/getopt.c
+++ b/newlib/libc/stdlib/getopt.c
@@ -297,7 +297,7 @@ getopt_internal (int argc, char *const argv[], const char *shortopts,
 	       match_chars) == 0)
 	    {
 	      /* do we have an exact match? */
-	      if (match_chars == (int) (strlen (longopts[optindex].name)))
+	      if (match_chars == strlen (longopts[optindex].name))
 		{
 		  longopt_match = optindex;
 		  break;
-- 
1.8.3.msysgit.0



More information about the Newlib mailing list