Skip to content

Commit

Permalink
Fix compile errors due to non-boolean if statements
Browse files Browse the repository at this point in the history
Several if statements were not doing boolean comparisons and were
directly assigning to a variable in the if statement i.e.
    if (foo = getFoo()) { ...

Rewrote the code to be in the form:
   foo = getFoo();
   if (NULL != foo) {...

Signed-off-by: Dan Heidinga <[email protected]>
  • Loading branch information
DanHeidinga committed Oct 16, 2017
1 parent b36b200 commit 2e4fdcc
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions runtime/util/vmargs.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ findArgInVMArgs(J9PortLibrary *portLibrary, J9VMInitArgs* j9vm_args, UDATA match
success = FALSE;
optionValueOperations(PORTLIB, j9vm_args, optionCntr, GET_OPTION, &valueString, 0, ':', 0, NULL); /* assumes ':' */
if (valueString) {
if (cursor = strrchr(valueString, ':')) { /* Skip past any additional sub-options eg. -Xdump:java:<value> */
cursor = strrchr(valueString, ':'); /* Skip past any additional sub-options eg. -Xdump:java:<value> */
if (NULL != cursor) {
++cursor;
} else {
cursor = valueString;
Expand All @@ -187,7 +188,10 @@ findArgInVMArgs(J9PortLibrary *portLibrary, J9VMInitArgs* j9vm_args, UDATA match
break;
}
}
if (cursor = strchr(cursor, ',')) ++cursor; /* skip to next option */
cursor = strchr(cursor, ',');
if (NULL != cursor) {
cursor += 1; /* skip to next option */
}
}
}
}
Expand Down Expand Up @@ -455,8 +459,10 @@ optionValueOperations(J9PortLibrary *portLibrary, J9VMInitArgs* j9vm_args, IDATA
break;
case MAP_TWO_COLONS_TO_ONE :
cursor = j9vm_args->actualVMArgs->options[element].optionString;
if (cursor = strchr(cursor, ':')) {
if (cursor = strchr(++cursor, ':')) {
cursor = strchr(cursor, ':');
if (NULL != cursor) {
cursor = strchr(++cursor, ':');
if (NULL != cursor) {
if (bufSize > 0) {
strncpy(*valuesBuffer, ++cursor, (bufSize-1));
if (strlen(cursor) > (bufSize-1)) {
Expand Down

0 comments on commit 2e4fdcc

Please sign in to comment.