[Beignet] [PATCH] Refine the build option checking.

Yang Rong rong.r.yang at intel.com
Tue Oct 29 06:59:41 CET 2013


Signed-off-by: Yang Rong <rong.r.yang at intel.com>
---
 src/cl_program.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/src/cl_program.c b/src/cl_program.c
index e7d67de..b0c29bf 100644
--- a/src/cl_program.c
+++ b/src/cl_program.c
@@ -301,18 +301,15 @@ cl_program_build(cl_program p, const char *options)
   int copyed = 0;
 
   if (options) {
-    if(p->build_opts && strcmp(options, p->build_opts) != 0) {
-      p->source_type = p->source ? FROM_SOURCE : p->binary ? FROM_BINARY : FROM_LLVM;
-
+    if(p->build_opts == NULL || strcmp(options, p->build_opts) != 0) {
       if(p->build_opts) {
         cl_free(p->build_opts);
         p->build_opts = NULL;
       }
-    } else if(p->build_opts == NULL) {
-      p->source_type = p->source ? FROM_SOURCE : p->binary ? FROM_BINARY : FROM_LLVM;
-
       TRY_ALLOC (p->build_opts, cl_calloc(strlen(options) + 1, sizeof(char)));
       memcpy(p->build_opts, options, strlen(options));
+
+      p->source_type = p->source ? FROM_SOURCE : p->binary ? FROM_BINARY : FROM_LLVM;
     }
   }
 
-- 
1.8.1.2



More information about the Beignet mailing list