Changeset: e4e2dbd1fcad for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e4e2dbd1fcad
Modified Files:
        sql/backends/monet5/UDF/udf.c
        sql/backends/monet5/UDF/udf.h
        sql/backends/monet5/UDF/udf_impl.h
Branch: Feb2013
Log Message:

UDF: relace str by char* in order to add (meaningful) const qualifier


diffs (151 lines):

diff --git a/sql/backends/monet5/UDF/udf.c b/sql/backends/monet5/UDF/udf.c
--- a/sql/backends/monet5/UDF/udf.c
+++ b/sql/backends/monet5/UDF/udf.c
@@ -25,11 +25,11 @@
 
 /* actual implementation */
 /* all non-exported functions must be declared static */
-static str
-UDFreverse_(str *ret, str src)
+static char *
+UDFreverse_(char **ret, const char *src)
 {
        size_t len = 0;
-       str dst = NULL;
+       char *dst = NULL;
 
        /* assert calling sanity */
        assert(ret != NULL);
@@ -60,8 +60,8 @@ UDFreverse_(str *ret, str src)
 }
 
 /* MAL wrapper */
-str
-UDFreverse(str *ret, str *arg)
+char *
+UDFreverse(char **ret, const char **arg)
 {
        /* assert calling sanity */
        assert(ret != NULL && arg != NULL);
@@ -77,7 +77,7 @@ UDFreverse(str *ret, str *arg)
  */
 
 /* actual implementation */
-static str
+static char *
 UDFBATreverse_(BAT **ret, BAT *src)
 {
        BATiter li;
@@ -109,11 +109,11 @@ UDFBATreverse_(BAT **ret, BAT *src)
 
        /* the core of the algorithm, expensive due to malloc/frees */
        BATloop(src, p, q) {
-               str tr = NULL, err = NULL;
+               char *tr = NULL, *err = NULL;
 
                /* get original head & tail value */
                ptr h = BUNhead(li, p);
-               str t = (str) BUNtail(li, p);
+               const char *t = (const char *) BUNtail(li, p);
 
                /* revert tail value */
                err = UDFreverse_(&tr, t);
@@ -140,11 +140,11 @@ UDFBATreverse_(BAT **ret, BAT *src)
 }
 
 /* MAL wrapper */
-str
+char *
 UDFBATreverse(bat *ret, const bat *arg)
 {
        BAT *res = NULL, *src = NULL;
-       str msg = NULL;
+       char *msg = NULL;
 
        /* assert calling sanity */
        assert(ret != NULL && arg != NULL);
@@ -200,14 +200,14 @@ UDFBATreverse(bat *ret, const bat *arg)
 /* BAT fuse */
 
 /* actual implementation */
-static str
+static char *
 UDFBATfuse_(BAT **ret, const BAT *bone, const BAT *btwo)
 {
        BAT *bres = NULL;
        bit two_tail_sorted_unsigned = FALSE;
        bit two_tail_revsorted_unsigned = FALSE;
        BUN n;
-       str msg = NULL;
+       char *msg = NULL;
 
        /* assert calling sanity */
        assert(ret != NULL);
@@ -309,11 +309,11 @@ UDFBATfuse_(BAT **ret, const BAT *bone, 
 }
 
 /* MAL wrapper */
-str
+char *
 UDFBATfuse(bat *ires, const bat *ione, const bat *itwo)
 {
        BAT *bres = NULL, *bone = NULL, *btwo = NULL;
-       str msg = NULL;
+       char *msg = NULL;
 
        /* assert calling sanity */
        assert(ires != NULL && ione != NULL && itwo != NULL);
diff --git a/sql/backends/monet5/UDF/udf.h b/sql/backends/monet5/UDF/udf.h
--- a/sql/backends/monet5/UDF/udf.h
+++ b/sql/backends/monet5/UDF/udf.h
@@ -40,16 +40,16 @@
 
 /* export MAL wrapper functions */
 
-udf_export str UDFreverse(str *ret, str *arg);
-udf_export str UDFBATreverse(bat *ret, const bat *arg);
+udf_export char * UDFreverse(char **ret, const char **arg);
+udf_export char * UDFBATreverse(bat *ret, const bat *arg);
 
 /* using C macro for convenient type-expansion */
 #define UDFfuse_scalar_decl(in,out) \
-        udf_export str UDFfuse_##in##_##out(out *ret, const in *one, const in 
*two)
+        udf_export char * UDFfuse_##in##_##out(out *ret, const in *one, const 
in *two)
 UDFfuse_scalar_decl(bte, sht);
 UDFfuse_scalar_decl(sht, int);
 UDFfuse_scalar_decl(int, lng);
 
-udf_export str UDFBATfuse(bat *ret, const bat *one, const bat *two);
+udf_export char * UDFBATfuse(bat *ret, const bat *one, const bat *two);
 
 #endif /* _SQL_UDF_H_ */
diff --git a/sql/backends/monet5/UDF/udf_impl.h 
b/sql/backends/monet5/UDF/udf_impl.h
--- a/sql/backends/monet5/UDF/udf_impl.h
+++ b/sql/backends/monet5/UDF/udf_impl.h
@@ -38,7 +38,7 @@
 
 /* fuse two (shift-byte) in values into one (2*shift-byte) out value */
 /* actual implementation */
-static str
+static char *
 UF(UDFfuse_,UI,UO,_) ( UO *ret , UI one , UI two )
 {
         int shift = sizeof(UI) * 8;
@@ -56,7 +56,7 @@ UF(UDFfuse_,UI,UO,_) ( UO *ret , UI one 
        return MAL_SUCCEED;
 }
 /* MAL wrapper */
-str
+char *
 UF(UDFfuse_,UI,UO,) ( UO *ret , const UI *one , const UI *two )
 {
        /* assert calling sanity */
@@ -72,7 +72,7 @@ UF(UDFfuse_,UI,UO,) ( UO *ret , const UI
  */
 
 /* type-specific core algorithm */
-static str
+static char *
 UF(UDFBATfuse_,UI,UO,)  ( const BAT *bres, const BAT *bone, const BAT *btwo, 
BUN n,
                        bit *two_tail_sorted_unsigned,
                        bit *two_tail_revsorted_unsigned )
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to