From e6f0bce70d56cee13a0bf5ca4f72687b3203e6c9 Mon Sep 17 00:00:00 2001 From: Hui Zhu Date: Thu, 5 Jul 2012 01:00:43 +0000 Subject: [PATCH] 2012-07-05 Hui Zhu * breakpoint.c (check_for_argument): Move to file cli/cli-utils.c. * cli/cli-utils.c (check_for_argument): New function. * cli/cli-utils.h (check_for_argument): Ditto. --- gdb/ChangeLog | 6 ++++++ gdb/breakpoint.c | 17 ----------------- gdb/cli/cli-utils.c | 14 ++++++++++++++ gdb/cli/cli-utils.h | 6 ++++++ 4 files changed, 26 insertions(+), 17 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 087ed25..ede73f2 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2012-07-05 Hui Zhu + + * breakpoint.c (check_for_argument): Move to file cli/cli-utils.c. + * cli/cli-utils.c (check_for_argument): New function. + * cli/cli-utils.h (check_for_argument): Ditto. + 2012-07-04 H.J. Lu * NEWS: Mention x32 ABI support. diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 555694e..6b9faf3 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -11085,23 +11085,6 @@ watch_command_wrapper (char *arg, int from_tty, int internal) watch_command_1 (arg, hw_write, from_tty, 0, internal); } -/* A helper function that looks for an argument at the start of a - string. The argument must also either be at the end of the string, - or be followed by whitespace. Returns 1 if it finds the argument, - 0 otherwise. If the argument is found, it updates *STR. */ - -static int -check_for_argument (char **str, char *arg, int arg_len) -{ - if (strncmp (*str, arg, arg_len) == 0 - && ((*str)[arg_len] == '\0' || isspace ((*str)[arg_len]))) - { - *str += arg_len; - return 1; - } - return 0; -} - /* A helper function that looks for the "-location" argument and then calls watch_command_1. */ diff --git a/gdb/cli/cli-utils.c b/gdb/cli/cli-utils.c index 3239a46..81a4acc 100644 --- a/gdb/cli/cli-utils.c +++ b/gdb/cli/cli-utils.c @@ -286,3 +286,17 @@ extract_arg (char **arg) return copy; } + +/* See documentation in cli-utils.h. */ + +int +check_for_argument (char **str, char *arg, int arg_len) +{ + if (strncmp (*str, arg, arg_len) == 0 + && ((*str)[arg_len] == '\0' || isspace ((*str)[arg_len]))) + { + *str += arg_len; + return 1; + } + return 0; +} diff --git a/gdb/cli/cli-utils.h b/gdb/cli/cli-utils.h index 5f8a91d..9fb12ba 100644 --- a/gdb/cli/cli-utils.h +++ b/gdb/cli/cli-utils.h @@ -114,4 +114,10 @@ extern char *remove_trailing_whitespace (const char *start, char *s); extern char *extract_arg (char **arg); +/* A helper function that looks for an argument at the start of a + string. The argument must also either be at the end of the string, + or be followed by whitespace. Returns 1 if it finds the argument, + 0 otherwise. If the argument is found, it updates *STR. */ +extern int check_for_argument (char **str, char *arg, int arg_len); + #endif /* CLI_UTILS_H */ -- 2.7.4