[3/9] gdb: Make use of safe-ctype.h header.

Message ID 208a01e3f21d7c7e2662a1d2199c4dedab668989.1441996064.git.andrew.burgess@embecosm.com
State New, archived
Headers

Commit Message

Andrew Burgess Sept. 11, 2015, 6:49 p.m. UTC
  In stack.c switch to using safe-ctype.h instead of ctype.h, update code
as required.

gdb/ChangeLog:

	* stack.c: Include safe-ctype.h not ctype.h.
	(parse_frame_specification): Use ISSPACE not isspace.
	(backtrace_command): Use TOLOWER not tolower.
---
 gdb/ChangeLog | 6 ++++++
 gdb/stack.c   | 6 +++---
 2 files changed, 9 insertions(+), 3 deletions(-)
  

Comments

Pedro Alves Sept. 30, 2015, 1:43 p.m. UTC | #1
On 09/11/2015 07:49 PM, Andrew Burgess wrote:
> In stack.c switch to using safe-ctype.h instead of ctype.h, update code
> as required.
> 
> gdb/ChangeLog:
> 
> 	* stack.c: Include safe-ctype.h not ctype.h.
> 	(parse_frame_specification): Use ISSPACE not isspace.
> 	(backtrace_command): Use TOLOWER not tolower.

OK.

Thanks,
Pedro Alves
  

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 79952c7..50aa7f0 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,11 @@ 
 2015-09-11  Andrew Burgess  <andrew.burgess@embecosm.com>
 
+	* stack.c: Include safe-ctype.h not ctype.h.
+	(parse_frame_specification): Use ISSPACE not isspace.
+	(backtrace_command): Use TOLOWER not tolower.
+
+2015-09-11  Andrew Burgess  <andrew.burgess@embecosm.com>
+
 	* frame.h (make_restore_selected_frame_cleanup): Declare new
 	function.
 	* frame.c (do_restore_selected_frame): New function.
diff --git a/gdb/stack.c b/gdb/stack.c
index 82b366d..2fe176f 100644
--- a/gdb/stack.c
+++ b/gdb/stack.c
@@ -48,7 +48,7 @@ 
 #include "cli/cli-utils.h"
 #include "objfiles.h"
 
-#include <ctype.h>
+#include "safe-ctype.h"
 #include "symfile.h"
 #include "extension.h"
 
@@ -1305,7 +1305,7 @@  parse_frame_specification_1 (const char *frame_exp, const char *message,
 
 	  /* Parse the argument, extract it, save it.  */
 	  for (p = frame_exp;
-	       *p && !isspace (*p);
+	       *p && !ISSPACE (*p);
 	       p++);
 	  addr_string = savestring (frame_exp, p - frame_exp);
 	  frame_exp = p;
@@ -1904,7 +1904,7 @@  backtrace_command (char *arg, int from_tty)
 	  unsigned int j;
 
 	  for (j = 0; j < strlen (argv[i]); j++)
-	    argv[i][j] = tolower (argv[i][j]);
+	    argv[i][j] = TOLOWER (argv[i][j]);
 
 	  if (no_filters < 0 && subset_compare (argv[i], "no-filters"))
 	    no_filters = argc;