mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-27 06:17:47 +08:00
gdb, python: do minor modernization in execute_gdb_command
Use nullptr instead of NULL and boolify two local variables in execute_gdb_command. Approved-By: Tom Tromey <tom@tromey.com>
This commit is contained in:
@ -621,31 +621,32 @@ static PyObject *
|
|||||||
execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw)
|
execute_gdb_command (PyObject *self, PyObject *args, PyObject *kw)
|
||||||
{
|
{
|
||||||
const char *arg;
|
const char *arg;
|
||||||
PyObject *from_tty_obj = NULL, *to_string_obj = NULL;
|
PyObject *from_tty_obj = nullptr;
|
||||||
int from_tty, to_string;
|
PyObject *to_string_obj = nullptr;
|
||||||
static const char *keywords[] = { "command", "from_tty", "to_string", NULL };
|
static const char *keywords[] = { "command", "from_tty", "to_string",
|
||||||
|
nullptr };
|
||||||
|
|
||||||
if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s|O!O!", keywords, &arg,
|
if (!gdb_PyArg_ParseTupleAndKeywords (args, kw, "s|O!O!", keywords, &arg,
|
||||||
&PyBool_Type, &from_tty_obj,
|
&PyBool_Type, &from_tty_obj,
|
||||||
&PyBool_Type, &to_string_obj))
|
&PyBool_Type, &to_string_obj))
|
||||||
return NULL;
|
return nullptr;
|
||||||
|
|
||||||
from_tty = 0;
|
bool from_tty = false;
|
||||||
if (from_tty_obj)
|
if (from_tty_obj != nullptr)
|
||||||
{
|
{
|
||||||
int cmp = PyObject_IsTrue (from_tty_obj);
|
int cmp = PyObject_IsTrue (from_tty_obj);
|
||||||
if (cmp < 0)
|
if (cmp < 0)
|
||||||
return NULL;
|
return nullptr;
|
||||||
from_tty = cmp;
|
from_tty = (cmp != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
to_string = 0;
|
bool to_string = false;
|
||||||
if (to_string_obj)
|
if (to_string_obj != nullptr)
|
||||||
{
|
{
|
||||||
int cmp = PyObject_IsTrue (to_string_obj);
|
int cmp = PyObject_IsTrue (to_string_obj);
|
||||||
if (cmp < 0)
|
if (cmp < 0)
|
||||||
return NULL;
|
return nullptr;
|
||||||
to_string = cmp;
|
to_string = (cmp != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string to_string_res;
|
std::string to_string_res;
|
||||||
|
Reference in New Issue
Block a user