Skip to content

Commit

Permalink
Merge pull request #1331 from thnkslprpt:fix-1330-variables-declared-…
Browse files Browse the repository at this point in the history
…mid-function

Fix #1330, Move variables declared mid-function to the top
  • Loading branch information
dzbaker committed Feb 23, 2024
2 parents e7add95 + 6e0f541 commit b88b641
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/tests/time-base-api-test/time-base-api-test.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ void TestTimeBaseApi(void)
osal_id_t tb_id[OS_MAX_TIMEBASES];
char timebase_name[OS_MAX_API_NAME + 5];
OS_timebase_prop_t timebase_prop;
int i;

/*
* Test Case For:
Expand All @@ -89,7 +90,7 @@ void TestTimeBaseApi(void)
UtAssert_INT32_EQ(OS_TimeBaseCreate(&time_base_id, timebase_name, 0), OS_ERR_NAME_TOO_LONG);

/* Checking for OS_MAX_TIMEBASES */
for (int i = 0; i < OS_MAX_TIMEBASES; i++)
for (i = 0; i < OS_MAX_TIMEBASES; i++)
{
/* On the final setup pass, while there is still one free slot,
* check attempting to create a duplicate name (index 0) - this
Expand Down
6 changes: 4 additions & 2 deletions src/unit-test-coverage/shared/src/coveragetest-idmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -1157,6 +1157,8 @@ void Test_OS_ObjectIDInteger(void)
int32 recordscount = 0;
osal_objtype_t idtype;
char str[OS_MAX_API_NAME];
int i;
int j;

memset(&token, 0, sizeof(token));

Expand All @@ -1181,11 +1183,11 @@ void Test_OS_ObjectIDInteger(void)

UtAssert_True(recordscount < OS_MAX_TOTAL_RECORDS, "All Id types checked");

for (int i = 0; i < recordscount; i++)
for (i = 0; i < recordscount; i++)
{
UtAssert_True(OS_ObjectIdDefined(typesI[i]), "%lu Is defined", OS_ObjectIdToInteger(typesI[i]));

for (int j = 0; j < recordscount; j++)
for (j = 0; j < recordscount; j++)
{
if (i == j)
{
Expand Down

0 comments on commit b88b641

Please sign in to comment.