}
/* String representations of gdb's format codes. */
-char *varobj_format_string[] =
+const char *varobj_format_string[] =
{ "natural", "binary", "decimal", "hexadecimal", "octal", "zero-hexadecimal" };
/* True if we want to allow Python-based pretty-printing. */
if (var->saved_item != NULL)
{
value_free (var->saved_item->value);
- xfree (var->saved_item);
+ delete var->saved_item;
var->saved_item = NULL;
}
}
can_mention ? cchanged : NULL, i,
item);
- xfree (item);
+ delete item;
}
else
{
gdbpy_enter_varobj enter_py (var);
mainmod = PyImport_AddModule ("__main__");
- gdbpy_ref globals (PyModule_GetDict (mainmod));
+ gdbpy_ref<> globals (PyModule_GetDict (mainmod));
Py_INCREF (globals.get ());
- gdbpy_ref constructor (PyRun_String (visualizer, Py_eval_input,
- globals.get (), globals.get ()));
+ gdbpy_ref<> constructor (PyRun_String (visualizer, Py_eval_input,
+ globals.get (), globals.get ()));
if (constructor == NULL)
{
type = check_typedef (type);
- if (TYPE_CODE (type) == TYPE_CODE_REF)
+ if (TYPE_IS_REFERENCE (type))
type = get_target_type (type);
type = check_typedef (type);
struct value *new_val = NULL;
struct varobj *var = *var_handle;
int within_scope = 0;
- struct cleanup *back_to;
/* Only root variables can be updated... */
if (!is_root_p (var))
/* Not a root var. */
return NULL;
- back_to = make_cleanup_restore_current_thread ();
+ scoped_restore_current_thread restore_thread;
/* Determine whether the variable is still around. */
if (var->root->valid_block == NULL || var->root->floating)
END_CATCH
}
- do_cleanups (back_to);
-
return new_val;
}
{
struct value *replacement;
- gdbpy_ref output (apply_varobj_pretty_printer (value_formatter,
- &replacement,
- &stb));
+ gdbpy_ref<> output (apply_varobj_pretty_printer (value_formatter,
+ &replacement,
+ &stb));
/* If we have string like output ... */
if (output != NULL)