Skip to content

Commit

Permalink
Update *((Type *)lstGet()) pattern to *(Type *)lstGet().
Browse files Browse the repository at this point in the history
This pattern has extra parens and was only used in a few places so replace it with the general *(Type *)lstGet() pattern.
  • Loading branch information
dwsteele committed Aug 18, 2020
1 parent fbee6ec commit d935af5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/info/infoBackup.c
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ infoBackupData(const InfoBackup *this, unsigned int backupDataIdx)

ASSERT(this != NULL);

FUNCTION_LOG_RETURN(INFO_BACKUP_DATA, *((InfoBackupData *)lstGet(this->backup, backupDataIdx)));
FUNCTION_LOG_RETURN(INFO_BACKUP_DATA, *(InfoBackupData *)lstGet(this->backup, backupDataIdx));
}

/**********************************************************************************************************************************/
Expand Down
2 changes: 1 addition & 1 deletion src/info/infoPg.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ infoPgData(const InfoPg *this, unsigned int pgDataIdx)

ASSERT(this != NULL);

FUNCTION_LOG_RETURN(INFO_PG_DATA, *((InfoPgData *)lstGet(this->history, pgDataIdx)));
FUNCTION_LOG_RETURN(INFO_PG_DATA, *(InfoPgData *)lstGet(this->history, pgDataIdx));
}

/**********************************************************************************************************************************/
Expand Down
26 changes: 13 additions & 13 deletions test/src/module/common/typeListTest.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ testRun(void)

// Insert an int at the beginning
int insertIdx = 0;
TEST_RESULT_INT(*((int *)lstInsert(list, 0, &insertIdx)), 0, "insert item %d", insertIdx);
TEST_RESULT_INT(*(int *)lstInsert(list, 0, &insertIdx), 0, "insert item %d", insertIdx);

// Check the size
TEST_RESULT_INT(lstSize(list), 9, "list size");
Expand Down Expand Up @@ -143,24 +143,24 @@ testRun(void)

TEST_RESULT_PTR(lstSort(list, sortOrderNone), list, "list sort none");

TEST_RESULT_INT(*((int *)lstGet(list, 0)), 3, "sort value 0");
TEST_RESULT_INT(*((int *)lstGet(list, 1)), 5, "sort value 1");
TEST_RESULT_INT(*((int *)lstGet(list, 2)), 3, "sort value 2");
TEST_RESULT_INT(*((int *)lstGet(list, 3)), 2, "sort value 3");
TEST_RESULT_INT(*(int *)lstGet(list, 0), 3, "sort value 0");
TEST_RESULT_INT(*(int *)lstGet(list, 1), 5, "sort value 1");
TEST_RESULT_INT(*(int *)lstGet(list, 2), 3, "sort value 2");
TEST_RESULT_INT(*(int *)lstGet(list, 3), 2, "sort value 3");

TEST_RESULT_PTR(lstSort(list, sortOrderAsc), list, "list sort asc");

TEST_RESULT_INT(*((int *)lstGet(list, 0)), 2, "sort value 0");
TEST_RESULT_INT(*((int *)lstGet(list, 1)), 3, "sort value 1");
TEST_RESULT_INT(*((int *)lstGet(list, 2)), 3, "sort value 2");
TEST_RESULT_INT(*((int *)lstGet(list, 3)), 5, "sort value 3");
TEST_RESULT_INT(*(int *)lstGet(list, 0), 2, "sort value 0");
TEST_RESULT_INT(*(int *)lstGet(list, 1), 3, "sort value 1");
TEST_RESULT_INT(*(int *)lstGet(list, 2), 3, "sort value 2");
TEST_RESULT_INT(*(int *)lstGet(list, 3), 5, "sort value 3");

TEST_RESULT_PTR(lstSort(list, sortOrderDesc), list, "list sort desc");

TEST_RESULT_INT(*((int *)lstGet(list, 0)), 5, "sort value 0");
TEST_RESULT_INT(*((int *)lstGet(list, 1)), 3, "sort value 1");
TEST_RESULT_INT(*((int *)lstGet(list, 2)), 3, "sort value 2");
TEST_RESULT_INT(*((int *)lstGet(list, 3)), 2, "sort value 3");
TEST_RESULT_INT(*(int *)lstGet(list, 0), 5, "sort value 0");
TEST_RESULT_INT(*(int *)lstGet(list, 1), 3, "sort value 1");
TEST_RESULT_INT(*(int *)lstGet(list, 2), 3, "sort value 2");
TEST_RESULT_INT(*(int *)lstGet(list, 3), 2, "sort value 3");
}

// *****************************************************************************************************************************
Expand Down

0 comments on commit d935af5

Please sign in to comment.