openocd: fix Yoda conditions with checkpatch
The new checkpatch can automatically fix the code, but this feature is still error prone and not complete. Patch generated automatically through the new checkpatch with flags "--types CONSTANT_COMPARISON --fix-inplace". Some Yoda condition is detected by checkpatch but not fixed; it will be fixed manually in a following commit. Change-Id: Ifaaa1159e63dbd1db6aa3c017125df9874fa9703 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/6355 Tested-by: jenkins
This commit is contained in:
@@ -222,7 +222,7 @@ static void str_radix_guess(const char **_str, unsigned *_str_len,
|
||||
unsigned *_radix)
|
||||
{
|
||||
unsigned radix = *_radix;
|
||||
if (0 != radix)
|
||||
if (radix != 0)
|
||||
return;
|
||||
const char *str = *_str;
|
||||
unsigned str_len = *_str_len;
|
||||
|
||||
@@ -66,7 +66,7 @@ int jim_get_nvp(Jim_Interp *interp,
|
||||
struct jim_nvp *jim_nvp_name2value_simple(const struct jim_nvp *p, const char *name)
|
||||
{
|
||||
while (p->name) {
|
||||
if (0 == strcmp(name, p->name))
|
||||
if (strcmp(name, p->name) == 0)
|
||||
break;
|
||||
p++;
|
||||
}
|
||||
@@ -76,7 +76,7 @@ struct jim_nvp *jim_nvp_name2value_simple(const struct jim_nvp *p, const char *n
|
||||
struct jim_nvp *jim_nvp_name2value_nocase_simple(const struct jim_nvp *p, const char *name)
|
||||
{
|
||||
while (p->name) {
|
||||
if (0 == strcasecmp(name, p->name))
|
||||
if (strcasecmp(name, p->name) == 0)
|
||||
break;
|
||||
p++;
|
||||
}
|
||||
|
||||
@@ -233,7 +233,7 @@ int win_select(int max_fd, fd_set *rfds, fd_set *wfds, fd_set *efds, struct time
|
||||
if (retcode < 0)
|
||||
retcode = 0;
|
||||
for (i = 0; i < n_handles; i++) {
|
||||
if (WAIT_OBJECT_0 == WaitForSingleObject(handles[i], 0)) {
|
||||
if (WaitForSingleObject(handles[i], 0) == WAIT_OBJECT_0) {
|
||||
if (SAFE_FD_ISSET(handle_slot_to_fd[i], rfds)) {
|
||||
DWORD bytes;
|
||||
intptr_t handle = (intptr_t) _get_osfhandle(
|
||||
|
||||
@@ -86,7 +86,7 @@ int duration_measure(struct duration *duration)
|
||||
{
|
||||
struct timeval end;
|
||||
int retval = gettimeofday(&end, NULL);
|
||||
if (0 == retval)
|
||||
if (retval == 0)
|
||||
timeval_subtract(&duration->elapsed, &end, &duration->start);
|
||||
return retval;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user