framefilter quit: Code cleanup: Reindentation

Nothing significant but I find code more clear with less deep indentation.

gdb/ChangeLog
2015-02-11  Jan Kratochvil  <jan.kratochvil@redhat.com>

	* python/py-framefilter.c (py_print_frame): Put conditional code paths
	with goto first, indent the former else codepath left.  Put variable
	'elided' to a new inner block.
This commit is contained in:
Jan Kratochvil
2015-02-11 14:37:40 +01:00
parent 8d4a54e2fb
commit 34019068f0
2 changed files with 149 additions and 150 deletions

View File

@ -1,3 +1,9 @@
2015-02-11 Jan Kratochvil <jan.kratochvil@redhat.com>
* python/py-framefilter.c (py_print_frame): Put conditional code paths
with goto first, indent the former else codepath left. Put variable
'elided' to a new inner block.
2015-02-11 Jan Kratochvil <jan.kratochvil@redhat.com>
* python/py-framefilter.c (py_print_frame): Whitespacing fixes.

View File

@ -1016,7 +1016,7 @@ py_print_frame (PyObject *filter, int flags,
struct frame_info *frame = NULL;
struct cleanup *cleanup_stack = make_cleanup (null_cleanup, NULL);
struct value_print_options opts;
PyObject *py_inf_frame, *elided;
PyObject *py_inf_frame;
int print_level, print_frame_info, print_args, print_locals;
volatile struct gdb_exception except;
@ -1058,12 +1058,9 @@ py_print_frame (PyObject *filter, int flags,
if (py_mi_print_variables (filter, out, &opts,
args_type, frame) == EXT_LANG_BT_ERROR)
goto error;
else
{
do_cleanups (cleanup_stack);
return EXT_LANG_BT_COMPLETED;
}
}
/* -stack-list-locals does not require a
wrapping frame attribute. */
@ -1092,8 +1089,10 @@ py_print_frame (PyObject *filter, int flags,
if (PyObject_HasAttrString (filter, "address"))
{
PyObject *paddr = PyObject_CallMethod (filter, "address", NULL);
if (paddr != NULL)
{
if (paddr == NULL)
goto error;
if (paddr != Py_None)
{
address = PyLong_AsLong (paddr);
@ -1101,9 +1100,6 @@ py_print_frame (PyObject *filter, int flags,
}
Py_DECREF (paddr);
}
else
goto error;
}
}
/* Print frame level. MI does not require the level if
@ -1167,11 +1163,11 @@ py_print_frame (PyObject *filter, int flags,
if (PyObject_HasAttrString (filter, "function"))
{
PyObject *py_func = PyObject_CallMethod (filter, "function", NULL);
if (py_func != NULL)
{
const char *function = NULL;
if (py_func == NULL)
goto error;
if (gdbpy_is_string (py_func))
{
char *function_to_free;
@ -1223,9 +1219,6 @@ py_print_frame (PyObject *filter, int flags,
}
Py_DECREF (py_func);
}
else
goto error;
}
}
@ -1254,8 +1247,9 @@ py_print_frame (PyObject *filter, int flags,
{
PyObject *py_fn = PyObject_CallMethod (filter, "filename", NULL);
if (py_fn != NULL)
{
if (py_fn == NULL)
goto error;
if (py_fn != Py_None)
{
char *filename = python_string_to_host_string (py_fn);
@ -1284,17 +1278,15 @@ py_print_frame (PyObject *filter, int flags,
}
Py_DECREF (py_fn);
}
else
goto error;
}
if (PyObject_HasAttrString (filter, "line"))
{
PyObject *py_line = PyObject_CallMethod (filter, "line", NULL);
int line;
if (py_line != NULL)
{
if (py_line == NULL)
goto error;
if (py_line != Py_None)
{
line = PyLong_AsLong (py_line);
@ -1313,9 +1305,6 @@ py_print_frame (PyObject *filter, int flags,
}
Py_DECREF (py_line);
}
else
goto error;
}
}
/* For MI we need to deal with the "children" list population of
@ -1341,6 +1330,9 @@ py_print_frame (PyObject *filter, int flags,
goto error;
}
{
PyObject *elided;
/* Finally recursively print elided frames, if any. */
elided = get_py_iter_from_func (filter, "elided");
if (elided == NULL)
@ -1374,6 +1366,7 @@ py_print_frame (PyObject *filter, int flags,
if (item == NULL && PyErr_Occurred ())
goto error;
}
}
do_cleanups (cleanup_stack);