/* CLI utilities.
- Copyright (C) 2011-2016 Free Software Foundation, Inc.
+ Copyright (C) 2011-2017 Free Software Foundation, Inc.
This file is part of GDB.
/* Convenience. Like get_number_trailer, but with no TRAILER. */
-extern int get_number_const (const char **);
+extern int get_number (const char **);
-/* Like get_number_const, but takes a non-const "char **". */
+/* Like the above, but takes a non-const "char **". */
extern int get_number (char **);
/* Reverse S to the last non-whitespace character without skipping past
START. */
-extern char *remove_trailing_whitespace (const char *start, char *s);
+extern const char *remove_trailing_whitespace (const char *start,
+ const char *s);
+
+/* Same, for non-const S. */
+
+static inline char *
+remove_trailing_whitespace (const char *start, char *s)
+{
+ return (char *) remove_trailing_whitespace (start, (const char *) s);
+}
/* A helper function to extract an argument from *ARG. An argument is
delimited by whitespace. The return value is either NULL if no
extern char *extract_arg (char **arg);
-/* A const-correct version of "extract_arg".
+/* A const-correct version of the above.
Since the returned value is xmalloc'd, it eventually needs to be
xfree'ed, which prevents us from making it const as well. */
-extern char *extract_arg_const (const char **arg);
+extern char *extract_arg (const 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);
+extern int check_for_argument (const char **str, const char *arg, int arg_len);
+
+/* Same, for non-const STR. */
+
+static inline int
+check_for_argument (char **str, const char *arg, int arg_len)
+{
+ return check_for_argument (const_cast<const char **> (str),
+ arg, arg_len);
+}
#endif /* CLI_UTILS_H */