Sfoglia il codice sorgente

src/core/sched_policy.c: revert r8326. NULL is needed at the end of
the list when using starpu_sched_get_predefined_policies() to detect
the end. Fix find_sched_policy_from_name().

Nathalie Furmento 12 anni fa
parent
commit
8900ab5e3b
1 ha cambiato i file con 3 aggiunte e 1 eliminazioni
  1. 3 1
      src/core/sched_policy.c

+ 3 - 1
src/core/sched_policy.c

@@ -44,7 +44,8 @@ static struct starpu_sched_policy *predefined_policies[] =
 	&_starpu_sched_dmda_ready_policy,
 	&_starpu_sched_dmda_sorted_policy,
 	&_starpu_sched_parallel_heft_policy,
-	&_starpu_sched_peager_policy
+	&_starpu_sched_peager_policy,
+	NULL
 };
 
 struct starpu_sched_policy **starpu_sched_get_predefined_policies()
@@ -96,6 +97,7 @@ static struct starpu_sched_policy *find_sched_policy_from_name(const char *polic
 	{
 		struct starpu_sched_policy *p;
 		p = predefined_policies[i];
+		if (p == NULL) continue; // We reached the end of the array
 		if (p->policy_name)
 		{
 			if (strcmp(policy_name, p->policy_name) == 0)