This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] "constify" parse_exp_1


On 03/08/2013 05:00 PM, Pedro Alves wrote:
This is perfectly fine:

  	  for (loc = t->base.loc; loc; loc = loc->next)
  	    {
-	      p = tmp_p;
+	      const char *q;
+
+	      q = tmp_p;
-	      exp = parse_exp_1 (&p, loc->address,
+	      exp = parse_exp_1 (&q, loc->address,
				 block_for_pc (loc->address), 1);
+	      p = (char *) q;

It's perfectly valid, as we know Q on output must point within
the object/string TMP_P pointed at on entry.
This reads much more intuitively to me, no funny arithmetic, and
gets rid of the aliasing issue with the other suggestion, and
no new function necessary.

And confirmed this approach is valid.

I have a revision, but after this morning's fiasco, I'm a bit leery of submitting it until substantial further review. My focus is waxing quickly right now.


I've also got amendments to address Tom's comments.

Thanks,
Keith


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]