Changeset: 5a5269630122 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/5a5269630122
Modified Files:
        monetdb5/modules/mal/pp_mat.c
Branch: pp_hashjoin
Log Message:

use proper do/while wrappers around mat project macros


diffs (61 lines):

diff --git a/monetdb5/modules/mal/pp_mat.c b/monetdb5/modules/mal/pp_mat.c
--- a/monetdb5/modules/mal/pp_mat.c
+++ b/monetdb5/modules/mal/pp_mat.c
@@ -254,7 +254,7 @@ PARTpartition(Client ctx, bat *pos, cons
 }
 
 #define mat_project(T)                                                         
                \
-       {                                                                       
                                        \
+       do {                                                                    
                                \
                T **cp = (T**)GDKzalloc(mt->nr * sizeof(T*));           \
                if (cp) {                                                       
                                \
                        bool extend = false;                                    
                \
@@ -294,14 +294,13 @@ PARTpartition(Client ctx, bat *pos, cons
                                }                                               
                                        \
                        }                                                       
                                        \
                        GDKfree(cp);                                            
                        \
-               } else {                                                        
                        \
+               } else {                                                        
                                \
                        err = createException(MAL, "mat.project", 
SQLSTATE(HY013) MAL_MALLOC_FAIL);     \
-               }                                                               
                                \
-       }                                                                       
                                \
-       break
+               }                                                               
                                        \
+       } while (0)                                                             
                                \
 
 #define mat_project_() \
-       {       \
+       do {    \
                for(int i = 0; i<mt->nr; i++) {                                 
                                        \
                        if (BATcapacity(mt->bat[i]) < (BUN)(curpos[i]+lp[i])) { 
                                        \
                                if (BATextend(mt->bat[i], curpos[i]+lp[i]) != 
GDK_SUCCEED) {                            \
@@ -331,7 +330,7 @@ PARTpartition(Client ctx, bat *pos, cons
                for(int i = 0; i<mt->nr; i++) {   \
                        mt->bat[i]->ttype = TYPE_str; \
                }                                                               
  \
-       }
+       } while (0)
 
 /*
  * ToDo concurrent insert of var-types. Use a single atomic operation for 
claiming space in the heap.
@@ -407,15 +406,20 @@ MATproject(Client ctx, bat *mat, const b
                        switch(d->twidth) {
                        case 1:
                                mat_project(bte);
+                               break;
                        case 2:
                                mat_project(sht);
+                               break;
                        case 4:
                                mat_project(int);
+                               break;
                        case 8:
                                mat_project(lng);
+                               break;
 #ifdef HAVE_HGE
                        case 16:
                                mat_project(hge);
+                               break;
 #endif
                        default:
                                err = createException(MAL, "mat.project", 
SQLSTATE(HY002) "invalid BAT width");
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to