Using the new ScriptInterpreterObject in the implementation of synthetic children to enhance type safety
Several places in the ScriptInterpreter interface used StringList objects where an std::string would suffice - Fixed
Refactoring calls that generated special-purposes functions in the Python interpreter to use helper functions instead of duplicating blobs of code
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@152164 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Commands/CommandObjectCommands.cpp b/source/Commands/CommandObjectCommands.cpp
index bb928d5..c881a6f 100644
--- a/source/Commands/CommandObjectCommands.cpp
+++ b/source/Commands/CommandObjectCommands.cpp
@@ -1571,33 +1571,25 @@
out_stream->Flush();
return;
}
- StringList funct_name_sl;
+ std::string funct_name_str;
if (!interpreter->GenerateScriptAliasFunction (m_user_input,
- funct_name_sl))
+ funct_name_str))
{
out_stream->Printf ("Unable to create function: no script attached.\n");
out_stream->Flush();
return;
}
- if (funct_name_sl.GetSize() == 0)
+ if (funct_name_str.empty())
{
out_stream->Printf ("Unable to obtain a function name: no script attached.\n");
out_stream->Flush();
return;
}
- const char *funct_name = funct_name_sl.GetStringAtIndex(0);
- if (!funct_name || !funct_name[0])
- {
- out_stream->Printf ("Invalid function name: no script attached.\n");
- out_stream->Flush();
- return;
- }
-
// everything should be fine now, let's add this alias
CommandObjectSP command_obj_sp(new CommandObjectPythonFunction(m_interpreter,
m_cmd_name,
- funct_name,
+ funct_name_str.c_str(),
m_synchronous));
if (!m_interpreter.AddUserCommand(m_cmd_name, command_obj_sp, true))