Skip to content

Commit 6f16387

Browse files
committed
testsuite: fix variable declarations for planner unit tests
Problem: planner_multi_t contexts and ints are declared and initialized using a comma-separated list that can result in UB. Correct the declarations and initializations.
1 parent 9bad4b3 commit 6f16387

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

resource/planner/test/planner_test01.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,8 @@ static int test_resource_service_flow ()
584584
static int test_more_add_remove ()
585585
{
586586
int rc;
587-
int64_t span1, span2, span3, span4, span5, span6;
587+
int64_t span1 = -1, span2 = -1, span3 = -1, span4 = -1, span5 = -1,
588+
span6 = -1;
588589
bool bo = false;
589590
uint64_t resource_total = 100000;
590591
uint64_t resource1 = 36;
@@ -660,7 +661,7 @@ static int test_constructors_and_overload ()
660661
uint64_t resource5 = 2304;
661662
uint64_t resource6 = 468;
662663
const char resource_type[] = "core";
663-
planner_t *ctx, *ctx2, *ctx3, *ctx4 = NULL;
664+
planner_t *ctx = NULL, *ctx2 = NULL, *ctx3 = NULL, *ctx4 = NULL;
664665

665666
ctx = planner_new (0, INT64_MAX, resource_total, resource_type);
666667

@@ -742,7 +743,7 @@ static int test_update ()
742743
uint64_t resource6 = 50000;
743744
int64_t avail, avail1 = 0;
744745
const char resource_type[] = "core";
745-
planner_t *ctx, *ctx2 = NULL;
746+
planner_t *ctx = NULL, *ctx2 = NULL;
746747

747748
ctx = planner_new (0, INT64_MAX, resource_total, resource_type);
748749
// Add some spans

0 commit comments

Comments
 (0)