diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2011-09-16 14:36:55 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2011-09-16 14:36:55 +0000 |
commit | ae0c443d84a751f25e711b461c68addee8131774 (patch) | |
tree | 5fd03ee39c583d6628819930aa6ebe5a194bac9d | |
parent | d99f7e48425eda1bf7bf41bcc607420ad311c21b (diff) | |
download | gdb-ae0c443d84a751f25e711b461c68addee8131774.zip gdb-ae0c443d84a751f25e711b461c68addee8131774.tar.gz gdb-ae0c443d84a751f25e711b461c68addee8131774.tar.bz2 |
gdb/
Code cleanup.
* parse.c (write_exp_elt): Change argument to pass a pointer of union
`exp_element' instead of an element of the same and make the function
static.
(write_exp_elt_opcode, write_exp_elt_sym, write_exp_elt_block)
(write_exp_elt_objfile, write_exp_elt_longcst, write_exp_elt_dblcst)
(write_exp_elt_decfloatcst, write_exp_elt_type, write_exp_elt_intern):
Change argument of `write_exp_elt' function call.
Remove extra spaces from comments.
* parser-defs.h (write_exp_elt): Remove prototype.
-rw-r--r-- | gdb/ChangeLog | 13 | ||||
-rw-r--r-- | gdb/parse.c | 30 | ||||
-rw-r--r-- | gdb/parser-defs.h | 2 |
3 files changed, 28 insertions, 17 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 19d3709..5108ef1 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,16 @@ +2011-09-16 Abhijit Halder <abhijit.k.halder@gmail.com> + + Code cleanup. + * parse.c (write_exp_elt): Change argument to pass a pointer of union + `exp_element' instead of an element of the same and make the function + static. + (write_exp_elt_opcode, write_exp_elt_sym, write_exp_elt_block) + (write_exp_elt_objfile, write_exp_elt_longcst, write_exp_elt_dblcst) + (write_exp_elt_decfloatcst, write_exp_elt_type, write_exp_elt_intern): + Change argument of `write_exp_elt' function call. + Remove extra spaces from comments. + * parser-defs.h (write_exp_elt): Remove prototype. + 2011-09-15 Paul Koning <paul_koning@dell.com> * python/py-cmd.c (gdbpy_string_to_argv): Decrement reference diff --git a/gdb/parse.c b/gdb/parse.c index a8523e6..bb6e0e6 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -23,7 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* Parse an expression from text in a string, - and return the result as a struct expression pointer. + and return the result as a struct expression pointer. That structure contains arithmetic operations in reverse polish, with constants represented by operations that are followed by special data. See expression.h for the details of the format. @@ -190,7 +190,7 @@ free_funcalls (void *ignore) } } -/* This page contains the functions for adding data to the struct expression +/* This page contains the functions for adding data to the struct expression being constructed. */ /* Add one element to the end of the expression. */ @@ -198,8 +198,8 @@ free_funcalls (void *ignore) /* To avoid a bug in the Sun 4 compiler, we pass things that can fit into a register through here. */ -void -write_exp_elt (union exp_element expelt) +static void +write_exp_elt (const union exp_element *expelt) { if (expout_ptr >= expout_size) { @@ -208,7 +208,7 @@ write_exp_elt (union exp_element expelt) xrealloc ((char *) expout, sizeof (struct expression) + EXP_ELEM_TO_BYTES (expout_size)); } - expout->elts[expout_ptr++] = expelt; + expout->elts[expout_ptr++] = *expelt; } void @@ -218,7 +218,7 @@ write_exp_elt_opcode (enum exp_opcode expelt) memset (&tmp, 0, sizeof (union exp_element)); tmp.opcode = expelt; - write_exp_elt (tmp); + write_exp_elt (&tmp); } void @@ -228,7 +228,7 @@ write_exp_elt_sym (struct symbol *expelt) memset (&tmp, 0, sizeof (union exp_element)); tmp.symbol = expelt; - write_exp_elt (tmp); + write_exp_elt (&tmp); } void @@ -238,7 +238,7 @@ write_exp_elt_block (struct block *b) memset (&tmp, 0, sizeof (union exp_element)); tmp.block = b; - write_exp_elt (tmp); + write_exp_elt (&tmp); } void @@ -248,7 +248,7 @@ write_exp_elt_objfile (struct objfile *objfile) memset (&tmp, 0, sizeof (union exp_element)); tmp.objfile = objfile; - write_exp_elt (tmp); + write_exp_elt (&tmp); } void @@ -258,7 +258,7 @@ write_exp_elt_longcst (LONGEST expelt) memset (&tmp, 0, sizeof (union exp_element)); tmp.longconst = expelt; - write_exp_elt (tmp); + write_exp_elt (&tmp); } void @@ -268,7 +268,7 @@ write_exp_elt_dblcst (DOUBLEST expelt) memset (&tmp, 0, sizeof (union exp_element)); tmp.doubleconst = expelt; - write_exp_elt (tmp); + write_exp_elt (&tmp); } void @@ -280,7 +280,7 @@ write_exp_elt_decfloatcst (gdb_byte expelt[16]) for (index = 0; index < 16; index++) tmp.decfloatconst[index] = expelt[index]; - write_exp_elt (tmp); + write_exp_elt (&tmp); } void @@ -290,7 +290,7 @@ write_exp_elt_type (struct type *expelt) memset (&tmp, 0, sizeof (union exp_element)); tmp.type = expelt; - write_exp_elt (tmp); + write_exp_elt (&tmp); } void @@ -300,7 +300,7 @@ write_exp_elt_intern (struct internalvar *expelt) memset (&tmp, 0, sizeof (union exp_element)); tmp.internalvar = expelt; - write_exp_elt (tmp); + write_exp_elt (&tmp); } /* Add a string constant to the end of the expression. @@ -1059,7 +1059,7 @@ prefixify_subexp (struct expression *inexpr, } /* Read an expression from the string *STRINGPTR points to, - parse it, and return a pointer to a struct expression that we malloc. + parse it, and return a pointer to a struct expression that we malloc. Use block BLOCK as the lexical context for variable names; if BLOCK is zero, use the block of the selected stack frame. Meanwhile, advance *STRINGPTR to point after the expression, diff --git a/gdb/parser-defs.h b/gdb/parser-defs.h index 3f743d1..bca8014 100644 --- a/gdb/parser-defs.h +++ b/gdb/parser-defs.h @@ -131,8 +131,6 @@ union type_stack_elt extern union type_stack_elt *type_stack; extern int type_stack_depth, type_stack_size; -extern void write_exp_elt (union exp_element); - extern void write_exp_elt_opcode (enum exp_opcode); extern void write_exp_elt_sym (struct symbol *); |