Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: <gdb-patches@sourceware.org>
Subject: Rename field 'lang' to 'lang_ops'  ([PATCH 1/2] New field la_varobj_ops in struct language_defn)
Date: Sun, 27 Oct 2013 12:04:00 -0000	[thread overview]
Message-ID: <526D00E9.7040407@codesourcery.com> (raw)
In-Reply-To: <20131025033415.GB4769@adacore.com>

On 10/25/2013 11:34 AM, Joel Brobecker wrote:
> Also, as a followup, I think it would be beneficial if we renamed
> field "lang" in the varobj_root into "lang_ops". I think it's more
> descriptive, especially since "lang" is used elsewhere with different
> meanings (and types).

Here is the patch to rename 'lang' to 'lang_ops'.  Committed as obvious.

-- 
Yao (齐尧)

gdb:

2013-10-27  Yao Qi  <yao@codesourcery.com>

	* varobj.c (struct varobj_root) <lang>: Rename to 'lang_ops'.
	(varobj_create, varobj_get_path_expr): Update.
	(varobj_value_has_mutated, varobj_update): Likewise.
	(create_child_with_value, new_root_variable): Likewise.
	(number_of_children, name_of_variable): Likewise.
	(value_of_child, my_value_of_variable): Likewise.
	(varobj_value_is_changeable_p): Likewise.
---
 gdb/varobj.c |   30 +++++++++++++++---------------
 1 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/gdb/varobj.c b/gdb/varobj.c
index 60ed810..e1b9909 100644
--- a/gdb/varobj.c
+++ b/gdb/varobj.c
@@ -102,7 +102,7 @@ struct varobj_root
 
   /* Language-related operations for this variable and its
      children.  */
-  const struct lang_varobj_ops *lang;
+  const struct lang_varobj_ops *lang_ops;
 
   /* The varobj for this root node.  */
   struct varobj *rootvar;
@@ -432,7 +432,7 @@ varobj_create (char *objname,
 	  }
 
       /* Set language info */
-      var->root->lang = var->root->exp->language_defn->la_varobj_ops;
+      var->root->lang_ops = var->root->exp->language_defn->la_varobj_ops;
 
       install_new_value (var, value, 1 /* Initial assignment */);
 
@@ -1122,7 +1122,7 @@ varobj_get_path_expr (struct varobj *var)
 	 when creating varobj, so here it should be
 	 child varobj.  */
       gdb_assert (!is_root_p (var));
-      return (*var->root->lang->path_expr_of_child) (var);
+      return (*var->root->lang_ops->path_expr_of_child) (var);
     }
 }
 
@@ -1661,8 +1661,8 @@ varobj_value_has_mutated (struct varobj *var, struct value *new_value,
   if (var->num_children < 0)
     return 0;
 
-  if (var->root->lang->value_has_mutated)
-    return var->root->lang->value_has_mutated (var, new_value, new_type);
+  if (var->root->lang_ops->value_has_mutated)
+    return var->root->lang_ops->value_has_mutated (var, new_value, new_type);
   else
     return 0;
 }
@@ -1770,7 +1770,7 @@ varobj_update (struct varobj **varp, int explicit)
 	  if (new)
 	    new_type = value_type (new);
 	  else
-	    new_type = v->root->lang->type_of_child (v->parent, v->index);
+	    new_type = v->root->lang_ops->type_of_child (v->parent, v->index);
 
 	  if (varobj_value_has_mutated (v, new, new_type))
 	    {
@@ -2146,8 +2146,8 @@ create_child_with_value (struct varobj *parent, int index, char *name,
     child->type = value_actual_type (value, 0, NULL);
   else
     /* Otherwise, we must compute the type.  */
-    child->type = (*child->root->lang->type_of_child) (child->parent, 
-						       child->index);
+    child->type = (*child->root->lang_ops->type_of_child) (child->parent, 
+							   child->index);
   install_new_value (child, value, 1);
 
   return child;
@@ -2200,7 +2200,7 @@ new_root_variable (void)
   struct varobj *var = new_variable ();
 
   var->root = (struct varobj_root *) xmalloc (sizeof (struct varobj_root));
-  var->root->lang = NULL;
+  var->root->lang_ops = NULL;
   var->root->exp = NULL;
   var->root->valid_block = NULL;
   var->root->frame = null_frame_id;
@@ -2366,7 +2366,7 @@ variable_language (struct varobj *var)
 static int
 number_of_children (struct varobj *var)
 {
-  return (*var->root->lang->number_of_children) (var);
+  return (*var->root->lang_ops->number_of_children) (var);
 }
 
 /* What is the expression for the root varobj VAR? Returns a malloc'd
@@ -2374,7 +2374,7 @@ number_of_children (struct varobj *var)
 static char *
 name_of_variable (struct varobj *var)
 {
-  return (*var->root->lang->name_of_variable) (var);
+  return (*var->root->lang_ops->name_of_variable) (var);
 }
 
 /* What is the name of the INDEX'th child of VAR? Returns a malloc'd
@@ -2382,7 +2382,7 @@ name_of_variable (struct varobj *var)
 static char *
 name_of_child (struct varobj *var, int index)
 {
-  return (*var->root->lang->name_of_child) (var, index);
+  return (*var->root->lang_ops->name_of_child) (var, index);
 }
 
 /* If frame associated with VAR can be found, switch
@@ -2569,7 +2569,7 @@ value_of_child (struct varobj *parent, int index)
 {
   struct value *value;
 
-  value = (*parent->root->lang->value_of_child) (parent, index);
+  value = (*parent->root->lang_ops->value_of_child) (parent, index);
 
   return value;
 }
@@ -2582,7 +2582,7 @@ my_value_of_variable (struct varobj *var, enum varobj_display_formats format)
     {
       if (var->dynamic->pretty_printer != NULL)
 	return varobj_value_get_print_value (var->value, var->format, var);
-      return (*var->root->lang->value_of_variable) (var, format);
+      return (*var->root->lang_ops->value_of_variable) (var, format);
     }
   else
     return NULL;
@@ -2761,7 +2761,7 @@ varobj_editable_p (struct varobj *var)
 int
 varobj_value_is_changeable_p (struct varobj *var)
 {
-  return var->root->lang->value_is_changeable_p (var);
+  return var->root->lang_ops->value_is_changeable_p (var);
 }
 
 /* Return 1 if that varobj is floating, that is is always evaluated in the
-- 
1.7.7.6


      parent reply	other threads:[~2013-10-27 12:04 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-18  0:54 [PATCH 1/2] New field la_varobj_ops in struct language_defn Yao Qi
2013-10-18  0:54 ` [PATCH 2/2] Remove varobj_language_string, languages and varobj_languages Yao Qi
2013-10-25  4:15   ` Joel Brobecker
2013-10-25 13:38     ` Yao Qi
2013-10-26  4:09       ` Joel Brobecker
2013-10-28 12:50     ` [PATCH 1/3] Constify 'la_name' in struct language_defn Yao Qi
2013-10-28 12:50       ` [PATCH 2/3] New field 'la_natural_name' " Yao Qi
2013-10-28 18:34         ` Tom Tromey
2013-10-29  8:41         ` Yao Qi
2013-11-07  7:18           ` Yao Qi
2013-10-28 12:50       ` [PATCH 3/3] Remove varobj_language_string, languages and varobj_languages Yao Qi
2013-10-28 18:52         ` Tom Tromey
2013-10-29  8:33           ` Yao Qi
2013-10-29 16:49             ` Eli Zaretskii
2013-10-31  3:10               ` Yao Qi
2013-10-31 17:31                 ` Eli Zaretskii
2013-11-07  7:23               ` Yao Qi
2013-10-28 15:02       ` [PATCH 1/3] Constify 'la_name' in struct language_defn Tom Tromey
2013-10-25  3:34 ` [PATCH 1/2] New field la_varobj_ops " Joel Brobecker
2013-10-25 13:16   ` Yao Qi
2013-10-27 12:04   ` Yao Qi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=526D00E9.7040407@codesourcery.com \
    --to=yao@codesourcery.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox