[RFA] CFI improvements

Michal Ludvig mludvig@suse.cz
Tue May 27 12:42:00 GMT 2003


amodra@bigpond.net.au told me that:
> On Wed, May 21, 2003 at 06:44:14PM +0200, Michal Ludvig wrote:
> 
>>-      regnames_count = sizeof (regnames_64);
>>+      regnames_count = sizeof (regnames_64) / sizeof (void*);
> 
> Better to divide by sizeof (regnames_64[0]), then it's obvious in
> just this one line of code that you're calculating an array size.

OK.

>>+  while ((*p >= 'a' && *p <= 'z') 
>>+	 || (*p >= 'A' && *p <= 'Z')
>>+	 || (*p >= '0' && *p <= '9'))
> 
> while (ISALNUM (*p))

OK.

>>+  /* Save char at *p only when it isn't \0.  */
> 
> Why not save it when it is 0 too?  Saves a test, here and later when
> you restore.

If I pass a register name in a constant pointer I expect it is 
terminated by \0 and so I don't write to it to avoid segfault. But it's 
a bit fragile, I know. I'll rewrite the function to make a local copy of 
the string and work on it instead.

Michal Ludvig
-- 
* SuSE CR, s.r.o     * mludvig@suse.cz
* (+420) 296.545.373 * http://www.suse.cz



More information about the Binutils mailing list