Changeset: 41918ef13b0c for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=41918ef13b0c
Modified Files:
        gdk/gdk_atoms.h
        gdk/gdk_private.h
        monetdb5/modules/mal/batcalc.c
        monetdb5/modules/mal/mal_io.c
        sql/backends/monet5/sql_result.c
Branch: default
Log Message:

Make ATOMbasetype globally available.


diffs (87 lines):

diff --git a/gdk/gdk_atoms.h b/gdk/gdk_atoms.h
--- a/gdk/gdk_atoms.h
+++ b/gdk/gdk_atoms.h
@@ -211,6 +211,15 @@ gdk_export const ptr ptr_nil;
 #define ATOMfix(t,v)           do if (BATatoms[t].atomFix) 
BATatoms[t].atomFix(v); while (0)
 #define ATOMunfix(t,v)         do if (BATatoms[t].atomUnfix) 
BATatoms[t].atomUnfix(v); while (0)
 
+/* The base type is the storage type if the comparison function and
+ * nil values are the same as those of the storage type; otherwise it
+ * is the type itself. */
+#define ATOMbasetype(t)        ((t) != ATOMstorage(t) &&                       
\
+                        ATOMnilptr(t) == ATOMnilptr(ATOMstorage(t)) && \
+                        ATOMcompare(t) == ATOMcompare(ATOMstorage(t)) && \
+                        BATatoms[t].atomHash == 
BATatoms[ATOMstorage(t)].atomHash ? \
+                        ATOMstorage(t) : (t))
+
 /*
  * In case that atoms are added to a bat, their logical reference
  * count should be incremented (and decremented if deleted). Notice
diff --git a/gdk/gdk_private.h b/gdk/gdk_private.h
--- a/gdk/gdk_private.h
+++ b/gdk/gdk_private.h
@@ -249,15 +249,6 @@ extern MT_Lock MT_system_lock;
 
 #define ATOMappendpriv(t, h) (ATOMstorage(t) != TYPE_str || GDK_ELIMDOUBLES(h))
 
-/* The base type is the storage type if the comparison function and
- * nil values are the same as those of the storage type; otherwise it
- * is the type itself. */
-#define ATOMbasetype(t)        ((t) != ATOMstorage(t) &&                       
\
-                        ATOMnilptr(t) == ATOMnilptr(ATOMstorage(t)) && \
-                        ATOMcompare(t) == ATOMcompare(ATOMstorage(t)) && \
-                        BATatoms[t].atomHash == 
BATatoms[ATOMstorage(t)].atomHash ? \
-                        ATOMstorage(t) : (t))
-
 #define BBPdirty(x)    (BBP_dirty=(x))
 
 #define BATcheck(tst, msg, err)                                                
\
diff --git a/monetdb5/modules/mal/batcalc.c b/monetdb5/modules/mal/batcalc.c
--- a/monetdb5/modules/mal/batcalc.c
+++ b/monetdb5/modules/mal/batcalc.c
@@ -18,13 +18,6 @@
 #define batcalc_export extern
 #endif
 
-/* see gdk_private.h -- copied here until that can be moved to gdk.h */
-#define ATOMbasetype(t)        ((t) != ATOMstorage(t) &&                       
\
-                        ATOMnilptr(t) == ATOMnilptr(ATOMstorage(t)) && \
-                        ATOMcompare(t) == ATOMcompare(ATOMstorage(t)) && \
-                        BATatoms[t].atomHash == 
BATatoms[ATOMstorage(t)].atomHash ? \
-                        ATOMstorage(t) : (t))
-
 static str
 mythrow(enum malexception type, const char *fcn, const char *msg)
 {
diff --git a/monetdb5/modules/mal/mal_io.c b/monetdb5/modules/mal/mal_io.c
--- a/monetdb5/modules/mal/mal_io.c
+++ b/monetdb5/modules/mal/mal_io.c
@@ -280,11 +280,7 @@ IOprintf_(str *res, str format, ...)
                                return_error(toofew_error);
                        }
                        type = va_arg(ap, int);
-                       if (type != ATOMstorage(type) &&
-                               ATOMnilptr(type) == 
ATOMnilptr(ATOMstorage(type)) &&
-                               ATOMcompare(type) == 
ATOMcompare(ATOMstorage(type)) &&
-                               BATatoms[type].atomHash == 
BATatoms[ATOMstorage(type)].atomHash)
-                               type = ATOMstorage(type);
+                       type = ATOMbasetype(type);
 
                        len = 1 + (cur - paramseen);
                        memcpy(meta, paramseen, len);
diff --git a/sql/backends/monet5/sql_result.c b/sql/backends/monet5/sql_result.c
--- a/sql/backends/monet5/sql_result.c
+++ b/sql/backends/monet5/sql_result.c
@@ -1341,11 +1341,7 @@ export_length(stream *s, int mtype, int 
 
        if (mtype == TYPE_oid)
                incr = 2;
-       if (mtype != ATOMstorage(mtype) &&
-           ATOMnilptr(mtype) == ATOMnilptr(ATOMstorage(mtype)) &&
-           ATOMcompare(mtype) == ATOMcompare(ATOMstorage(mtype)) &&
-           BATatoms[mtype].atomHash == BATatoms[ATOMstorage(mtype)].atomHash)
-               mtype = ATOMstorage(mtype); /* ATOMbasetype(mtype) */
+       mtype = ATOMbasetype(mtype);
        if (mtype == TYPE_str) {
                if (eclass == EC_CHAR) {
                        ok = mvc_send_int(s, digits);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to