Explorar el Código

No need to check for workerids being non-NULL, and nworkers being more than zero, the loop already handles these

Samuel Thibault hace 8 años
padre
commit
ad54d17d23
Se han modificado 1 ficheros con 7 adiciones y 10 borrados
  1. 7 10
      src/core/sched_ctx.c

+ 7 - 10
src/core/sched_ctx.c

@@ -746,18 +746,15 @@ unsigned starpu_sched_ctx_create(int *workerids, int nworkers, const char *sched
 	}
 	va_end(varg_list);
 
-	if (workerids && nworkers != -1)
+	/* Make sure the user doesn't use invalid worker IDs. */
+	int num_workers = starpu_worker_get_count();
+	int i;
+	for (i = 0; i < nworkers; i++)
 	{
-		/* Make sure the user doesn't use invalid worker IDs. */
-		int num_workers = starpu_worker_get_count();
-		int i;
-		for (i = 0; i < nworkers; i++)
+		if (workerids[i] < 0 || workerids[i] >= num_workers)
 		{
-			if (workerids[i] < 0 || workerids[i] >= num_workers)
-			{
-				_STARPU_ERROR("Invalid worker ID (%d) specified!\n", workerids[i]);
-				return STARPU_NMAX_SCHED_CTXS;
-			}
+			_STARPU_ERROR("Invalid worker ID (%d) specified!\n", workerids[i]);
+			return STARPU_NMAX_SCHED_CTXS;
 		}
 	}