Anyone feeling like addressing the rest of these?

It's code cleanup, by and large... except that "test
floats for equality" bug.


On Monday 24 August 2009, Steve Grubb wrote:
> Hello,
> 
> This is my last set of findings from looking through the code in svn. This set
> mostly concentrates on variable tests that are unnecessary or could be copy
> and paste issues.
> 
> In src/helper/jim.c at line 6066 we find this code:
> 
> if (end) {
> 
> then at 6071, we find this:
> 
> } else if (!end && index < 0)
> 
> The check for !end is unnecessary since the first check leaves no doubt that
> end is 0 if it gets to line 6071.
> 
> --------------
> 
> src/helper/jim.c at line 7066 floats are being tested for equality.
> 
> -------------
> 
> src/helper/jim.c at line 9877 is this code:
> 
> if (varBObjPtr) {
> 
> farther down within the same if we find this at line 9883:
> 
> if (varBObjPtr)
> 
> Nothing in between has changed its value.
> 
> --------------
> 
> In src/jtag/core.c at line 717 we find this code:
> 
> if (compare_failed) {
> 
> then at line 726 we find another check of the same variable with only comments
> between the two checks.
> 
> --------------
> 
> In src/svf/svf.c at line 1333 we find this code:
> 
>             if (NULL == path)
>             {
>                      LOG_ERROR("not enough memory");
>                      return ERROR_FAIL;
> 
> Then farther down at line 1376 is
> 
> if (NULL != path)
> 
> Due to the check at line 1333, this is not necessary.
> 
> ---------------
> 
> In src/flash/mflash.c at line 345 is this code:
> 
> if ((ret = mg_dsk_wait(mg_io_wait_drq, MG_OEM_DISK_WAIT_TIME_NORMAL)) != 
> ERROR_OK)
>                 return ret;
> 
> Then at line 355 is this:
> 
>         if (ret != ERROR_OK)
>                 return ret;
> 
> The check at line 345 should have made checking this again unnecessary. Was
> the call to target_read_memory supposed to have been checked or is this just
> left over code?
> 
> ----------------
> 
> Best Regards,
> -Steve
> 
> 


_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to