From 529480d058a17512a1cff27c682d340f8ea3ab33 Mon Sep 17 00:00:00 2001 From: Keith Seitz Date: Thu, 7 Mar 2013 21:57:30 +0000 Subject: [PATCH] * breakpoint.c (catch_syscall_split_args): Use skip_spaces. (trace_pass_command): Likewise. * cli/cli-cmds.c: Include cli/cli-utils.h. (source_command): Use skip-spaces. (disassemble_command): Likewise. * findcmd.c: Include cli/cli-utils.h. (parse_find_args): Use skip_spaces. * go32-nat.c: Include cli/cli-utils.h. (go32_sldt): Use skip_spaces. (go32_sgdt): Likewise. (go32_sidt): Likewise. (go32_pde): Likewise. (go32_pte): Likewise. (go32_pte_for_address): Likewise. * infcmd.c: Include cli/cli-utils.h. (registers_info): Use skip_spaces. * linux-tdep.c (read_mapping): Use skip_spaces_const. (linux_info_proc): Likewise. * linux-thread-db.c: Include cli/cli-utils.h. (info_auto_load_libthread_db): Use skip_spaces_const. * m32r-rom.c: Include cli/cli-utils.h. (m32r_upload_command): Use skip_spaces. * maint.c: Include cli/cli-utils.h. (maintenance_translate_address): Use skip_spaces. * mi/mi-parse.c: Include cli/cli-utils.h. (mi_parse_argv): Use skip_spaces. (mi_parse): Likewise. * minsyms.c: Include cli/cli-utils.h. (msymbol_hash_iw): Use skip_spaces_const. * objc-lang.c: Include cli/cli-utils.h. (parse_selector): Use skip_spaces. (parse_method): Likewise. * python/python.c: Include cli/cli-utils.h. (python_interactive_command)[HAVE_PYTHON]: Use skip_spaces. (python_command)[HAVE_PYTHON]: Likewise. (python_interactive_command)[!HAVE_PYTHON]: Likewise. * remote-m32r-sdi.c: Include cli/cli-utils.h. (m32r_load): Use skip_spaces. * serial.c: Include cli/cli-utils.h. (serial_open): Use skip_spaces_const. * stack.c: Include cli/cli-utils.h. (parse_frame_specification_1): Use skip_spaces_const. * symfile.c: Include cli/cli-utils.h. (set_ext_lang_command): Use skip_spaces. * symtab.c: Include cli/cli-utils.h. (rbreak_command): Use skip_spaces. * thread.c (thread_name_command): Use skip_spaces. * tracepoint.c (validate_actionline): Use skip_spaces. (encode_actions_1): Likewise. (trace_find_range_command): Likewise. (trace_find_outside_command): Likewise. (trace_dump_actions): Likewise. --- gdb/ChangeLog | 55 +++++++++++++++++++++++++++++++++++++++++++ gdb/breakpoint.c | 7 ++---- gdb/cli/cli-cmds.c | 14 ++++------- gdb/findcmd.c | 13 ++++------ gdb/go32-nat.c | 19 ++++++--------- gdb/infcmd.c | 9 +++---- gdb/linux-tdep.c | 15 ++++-------- gdb/linux-thread-db.c | 4 ++-- gdb/m32r-rom.c | 4 ++-- gdb/maint.c | 4 ++-- gdb/mi/mi-parse.c | 16 +++++-------- gdb/minsyms.c | 4 ++-- gdb/objc-lang.c | 34 ++++++++++---------------- gdb/python/python.c | 10 ++++---- gdb/remote-m32r-sdi.c | 5 ++-- gdb/serial.c | 4 ++-- gdb/stack.c | 4 ++-- gdb/symfile.c | 4 ++-- gdb/symtab.c | 4 ++-- gdb/thread.c | 3 +-- gdb/tracepoint.c | 33 +++++++++----------------- 21 files changed, 134 insertions(+), 131 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c8787fc454f..87ffb54a42f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,58 @@ +2013-03-07 Keith Seitz + + * breakpoint.c (catch_syscall_split_args): Use skip_spaces. + (trace_pass_command): Likewise. + * cli/cli-cmds.c: Include cli/cli-utils.h. + (source_command): Use skip-spaces. + (disassemble_command): Likewise. + * findcmd.c: Include cli/cli-utils.h. + (parse_find_args): Use skip_spaces. + * go32-nat.c: Include cli/cli-utils.h. + (go32_sldt): Use skip_spaces. + (go32_sgdt): Likewise. + (go32_sidt): Likewise. + (go32_pde): Likewise. + (go32_pte): Likewise. + (go32_pte_for_address): Likewise. + * infcmd.c: Include cli/cli-utils.h. + (registers_info): Use skip_spaces. + * linux-tdep.c (read_mapping): Use skip_spaces_const. + (linux_info_proc): Likewise. + * linux-thread-db.c: Include cli/cli-utils.h. + (info_auto_load_libthread_db): Use skip_spaces_const. + * m32r-rom.c: Include cli/cli-utils.h. + (m32r_upload_command): Use skip_spaces. + * maint.c: Include cli/cli-utils.h. + (maintenance_translate_address): Use skip_spaces. + * mi/mi-parse.c: Include cli/cli-utils.h. + (mi_parse_argv): Use skip_spaces. + (mi_parse): Likewise. + * minsyms.c: Include cli/cli-utils.h. + (msymbol_hash_iw): Use skip_spaces_const. + * objc-lang.c: Include cli/cli-utils.h. + (parse_selector): Use skip_spaces. + (parse_method): Likewise. + * python/python.c: Include cli/cli-utils.h. + (python_interactive_command)[HAVE_PYTHON]: Use skip_spaces. + (python_command)[HAVE_PYTHON]: Likewise. + (python_interactive_command)[!HAVE_PYTHON]: Likewise. + * remote-m32r-sdi.c: Include cli/cli-utils.h. + (m32r_load): Use skip_spaces. + * serial.c: Include cli/cli-utils.h. + (serial_open): Use skip_spaces_const. + * stack.c: Include cli/cli-utils.h. + (parse_frame_specification_1): Use skip_spaces_const. + * symfile.c: Include cli/cli-utils.h. + (set_ext_lang_command): Use skip_spaces. + * symtab.c: Include cli/cli-utils.h. + (rbreak_command): Use skip_spaces. + * thread.c (thread_name_command): Use skip_spaces. + * tracepoint.c (validate_actionline): Use skip_spaces. + (encode_actions_1): Likewise. + (trace_find_range_command): Likewise. + (trace_find_outside_command): Likewise. + (trace_dump_actions): Likewise. + 2013-03-07 Pedro Alves * c-lang.c (parse_one_string): Cast argument to gdb_byte *. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index d71bb36cade..d6f8bc582f7 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -11768,8 +11768,7 @@ catch_syscall_split_args (char *arg) struct syscall s; /* Skip whitespace. */ - while (isspace (*arg)) - arg++; + arg = skip_spaces (arg); for (i = 0; i < 127 && arg[i] && !isspace (arg[i]); ++i) cur_name[i] = arg[i]; @@ -15370,9 +15369,7 @@ trace_pass_command (char *args, int from_tty) count = strtoul (args, &args, 10); /* Count comes first, then TP num. */ - while (*args && isspace ((int) *args)) - args++; - + args = skip_spaces (args); if (*args && strncasecmp (args, "all", 3) == 0) { struct breakpoint *b; diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c index 680cf992de9..0d37d578b45 100644 --- a/gdb/cli/cli-cmds.c +++ b/gdb/cli/cli-cmds.c @@ -47,6 +47,7 @@ #include "cli/cli-script.h" #include "cli/cli-setshow.h" #include "cli/cli-cmds.h" +#include "cli/cli-utils.h" #include "python/python.h" @@ -624,8 +625,7 @@ source_command (char *args, int from_tty) { /* Make sure leading white space does not break the comparisons. */ - while (isspace(args[0])) - args++; + args = skip_spaces (args); if (args[0] != '-') break; @@ -648,9 +648,7 @@ source_command (char *args, int from_tty) break; } - while (isspace (args[0])) - args++; - file = args; + file = skip_spaces (args); } source_script_with_search (file, from_tty, search_path); @@ -1141,8 +1139,7 @@ disassemble_command (char *arg, int from_tty) } } - while (isspace (*arg)) - ++arg; + arg = skip_spaces (arg); } if (! arg || ! *arg) @@ -1175,8 +1172,7 @@ disassemble_command (char *arg, int from_tty) /* Two arguments. */ int incl_flag = 0; low = pc; - while (isspace (*arg)) - arg++; + arg = skip_spaces (arg); if (arg[0] == '+') { ++arg; diff --git a/gdb/findcmd.c b/gdb/findcmd.c index 1f970c0eb53..cd26f04ebed 100644 --- a/gdb/findcmd.c +++ b/gdb/findcmd.c @@ -24,6 +24,7 @@ #include "gdbcmd.h" #include "value.h" #include "target.h" +#include "cli/cli-utils.h" /* Copied from bfd_put_bits. */ @@ -109,8 +110,7 @@ parse_find_args (char *args, ULONGEST *max_countp, } } - while (isspace (*s)) - ++s; + s = skip_spaces (s); } /* Get the search range. */ @@ -120,8 +120,7 @@ parse_find_args (char *args, ULONGEST *max_countp, if (*s == ',') ++s; - while (isspace (*s)) - ++s; + s = skip_spaces (s); if (*s == '+') { @@ -172,8 +171,7 @@ parse_find_args (char *args, ULONGEST *max_countp, struct type *t; ULONGEST pattern_buf_size_need; - while (isspace (*s)) - ++s; + s = skip_spaces (s); v = parse_to_comma_and_eval (&s); t = value_type (v); @@ -221,8 +219,7 @@ parse_find_args (char *args, ULONGEST *max_countp, if (*s == ',') ++s; - while (isspace (*s)) - ++s; + s = skip_spaces (s); } if (pattern_buf_end == pattern_buf) diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c index cbd8e40164e..3fab6683e00 100644 --- a/gdb/go32-nat.c +++ b/gdb/go32-nat.c @@ -100,6 +100,7 @@ #include "regcache.h" #include "gdb_string.h" #include "top.h" +#include "cli/cli-utils.h" #include /* might be required for __DJGPP_MINOR__ */ #include @@ -1702,8 +1703,7 @@ go32_sldt (char *arg, int from_tty) if (arg && *arg) { - while (*arg && isspace(*arg)) - arg++; + arg = skip_spaces (arg); if (*arg) { @@ -1773,8 +1773,7 @@ go32_sgdt (char *arg, int from_tty) if (arg && *arg) { - while (*arg && isspace(*arg)) - arg++; + arg = skip_spaces (arg); if (*arg) { @@ -1815,8 +1814,7 @@ go32_sidt (char *arg, int from_tty) if (arg && *arg) { - while (*arg && isspace(*arg)) - arg++; + arg = skip_spaces (arg); if (*arg) { @@ -1986,8 +1984,7 @@ go32_pde (char *arg, int from_tty) if (arg && *arg) { - while (*arg && isspace(*arg)) - arg++; + arg = skip_spaces (arg); if (*arg) { @@ -2037,8 +2034,7 @@ go32_pte (char *arg, int from_tty) if (arg && *arg) { - while (*arg && isspace(*arg)) - arg++; + arg = skip_spaces (arg); if (*arg) { @@ -2065,8 +2061,7 @@ go32_pte_for_address (char *arg, int from_tty) if (arg && *arg) { - while (*arg && isspace(*arg)) - arg++; + arg = skip_spaces (arg); if (*arg) addr = parse_and_eval_address (arg); diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 1ef3b487152..866388f3db7 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -56,6 +56,7 @@ #include "inf-loop.h" #include "continuations.h" #include "linespec.h" +#include "cli/cli-utils.h" /* Local functions: */ @@ -2185,12 +2186,8 @@ registers_info (char *addr_exp, int fpregs) char *start; const char *end; - /* Keep skipping leading white space. */ - if (isspace ((*addr_exp))) - { - addr_exp++; - continue; - } + /* Skip leading white space. */ + addr_exp = skip_spaces (addr_exp); /* Discard any leading ``$''. Check that there is something resembling a register following it. */ diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c index 04afbb17aaa..a132fc6b881 100644 --- a/gdb/linux-tdep.c +++ b/gdb/linux-tdep.c @@ -225,8 +225,7 @@ read_mapping (const char *line, p++; *endaddr = strtoulst (p, &p, 16); - while (*p && isspace (*p)) - p++; + p = skip_spaces_const (p); *permissions = p; while (*p && !isspace (*p)) p++; @@ -234,8 +233,7 @@ read_mapping (const char *line, *offset = strtoulst (p, &p, 16); - while (*p && isspace (*p)) - p++; + p = skip_spaces_const (p); *device = p; while (*p && !isspace (*p)) p++; @@ -243,8 +241,7 @@ read_mapping (const char *line, *inode = strtoulst (p, &p, 10); - while (*p && isspace (*p)) - p++; + p = skip_spaces_const (p); *filename = p; } @@ -409,8 +406,7 @@ linux_info_proc (struct gdbarch *gdbarch, char *args, printf_filtered (_("Process: %s\n"), pulongest (strtoulst (p, &p, 10))); - while (*p && isspace (*p)) - p++; + p = skip_spaces_const (p); if (*p == '(') { const char *ep = strchr (p, ')'); @@ -422,8 +418,7 @@ linux_info_proc (struct gdbarch *gdbarch, char *args, } } - while (*p && isspace (*p)) - p++; + p = skip_spaces_const (p); if (*p) printf_filtered (_("State: %c\n"), *p++); diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c index e3d893a9972..a698c659fc9 100644 --- a/gdb/linux-thread-db.c +++ b/gdb/linux-thread-db.c @@ -42,6 +42,7 @@ #include "linux-procfs.h" #include "linux-osdata.h" #include "auto-load.h" +#include "cli/cli-utils.h" #include #include @@ -1926,8 +1927,7 @@ info_auto_load_libthread_db (char *args, int from_tty) char *pids; int i; - while (isspace (*cs)) - cs++; + cs = skip_spaces_const (cs); if (*cs) error (_("'info auto-load libthread-db' does not accept any parameters")); diff --git a/gdb/m32r-rom.c b/gdb/m32r-rom.c index bf1af5cada4..aab59f0d547 100644 --- a/gdb/m32r-rom.c +++ b/gdb/m32r-rom.c @@ -40,6 +40,7 @@ #include #include "regcache.h" #include "gdb_bfd.h" +#include "cli/cli-utils.h" /* * All this stuff just to get my host computer's IP address! @@ -448,8 +449,7 @@ m32r_upload_command (char *args, int from_tty) /* Scan second colon in the output from the "ust" command. */ char *myIPaddress = strchr (strchr (buf, ':') + 1, ':') + 1; - while (isspace (*myIPaddress)) - myIPaddress++; + myIPaddress = skip_spaces (myIPaddress); if (!strncmp (myIPaddress, "0.0.", 4)) /* empty */ error (_("Please use 'set board-address' to " diff --git a/gdb/maint.c b/gdb/maint.c index 467e46b69cb..b835db6a548 100644 --- a/gdb/maint.c +++ b/gdb/maint.c @@ -38,6 +38,7 @@ #include "gdb_assert.h" #include "cli/cli-decode.h" +#include "cli/cli-utils.h" extern void _initialize_maint_cmds (void); @@ -460,8 +461,7 @@ maintenance_translate_address (char *arg, int from_tty) if (*p == '\000') /* End of command? */ error (_("Need to specify and
")); *p++ = '\000'; - while (isspace (*p)) - p++; /* Skip whitespace. */ + p = skip_spaces (p); ALL_OBJSECTIONS (objfile, sect) { diff --git a/gdb/mi/mi-parse.c b/gdb/mi/mi-parse.c index 265d99fa34b..407869d63ac 100644 --- a/gdb/mi/mi-parse.c +++ b/gdb/mi/mi-parse.c @@ -26,6 +26,7 @@ #include #include "gdb_string.h" +#include "cli/cli-utils.h" /* Like parse_escape, but leave the results as a host char, not a target char. */ @@ -114,8 +115,7 @@ mi_parse_argv (char *args, struct mi_parse *parse) char *arg; /* Skip leading white space. */ - while (isspace (*chp)) - chp++; + chp = skip_spaces (chp); /* Three possibilities: EOF, quoted string, or other text. */ switch (*chp) { @@ -244,8 +244,7 @@ mi_parse (char *cmd, char **token) cleanup = make_cleanup (mi_parse_cleanup, parse); /* Before starting, skip leading white space. */ - while (isspace (*cmd)) - cmd++; + cmd = skip_spaces (cmd); /* Find/skip any token and then extract it. */ for (chp = cmd; *chp >= '0' && *chp <= '9'; chp++) @@ -257,8 +256,7 @@ mi_parse (char *cmd, char **token) /* This wasn't a real MI command. Return it as a CLI_COMMAND. */ if (*chp != '-') { - while (isspace (*chp)) - chp++; + chp = skip_spaces (chp); parse->command = xstrdup (chp); parse->op = CLI_COMMAND; @@ -284,8 +282,7 @@ mi_parse (char *cmd, char **token) error (_("Undefined MI command: %s"), parse->command); /* Skip white space following the command. */ - while (isspace (*chp)) - chp++; + chp = skip_spaces (chp); /* Parse the --thread and --frame options, if present. At present, some important commands, like '-break-*' are implemented by @@ -343,8 +340,7 @@ mi_parse (char *cmd, char **token) if (*chp != '\0' && !isspace (*chp)) error (_("Invalid value for the '%s' option"), option); - while (isspace (*chp)) - chp++; + chp = skip_spaces (chp); } /* For new argv commands, attempt to return the parsed argument diff --git a/gdb/minsyms.c b/gdb/minsyms.c index 779b9f9ffd4..059b70a6dc7 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -50,6 +50,7 @@ #include "target.h" #include "cp-support.h" #include "language.h" +#include "cli/cli-utils.h" /* Accumulate the minimal symbols for each objfile in bunches of BUNCH_SIZE. At the end, copy them all into one newly allocated location on an objfile's @@ -85,8 +86,7 @@ msymbol_hash_iw (const char *string) while (*string && *string != '(') { - while (isspace (*string)) - ++string; + string = skip_spaces_const (string); if (*string && *string != '(') { hash = SYMBOL_HASH_NEXT (hash, *string); diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c index d4928aba6d9..734fc5d0146 100644 --- a/gdb/objc-lang.c +++ b/gdb/objc-lang.c @@ -44,6 +44,7 @@ #include "infcall.h" #include "valprint.h" #include "gdb_assert.h" +#include "cli/cli-utils.h" #include @@ -812,15 +813,13 @@ parse_selector (char *method, char **selector) s1 = method; - while (isspace (*s1)) - s1++; + s1 = skip_spaces (s1); if (*s1 == '\'') { found_quote = 1; s1++; } - while (isspace (*s1)) - s1++; + s1 = skip_spaces (s1); nselector = s1; s2 = s1; @@ -839,14 +838,12 @@ parse_selector (char *method, char **selector) } *s1++ = '\0'; - while (isspace (*s2)) - s2++; + s2 = skip_spaces (s2); if (found_quote) { if (*s2 == '\'') s2++; - while (isspace (*s2)) - s2++; + s2 = skip_spaces (s2); } if (selector != NULL) @@ -875,21 +872,18 @@ parse_method (char *method, char *type, char **class, s1 = method; - while (isspace (*s1)) - s1++; + s1 = skip_spaces (s1); if (*s1 == '\'') { found_quote = 1; s1++; } - while (isspace (*s1)) - s1++; + s1 = skip_spaces (s1); if ((s1[0] == '+') || (s1[0] == '-')) ntype = *s1++; - while (isspace (*s1)) - s1++; + s1 = skip_spaces (s1); if (*s1 != '[') return NULL; @@ -900,14 +894,12 @@ parse_method (char *method, char *type, char **class, s1++; s2 = s1; - while (isspace (*s2)) - s2++; + s2 = skip_spaces (s2); if (*s2 == '(') { s2++; - while (isspace (*s2)) - s2++; + s2 = skip_spaces (s2); ncategory = s2; while (isalnum (*s2) || (*s2 == '_')) s2++; @@ -935,15 +927,13 @@ parse_method (char *method, char *type, char **class, *s1++ = '\0'; s2++; - while (isspace (*s2)) - s2++; + s2 = skip_spaces (s2); if (found_quote) { if (*s2 != '\'') return NULL; s2++; - while (isspace (*s2)) - s2++; + s2 = skip_spaces (s2); } if (type != NULL) diff --git a/gdb/python/python.c b/gdb/python/python.c index 24be9068ca7..cd8ddfbfc18 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -32,6 +32,7 @@ #include "serial.h" #include "readline/tilde.h" #include "python.h" +#include "cli/cli-utils.h" #include @@ -222,8 +223,7 @@ python_interactive_command (char *arg, int from_tty) cleanup = make_cleanup_restore_integer (&interpreter_async); interpreter_async = 0; - while (arg && *arg && isspace (*arg)) - ++arg; + arg = skip_spaces (arg); ensure_python_env (get_current_arch (), current_language); @@ -367,8 +367,7 @@ python_command (char *arg, int from_tty) make_cleanup_restore_integer (&interpreter_async); interpreter_async = 0; - while (arg && *arg && isspace (*arg)) - ++arg; + arg = skip_spaces (arg); if (arg && *arg) { if (PyRun_SimpleString (arg)) @@ -1333,8 +1332,7 @@ free_type_printers (void *arg) static void python_interactive_command (char *arg, int from_tty) { - while (arg && *arg && isspace (*arg)) - ++arg; + arg = skip_spaces (arg); if (arg && *arg) error (_("Python scripting is not supported in this copy of GDB.")); else diff --git a/gdb/remote-m32r-sdi.c b/gdb/remote-m32r-sdi.c index 9d7e05dca26..653cc7eff7d 100644 --- a/gdb/remote-m32r-sdi.c +++ b/gdb/remote-m32r-sdi.c @@ -40,7 +40,7 @@ #include #include #include "gdb_bfd.h" - +#include "cli/cli-utils.h" #include "serial.h" @@ -1234,8 +1234,7 @@ m32r_load (char *args, int from_tty) { char *arg; - while (isspace (*args)) - args++; + args = skip_spaces (arg); arg = args; diff --git a/gdb/serial.c b/gdb/serial.c index f0cd6b1c982..3202b0f6baa 100644 --- a/gdb/serial.c +++ b/gdb/serial.c @@ -22,6 +22,7 @@ #include "serial.h" #include "gdb_string.h" #include "gdbcmd.h" +#include "cli/cli-utils.h" extern void _initialize_serial (void); @@ -194,8 +195,7 @@ serial_open (const char *name) ops = serial_interface_lookup ("pipe"); /* Discard ``|'' and any space before the command itself. */ ++open_name; - while (isspace (*open_name)) - ++open_name; + open_name = skip_spaces_const (open_name); } /* Check for a colon, suggesting an IP address/port pair. Do this *after* checking for all the interesting prefixes. We diff --git a/gdb/stack.c b/gdb/stack.c index 147d815fa7a..f2aeb101bf9 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -46,6 +46,7 @@ #include "disasm.h" #include "inline-frame.h" #include "linespec.h" +#include "cli/cli-utils.h" #include "gdb_assert.h" #include @@ -1249,8 +1250,7 @@ parse_frame_specification_1 (const char *frame_exp, const char *message, const char *p; /* Skip leading white space, bail of EOL. */ - while (isspace (*frame_exp)) - frame_exp++; + frame_exp = skip_spaces_const (frame_exp); if (!*frame_exp) break; diff --git a/gdb/symfile.c b/gdb/symfile.c index 22a7970fa95..5ed25913cb6 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -56,6 +56,7 @@ #include "remote.h" #include "stack.h" #include "gdb_bfd.h" +#include "cli/cli-utils.h" #include #include @@ -2738,8 +2739,7 @@ set_ext_lang_command (char *args, int from_tty, struct cmd_list_element *e) *cp++ = '\0'; /* Find beginning of second arg, which should be a source language. */ - while (*cp && isspace (*cp)) - cp++; + cp = skip_spaces (cp); if (*cp == '\0') error (_("'%s': two arguments required -- " diff --git a/gdb/symtab.c b/gdb/symtab.c index de2dbeee1cf..c0e588455e1 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -40,6 +40,7 @@ #include "go-lang.h" #include "p-lang.h" #include "addrmap.h" +#include "cli/cli-utils.h" #include "hashtab.h" @@ -3879,8 +3880,7 @@ rbreak_command (char *regexp, int from_tty) file_name[colon_index--] = 0; files = &file_name; nfiles = 1; - regexp = colon + 1; - while (isspace (*regexp)) regexp++; + regexp = skip_spaces (colon + 1); } } diff --git a/gdb/thread.c b/gdb/thread.c index 6b53c7a2ebb..24e64133351 100644 --- a/gdb/thread.c +++ b/gdb/thread.c @@ -1300,8 +1300,7 @@ thread_name_command (char *arg, int from_tty) if (ptid_equal (inferior_ptid, null_ptid)) error (_("No thread selected")); - while (arg && isspace (*arg)) - ++arg; + arg = skip_spaces (arg); info = inferior_thread (); xfree (info->name); diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index c36c1a7bc85..2a4b245493f 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -709,8 +709,7 @@ validate_actionline (char **line, struct breakpoint *b) if (*line == NULL) return; - for (p = *line; isspace ((int) *p);) - p++; + p = skip_spaces (*line); /* Symbol lookup etc. */ if (*p == '\0') /* empty line: just prompt for another line. */ @@ -732,8 +731,7 @@ validate_actionline (char **line, struct breakpoint *b) do { /* Repeat over a comma-separated list. */ QUIT; /* Allow user to bail out with ^C. */ - while (isspace ((int) *p)) - p++; + p = skip_spaces (p); if (*p == '$') /* Look for special pseudo-symbols. */ { @@ -798,8 +796,7 @@ validate_actionline (char **line, struct breakpoint *b) do { /* Repeat over a comma-separated list. */ QUIT; /* Allow user to bail out with ^C. */ - while (isspace ((int) *p)) - p++; + p = skip_spaces (p); tmp_p = p; for (loc = t->base.loc; loc; loc = loc->next) @@ -832,8 +829,7 @@ validate_actionline (char **line, struct breakpoint *b) { char *steparg; /* In case warning is necessary. */ - while (isspace ((int) *p)) - p++; + p = skip_spaces (p); steparg = p; if (*p == '\0' || (t->step_count = strtol (p, &p, 0)) == 0) @@ -1379,8 +1375,7 @@ encode_actions_1 (struct command_line *action, { QUIT; /* Allow user to bail out with ^C. */ action_exp = action->line; - while (isspace ((int) *action_exp)) - action_exp++; + action_exp = skip_spaces (action_exp); cmd = lookup_cmd (&action_exp, cmdlist, "", -1, 1); if (cmd == 0) @@ -1395,8 +1390,7 @@ encode_actions_1 (struct command_line *action, do { /* Repeat over a comma-separated list. */ QUIT; /* Allow user to bail out with ^C. */ - while (isspace ((int) *action_exp)) - action_exp++; + action_exp = skip_spaces (action_exp); if (0 == strncasecmp ("$reg", action_exp, 4)) { @@ -1557,8 +1551,7 @@ encode_actions_1 (struct command_line *action, do { /* Repeat over a comma-separated list. */ QUIT; /* Allow user to bail out with ^C. */ - while (isspace ((int) *action_exp)) - action_exp++; + action_exp = skip_spaces (action_exp); { struct cleanup *old_chain = NULL; @@ -2589,8 +2582,7 @@ trace_find_range_command (char *args, int from_tty) if (0 != (tmp = strchr (args, ','))) { *tmp++ = '\0'; /* Terminate start address. */ - while (isspace ((int) *tmp)) - tmp++; + tmp = skip_spaces (tmp); start = parse_and_eval_address (args); stop = parse_and_eval_address (tmp); } @@ -2623,8 +2615,7 @@ trace_find_outside_command (char *args, int from_tty) if (0 != (tmp = strchr (args, ','))) { *tmp++ = '\0'; /* Terminate start address. */ - while (isspace ((int) *tmp)) - tmp++; + tmp = skip_spaces (tmp); start = parse_and_eval_address (args); stop = parse_and_eval_address (tmp); } @@ -2819,8 +2810,7 @@ trace_dump_actions (struct command_line *action, QUIT; /* Allow user to bail out with ^C. */ action_exp = action->line; - while (isspace ((int) *action_exp)) - action_exp++; + action_exp = skip_spaces (action_exp); /* The collection actions to be done while stepping are bracketed by the commands "while-stepping" and "end". */ @@ -2858,8 +2848,7 @@ trace_dump_actions (struct command_line *action, QUIT; /* Allow user to bail out with ^C. */ if (*action_exp == ',') action_exp++; - while (isspace ((int) *action_exp)) - action_exp++; + action_exp = skip_spaces (action_exp); next_comma = strchr (action_exp, ','); -- 2.30.2