clover: Store map result into a temporary vector in clCreateProgramWithBinary.
authorFrancisco Jerez <currojerez@riseup.net>
Tue, 14 Jan 2014 20:47:46 +0000 (21:47 +0100)
committerFrancisco Jerez <currojerez@riseup.net>
Wed, 15 Jan 2014 15:45:05 +0000 (16:45 +0100)
This avoids the inefficient multiple evaluation of the map result in
the code below.  It should cause no functional changes.

Tested-by: "Dorrington, Albert" <albert.dorrington@lmco.com>
src/gallium/state_trackers/clover/api/program.cpp

index 7d060c44aa123ae204c94c8b91ffcf61963c353f..6049209b6a08e138c3c36d19c4e0788b8634c689 100644 (file)
@@ -69,7 +69,7 @@ clCreateProgramWithBinary(cl_context d_ctx, cl_uint n,
       throw error(CL_INVALID_DEVICE);
 
    // Deserialize the provided binaries,
-   auto result = map(
+   std::vector<std::pair<cl_int, module>> result = map(
       [](const unsigned char *p, size_t l) -> std::pair<cl_int, module> {
          if (!p || !l)
             return { CL_INVALID_VALUE, {} };