Changeset: 1285a1adb76b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=1285a1adb76b
Modified Files:
        gdk/gdk_imprints.c
        monetdb5/modules/atoms/str.c
        monetdb5/modules/atoms/str.h
        monetdb5/modules/kernel/algebra.c
        monetdb5/modules/kernel/algebra.h
        monetdb5/modules/kernel/batstr.c
        monetdb5/modules/mal/pcre.c
        sql/backends/monet5/datacell/petrinet.c
        sql/backends/monet5/sql.c
        sql/backends/monet5/sql.h
        sql/backends/monet5/sql_scenario.c
        sql/backends/monet5/sql_scenario.h
Branch: default
Log Message:

Merge with Oct2014 branch.


diffs (truncated from 1673 to 300 lines):

diff --git a/gdk/gdk_imprints.c b/gdk/gdk_imprints.c
--- a/gdk/gdk_imprints.c
+++ b/gdk/gdk_imprints.c
@@ -412,7 +412,7 @@ do {                                                        
                \
        uint##B##_t *im = (uint##B##_t *) imps;                         \
        TYPE *col = (TYPE *) Tloc(b, b->batFirst);                      \
        TYPE *bins = (TYPE *) inbins;                                   \
-       TYPE nil = TYPE##_nil;                                                  
\
+       TYPE nil = TYPE##_nil;                                          \
        prvmask = mask = 0;                                             \
        new = (IMPS_PAGE/sizeof(TYPE))-1;                               \
        for (i = 0; i < b->batCount; i++) {                             \
@@ -453,23 +453,23 @@ do {                                                      
                \
                }                                                       \
                GETBIN##B(bin,col[i]);                                  \
                mask = IMPSsetBit(B,mask,bin);                          \
-               if (!cnt_bins[bin]++) {                                         
\
+               if (!cnt_bins[bin]++) {                                 \
                        min_bins[bin] = max_bins[bin] = i;              \
-               } else {                                                        
                \
+               } else {                                                \
                        /* nil value can not be min */                  \
-                       if ((bin == 0) && (col[i] != nil)) {                    
                \
-                               /* in case the first value was nil and 
min_bin[0]       \
-                                * has been initialized with it */              
                        \
-                               if (col[min_bins[0]] == nil) {                  
                        \
-                                       min_bins[0] = i;                        
                                        \
-                               } else if (col[i] < col[min_bins[0]]) {         
                \
-                                       min_bins[0] = i;                        
                                        \
-                               }                                               
                                                        \
-                       } else  {                                               
                                                \
-                               if (col[i] < col[min_bins[bin]]) min_bins[bin] 
= i;     \
-                       }                                                       
                                                        \
-                       if (col[i] > col[max_bins[bin]]) max_bins[bin] = i;     
        \
-               }                                                               
                                                \
+                       if ((bin == 0) && (col[i] != nil)) {            \
+                               /* in case the first value was nil and 
min_bin[0] \
+                                * has been initialized with it */      \
+                               if (col[min_bins[0]] == nil) {          \
+                                       min_bins[0] = i;                \
+                               } else if (col[i] < col[min_bins[0]]) { \
+                                       min_bins[0] = i;                \
+                               }                                       \
+                       } else  {                                       \
+                               if (col[i] < col[min_bins[bin]]) min_bins[bin] 
= i; \
+                       }                                               \
+                       if (col[i] > col[max_bins[bin]]) max_bins[bin] = i; \
+               }                                                       \
        }                                                               \
        /* one last left */                                             \
        if (prvmask == mask && dcnt > 0 &&                              \
diff --git a/monetdb5/modules/atoms/str.c b/monetdb5/modules/atoms/str.c
--- a/monetdb5/modules/atoms/str.c
+++ b/monetdb5/modules/atoms/str.c
@@ -1453,7 +1453,9 @@ convertCase(BAT *from, BAT *to, str *res
        BATiter toi = bat_iterator(to);
        BATiter fromi = bat_iterator(BATmirror(from));  /* hashes work on head 
columns */
        size_t len = strlen(s);
-       unsigned char *dst, *src = (unsigned char *) s, *end = (unsigned char 
*) (src + len);
+       unsigned char *dst;
+       const unsigned char *src = (const unsigned char *) s;
+       const unsigned char *end = (const unsigned char *) (src + len);
        BUN UTF8_CONV_r;
 
        if (strNil(s)) {
@@ -1497,7 +1499,7 @@ convertCase(BAT *from, BAT *to, str *res
 }
 
 str
-STRSQLLength(int *res, str *s)
+STRSQLLength(int *res, const str *s)
 {
        str r = NULL;
        str msg;
@@ -1515,65 +1517,58 @@ STRSQLLength(int *res, str *s)
  */
 #include "mal_exception.h"
 
-str
-STRfindUnescapedOccurrence(str b, str c, str esc){
-       str t;
-
-       t= strstr(b,c);
-       while( t){
-               /* check for escaped version */
-               if (t>b && *esc == *(t-1) ) {
-                       t= strstr(t+1,c);
-               } else return t;
-       }
-       return 0;
-}
 /*
  * The SQL like function return a boolean
  */
 static int
-STRlike(str s, str pat, str esc){
-       str t,p;
+STRlike(const char *s, const char *pat, const char *esc)
+{
+       const char *t, *p;
 
-       t= s;
-       for( p= pat; *p && *t; p++){
-               if(esc && *p == *esc) {
+       t = s;
+       for (p = pat; *p && *t; p++) {
+               if (esc && *p == *esc) {
                        p++;
-                       if( *p != *t) return FALSE;
+                       if (*p != *t)
+                               return FALSE;
                        t++;
-               } else
-               if( *p == '_') t++;
+               } else if (*p == '_')
+                       t++;
+               else if (*p == '%') {
+                       p++;
+                       while (*p == '%')
+                               p++;
+                       if (*p == 0)
+                               return TRUE;    /* tail is acceptable */
+                       for (; *p && *t; t++)
+                               if (STRlike(t, p, esc))
+                                       return TRUE;
+                       if (*p == 0 && *t == 0)
+                               return TRUE;
+                       return FALSE;
+               } else if (*p == *t)
+                       t++;
                else
-               if( *p == '%'){
-                       p++;
-                       while(*p == '%') p++;
-                       if( *p == 0) return TRUE; /* tail is acceptable */
-                       for(; *p && *t; t++)
-                               if( STRlike(t,p,esc))
-                                       return TRUE;
-                       if( *p == 0 && *t == 0) return TRUE;
                        return FALSE;
-               } else
-               if( *p == *t) t++;
-               else return FALSE;
        }
-       if( *p == '%' && *(p+1)==0) return TRUE;
+       if (*p == '%' && *(p + 1) == 0)
+               return TRUE;
        return *t == 0 && *p == 0;
 }
 
 str
-STRlikewrap(bit *ret, str *s, str *pat, str *esc){
+STRlikewrap(bit *ret, const str *s, const str *pat, const str *esc){
        *ret = STRlike(*s,*pat,*esc);
        return MAL_SUCCEED;
 }
 str
-STRlikewrap2(bit *ret, str *s, str *pat){
+STRlikewrap2(bit *ret, const str *s, const str *pat){
        *ret = STRlike(*s,*pat,0);
        return MAL_SUCCEED;
 }
 
 str
-STRtostr(str *res, str *src)
+STRtostr(str *res, const str *src)
 {
        if( *src == 0)
                *res= GDKstrdup(str_nil);
@@ -1585,7 +1580,7 @@ STRtostr(str *res, str *src)
  * The concatenate operator requires a type in most cases.
  */
 str
-STRConcat(str *res, str *val1, str *val2)
+STRConcat(str *res, const str *val1, const str *val2)
 {
        size_t l1, l2;
        const char *s1 = *val1;
@@ -1608,7 +1603,7 @@ STRConcat(str *res, str *val1, str *val2
 }
 
 str
-STRLength(int *res, str *arg1)
+STRLength(int *res, const str *arg1)
 {
        size_t l;
        const char *s = *arg1;
@@ -1624,7 +1619,7 @@ STRLength(int *res, str *arg1)
 }
 
 str
-STRBytes(int *res, str *arg1)
+STRBytes(int *res, const str *arg1)
 {
        size_t l;
 
@@ -1635,7 +1630,7 @@ STRBytes(int *res, str *arg1)
 }
 
 str
-STRTail(str *res, str *arg1, int *offset)
+STRTail(str *res, const str *arg1, const int *offset)
 {
        int off = *offset;
        const char *s = *arg1;
@@ -1666,7 +1661,7 @@ STRTail(str *res, str *arg1, int *offset
 }
 
 str
-STRSubString(str *res, str *arg1, int *offset, int *length)
+STRSubString(str *res, const str *arg1, const int *offset, const int *length)
 {
        int len, off = *offset, l = *length;
        const char *s = *arg1;
@@ -1709,7 +1704,7 @@ STRSubString(str *res, str *arg1, int *o
 }
 
 str
-STRFromWChr(str *res, int *c)
+STRFromWChr(str *res, const int *c)
 {
        str s = *res = GDKmalloc(7);
 
@@ -1721,7 +1716,7 @@ STRFromWChr(str *res, int *c)
 }
 
 str
-STRWChrAt(int *res, str *arg1, int *at)
+STRWChrAt(int *res, const str *arg1, const int *at)
 {
 /* 64bit: should have wrd arg */
        const char *s = *arg1;
@@ -1759,7 +1754,7 @@ STRcodeset(str *res)
 }
 
 str
-STRIconv(str *res, str *o, str *fp, str *tp)
+STRIconv(str *res, const str *o, const str *fp, const str *tp)
 {
        const char *f = *fp;
        const char *t = *tp;
@@ -1798,7 +1793,7 @@ STRIconv(str *res, str *o, str *fp, str 
 }
 
 str
-STRPrefix(bit *res, str *arg1, str *arg2)
+STRPrefix(bit *res, const str *arg1, const str *arg2)
 {
        size_t pl, i;
        const char *s = *arg1;
@@ -1824,7 +1819,7 @@ STRPrefix(bit *res, str *arg1, str *arg2
 }
 
 str
-STRSuffix(bit *res, str *arg1, str *arg2)
+STRSuffix(bit *res, const str *arg1, const str *arg2)
 {
        size_t i, sl, sul;
        const char *s = *arg1;
@@ -1852,19 +1847,19 @@ STRSuffix(bit *res, str *arg1, str *arg2
 }
 
 str
-STRLower(str *res, str *arg1)
+STRLower(str *res, const str *arg1)
 {
        return convertCase(UTF8_upperBat, UTF8_lowerBat, res, *arg1, 
"str.lower");
 }
 
 str
-STRUpper(str *res, str *arg1)
+STRUpper(str *res, const str *arg1)
 {
        return convertCase(UTF8_lowerBat, UTF8_upperBat, res, *arg1, 
"str.upper");
 }
 
 str
-STRstrSearch(int *res, str *haystack, str *needle)
+STRstrSearch(int *res, const str *haystack, const str *needle)
 {
 /* 64bit: should return wrd */
        char *p;
@@ -1883,7 +1878,7 @@ STRstrSearch(int *res, str *haystack, st
 }
 
 str
-STRReverseStrSearch(int *res, str *arg1, str *arg2)
+STRReverseStrSearch(int *res, const str *arg1, const str *arg2)
 {
 /* 64bit: should return wrd */
        size_t len, slen;
@@ -1911,7 +1906,7 @@ STRReverseStrSearch(int *res, str *arg1,
 }
 
 str
-STRStrip(str *res, str *arg1)
+STRStrip(str *res, const str *arg1)
 {
        const char *start = *arg1;
        const char *s;
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to