Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Abhijit Halder <abhijit.k.halder@gmail.com>
To: Pedro Alves <pedro@codesourcery.com>
Cc: gdb-patches@sourceware.org
Subject: Re: Some code-cleanup
Date: Mon, 12 Sep 2011 16:05:00 -0000	[thread overview]
Message-ID: <CAOhZP9xH-g=mWTQWYnvkpEsCERtq0tz7+XOFfTs7+FtOd4UBDw@mail.gmail.com> (raw)
In-Reply-To: <201109121623.04292.pedro@codesourcery.com>

[-- Attachment #1: Type: text/plain, Size: 1755 bytes --]

On Mon, Sep 12, 2011 at 8:53 PM, Pedro Alves <pedro@codesourcery.com> wrote:
> On Monday 12 September 2011 16:05:59, Abhijit Halder wrote:
>> I have seen in one place (write_exp_elt) that we are passing an union
>> by value and not by reference.
>> Please let me know whether we do have any specific reason of doing
>> that. I am submitting the patch as an attachment. Please review the
>> same.
>>
>
> See <http://sourceware.org/cgi-bin/get-raw-msg?listname=gdb-patches&date=2011-09&msgid=CAOhZP9xK6f%3D96Gxj2To-ktVK7qA1k%3DWek7hX-FMwq8u75KsDyw%40mail.gmail.com>:
>
> --0016364d2c7965a8ac04acbfddf0
> Content-Type: application/octet-stream; name=patch
> Content-Disposition: attachment; filename=patch
> Content-Transfer-Encoding: base64
> X-Attachment-Id: f_gshl4bmu0
>
> Please teach your browser to attach files to gmail as
> some text based content type, like patch/diff or
> text/x-patch.  It may just be a matter of renaming
> the files to have a ".diff" or ".patch" extension before
> attaching them.  If not, you may need to teach your browser
> about the mime type of .diff/.patch.
>
> You can see which mime type gmail gives your patch
> before actually sending the email.  Just let gmail complete
> the patch upload, and you should then see something like
>
> [X] foo.diff (text/x-patch) 5K
>
> It also affects the mail archives, check the difference,
> both sent from gmail with files attached:
>
>  <http://sourceware.org/ml/gdb-patches/2011-09/msg00192.html>
>  <http://sourceware.org/ml/gdb-patches/2011-08/msg00570.html>
>
> (follow the "Raw text" link too)
>
> --
> Pedro Alves
>

Sorry for this blunder!
Re-submitting this once again with corrected file extension.

Thanks,
Abhijit Halder

[-- Attachment #2: code-cleanup.patch --]
[-- Type: text/x-patch, Size: 4632 bytes --]

Index: gdb/ChangeLog
===================================================================
RCS file: /cvs/src/src/gdb/ChangeLog,v
retrieving revision 1.13320
diff -u -p -r1.13320 ChangeLog
--- gdb/ChangeLog	11 Sep 2011 09:54:16 -0000	1.13320
+++ gdb/ChangeLog	12 Sep 2011 15:25:45 -0000
@@ -1,3 +1,19 @@
+2011-09-12  Abhijit Halder  <abhijit.k.halder@gmail.com>
+
+	Code cleanup.
+	* gdb/parse.c (write_exp_elt): Change the argument to pass a pointer
+	of union exp_element instead of an element of the same.
+	* (write_exp_elt_opcode): Change argument of write_exp_elt call.
+	* (write_exp_elt_sym): Change argument of write_exp_elt call.
+	* (write_exp_elt_block): Change argument of write_exp_elt call.
+	* (write_exp_elt_objfile): Change argument of write_exp_elt call.
+	* (write_exp_elt_longcst): Change argument of write_exp_elt call.
+	* (write_exp_elt_dblcst): Change argument of write_exp_elt call.
+	* (write_exp_elt_decfloatcst): Change argument of write_exp_elt call.
+	* (write_exp_elt_type): Change argument of write_exp_elt call.
+	* (write_exp_elt_intern): Change argument of write_exp_elt call.
+	* src/sim/ppc/dp-bit.c (unpack_d): Change the formatting.
+
 2011-09-11  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
 	Code cleanup.
Index: gdb/parse.c
===================================================================
RCS file: /cvs/src/src/gdb/parse.c,v
retrieving revision 1.110
diff -u -p -r1.110 parse.c
--- gdb/parse.c	17 Jun 2011 20:24:22 -0000	1.110
+++ gdb/parse.c	12 Sep 2011 15:25:46 -0000
@@ -190,7 +190,7 @@ free_funcalls (void *ignore)
     }
 }
 \f
-/* 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.  */
@@ -199,7 +199,7 @@ free_funcalls (void *ignore)
    a register through here.  */
 
 void
-write_exp_elt (union exp_element expelt)
+write_exp_elt (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 ex
 
   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 *o
 
   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 expe
   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
 
   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.
Index: sim/ppc/dp-bit.c
===================================================================
RCS file: /cvs/src/src/sim/ppc/dp-bit.c,v
retrieving revision 1.7
diff -u -p -r1.7 dp-bit.c
--- sim/ppc/dp-bit.c	1 Jan 2011 15:34:04 -0000	1.7
+++ sim/ppc/dp-bit.c	12 Sep 2011 15:25:49 -0000
@@ -408,7 +408,7 @@ pack_d ( fp_number_type *  src)
 }
 
 static void
-unpack_d (FLO_union_type * src, fp_number_type * dst)
+unpack_d (FLO_union_type *src, fp_number_type *dst)
 {
   fractype fraction = src->bits.fraction;
 

  reply	other threads:[~2011-09-12 15:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-12 15:08 Abhijit Halder
2011-09-12 15:30 ` Pedro Alves
2011-09-12 16:05   ` Abhijit Halder [this message]
2011-09-13 12:20     ` Jan Kratochvil
2011-09-13 12:55       ` Abhijit Halder
2011-09-14  5:04         ` Jan Kratochvil
2011-09-14  6:32           ` Abhijit Halder
2011-09-15  9:09             ` Jan Kratochvil
2011-09-16 10:34               ` Abhijit Halder
2011-09-16 14:44                 ` Jan Kratochvil
2011-09-16 14:47                   ` Abhijit Halder

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='CAOhZP9xH-g=mWTQWYnvkpEsCERtq0tz7+XOFfTs7+FtOd4UBDw@mail.gmail.com' \
    --to=abhijit.k.halder@gmail.com \
    --cc=gdb-patches@sourceware.org \
    --cc=pedro@codesourcery.com \
    /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