+2021-05-17 Simon Marchi <simon.marchi@polymtl.ca>
+
+ * cli/cli-decode.h (prefixname): Make const, move implementation
+ to cli/cli-decode.c.
+ * cli/cli-decode.c (cmd_list_element::prefixname): New.
+
2021-05-16 Weimin Pan <weimin.pan@oracle.com>
* ctfread.c (new_symbol): Set function address.
cmd->completer_handle_brkchars = func;
}
+std::string
+cmd_list_element::prefixname () const
+{
+ if (this->prefixlist == nullptr)
+ /* Not a prefix command. */
+ return "";
+
+ std::string prefixname;
+ if (this->prefix != nullptr)
+ prefixname = this->prefix->prefixname ();
+
+ prefixname += this->name;
+ prefixname += " ";
+
+ return prefixname;
+}
+
/* Add element named NAME.
Space for NAME and DOC must be allocated by the caller.
CLASS is the top level category into which commands are broken down
space. It is used before the word "command" in describing the
commands reached through this prefix.
- For non-prefix commands, an empty string is returned. */
- std::string prefixname ()
- {
- if (prefixlist == nullptr)
- /* Not a prefix command. */
- return "";
-
- std::string prefixname;
- if (prefix != nullptr)
- prefixname = prefix->prefixname ();
- prefixname += name;
- prefixname += " ";
- return prefixname;
- }
+ For non-prefix commands, return an empty string. */
+ std::string prefixname () const;
/* Points to next command in this list. */
struct cmd_list_element *next = nullptr;