Define YYOBJ in terms of YYFILES
[deliverable/binutils-gdb.git] / gdb / ada-varobj.c
index 52e3247c9acc6cb130cbca76fba0a8eedf4db83d..267ee2668bd6fa3ba057a138466a3c29813b1799 100644 (file)
@@ -79,14 +79,10 @@ ada_varobj_decode_var (struct value **value_ptr, struct type **type_ptr)
 static std::string
 ada_varobj_scalar_image (struct type *type, LONGEST val)
 {
-  struct ui_file *buf = mem_fileopen ();
-  struct cleanup *cleanups = make_cleanup_ui_file_delete (buf);
+  string_file buf;
 
-  ada_print_scalar (type, val, buf);
-  std::string result = ui_file_as_string (buf);
-  do_cleanups (cleanups);
-
-  return result;
+  ada_print_scalar (type, val, &buf);
+  return std::move (buf.string ());
 }
 
 /* Assuming that the (PARENT_VALUE, PARENT_TYPE) pair designates
@@ -808,17 +804,10 @@ static std::string
 ada_varobj_get_value_image (struct value *value,
                            struct value_print_options *opts)
 {
-  struct ui_file *buffer;
-  struct cleanup *old_chain;
-
-  buffer = mem_fileopen ();
-  old_chain = make_cleanup_ui_file_delete (buffer);
+  string_file buffer;
 
-  common_val_print (value, buffer, 0, opts, current_language);
-  std::string result = ui_file_as_string (buffer);
-
-  do_cleanups (old_chain);
-  return result;
+  common_val_print (value, &buffer, 0, opts, current_language);
+  return std::move (buffer.string ());
 }
 
 /* Assuming that the (VALUE, TYPE) pair designates an array varobj,
@@ -940,7 +929,7 @@ ada_value_of_variable (const struct varobj *var,
 
 /* Implement the "value_is_changeable_p" routine for Ada.  */
 
-static int
+static bool
 ada_value_is_changeable_p (const struct varobj *var)
 {
   struct type *type = var->value ? value_type (var->value) : var->type;
@@ -950,7 +939,7 @@ ada_value_is_changeable_p (const struct varobj *var)
     {
       /* This is in reality a pointer to an unconstrained array.
         its value is changeable.  */
-      return 1;
+      return true;
     }
 
   if (ada_is_string_type (type))
@@ -958,7 +947,7 @@ ada_value_is_changeable_p (const struct varobj *var)
       /* We display the contents of the string in the array's
         "value" field.  The contents can change, so consider
         that the array is changeable.  */
-      return 1;
+      return true;
     }
 
   return varobj_default_value_is_changeable_p (var);
@@ -966,11 +955,10 @@ ada_value_is_changeable_p (const struct varobj *var)
 
 /* Implement the "value_has_mutated" routine for Ada.  */
 
-static int
+static bool
 ada_value_has_mutated (const struct varobj *var, struct value *new_val,
                       struct type *new_type)
 {
-  int i;
   int from = -1;
   int to = -1;
 
@@ -978,7 +966,7 @@ ada_value_has_mutated (const struct varobj *var, struct value *new_val,
      has mutated.  */
   if (ada_varobj_get_number_of_children (new_val, new_type)
       != var->num_children)
-    return 1;
+    return true;
 
   /* If the number of fields have remained the same, then we need
      to check the name of each field.  If they remain the same,
@@ -994,13 +982,13 @@ ada_value_has_mutated (const struct varobj *var, struct value *new_val,
      has mutated or not. So just assume it hasn't.  */
 
   varobj_restrict_range (var->children, &from, &to);
-  for (i = from; i < to; i++)
+  for (int i = from; i < to; i++)
     if (ada_varobj_get_name_of_child (new_val, new_type,
                                      var->name.c_str (), i)
-       != VEC_index (varobj_p, var->children, i)->name)
-      return 1;
+       != var->children[i]->name)
+      return true;
 
-  return 0;
+  return false;
 }
 
 /* varobj operations for ada.  */
This page took 0.02632 seconds and 4 git commands to generate.