[PATCH 3/4] libctf: fix isspace casts

Nick Alcock nick.alcock@oracle.com
Wed Jul 22 09:39:25 GMT 2020


isspace() notoriously takes an int, not a char.  Cast uses
appropriately.

libctf/
	* ctf-lookup.c (ctf_lookup_by_name): Adjust.
---
 libctf/ctf-lookup.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libctf/ctf-lookup.c b/libctf/ctf-lookup.c
index 8daab632dca..57fb6c580ee 100644
--- a/libctf/ctf-lookup.c
+++ b/libctf/ctf-lookup.c
@@ -83,7 +83,7 @@ ctf_lookup_by_name (ctf_file_t *fp, const char *name)
 
   for (p = name, end = name + strlen (name); *p != '\0'; p = q)
     {
-      while (isspace (*p))
+      while (isspace ((int) *p))
 	p++;			/* Skip leading whitespace.  */
 
       if (p == end)
@@ -133,13 +133,13 @@ ctf_lookup_by_name (ctf_file_t *fp, const char *name)
 	       strncmp (p, lp->ctl_prefix, (size_t) (q - p)) == 0) &&
 	      (size_t) (q - p) >= lp->ctl_len)
 	    {
-	      for (p += lp->ctl_len; isspace (*p); p++)
+	      for (p += lp->ctl_len; isspace ((int) *p); p++)
 		continue;	/* Skip prefix and next whitespace.  */
 
 	      if ((q = strchr (p, '*')) == NULL)
 		q = end;	/* Compare until end.  */
 
-	      while (isspace (q[-1]))
+	      while (isspace ((int) q[-1]))
 		q--;		/* Exclude trailing whitespace.  */
 
 	      /* Expand and/or allocate storage for a slice of the name, then
-- 
2.27.0.247.g3dff7de930



More information about the Binutils mailing list