Changeset: 8b2e2334c826 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB/rev/8b2e2334c826 Branch: inet4+6 Log Message:
Merge with default branch.
diffs (166 lines):
diff --git a/monetdb5/modules/mal/manifold.c b/monetdb5/modules/mal/manifold.c
--- a/monetdb5/modules/mal/manifold.c
+++ b/monetdb5/modules/mal/manifold.c
@@ -57,71 +57,30 @@ typedef struct {
// Loop through the first BAT
// keep the last error message received
-#define MALfcn1(Type) (str (*) (Type *, void *))
-#define MALfcn2(Type) (str (*) (Type *, void *, void *))
-#define MALfcn3(Type) (str (*) (Type *, void *, void *, void *))
-#define MALfcn4(Type) (str (*) (Type *, void *, void *, void *, void *))
-#define MALfcn5(Type) (str (*) (Type *, void *, void *, void *, void *, void
*))
-#define ManifoldLoop(N, Type, ...)
\
+#define MALfcn1 (str (*) (void *, void *))
+#define MALfcn2 (str (*) (void *, void *, void *))
+#define MALfcn3 (str (*) (void *, void *, void *, void *))
+#define MALfcn4 (str (*) (void *, void *, void *, void *, void *))
+#define MALfcn5 (str (*) (void *, void *, void *, void *, void *, void *))
+#define MALfcn1ptr (str (*) (void **, void *))
+#define MALfcn2ptr (str (*) (void **, void *, void *))
+#define MALfcn3ptr (str (*) (void **, void *, void *, void *))
+#define MALfcn4ptr (str (*) (void **, void *, void *, void *, void *))
+#define MALfcn5ptr (str (*) (void **, void *, void *, void *, void *, void *))
+
+#define Manifoldbody(N, ...)
\
do {
\
- Type *v = (Type *) mut->args[0].first;
\
- for (;;) {
\
- msg = (*(MALfcn##N(Type) mut->pci->fcn))(v,
__VA_ARGS__); \
- if (msg)
\
- break;
\
- if (++oo == olimit)
\
- break;
\
- for (i = mut->fvar; i <= mut->lvar; i++) {
\
- if (ATOMstorage(mut->args[i].type) ==
TYPE_void) { \
- args[i] = (void *) &mut->args[i].o;
\
- mut->args[i].o++;
\
- } else if (mut->args[i].size == 0) {
\
- ;
\
- } else if (ATOMstorage(mut->args[i].type) <
TYPE_str) { \
- args[i] += mut->args[i].size;
\
- } else if (ATOMvarsized(mut->args[i].type)) {
\
- mut->args[i].o++;
\
- mut->args[i].s = (str *)
BUNtvar(mut->args[i].bi, mut->args[i].o); \
- args[i] = (void *) &mut->args[i].s;
\
- } else {
\
- mut->args[i].o++;
\
- mut->args[i].s = (str *)
BUNtloc(mut->args[i].bi, mut->args[i].o); \
- args[i] = (void *) &mut->args[i].s;
\
+ if (ATOMextern(mut->args[0].b->ttype)) {
\
+ for (;;) {
\
+ void *v = NULL;
\
+ msg = (*(MALfcn##N##ptr mut->pci->fcn))(&v,
__VA_ARGS__); \
+ if (msg)
\
+ goto bunins_failed;
\
+ if (bunfastapp(mut->args[0].b, v) !=
GDK_SUCCEED) { \
+ GDKfree(v);
\
+ goto bunins_failed;
\
}
\
- }
\
- v++;
\
- }
\
- } while (0)
-
-// The target BAT tail type determines the result variable
-#ifdef HAVE_HGE
-#define Manifoldbody_hge(N,...)
\
- case TYPE_hge: ManifoldLoop(N,hge,__VA_ARGS__); break
-#else
-#define Manifoldbody_hge(N,...)
-#endif
-#define Manifoldbody(N,...)
\
- do {
\
- switch (ATOMstorage(mut->args[0].b->ttype)) {
\
- case TYPE_bte: ManifoldLoop(N,bte,__VA_ARGS__); break;
\
- case TYPE_sht: ManifoldLoop(N,sht,__VA_ARGS__); break;
\
- case TYPE_int: ManifoldLoop(N,int,__VA_ARGS__); break;
\
- case TYPE_lng: ManifoldLoop(N,lng,__VA_ARGS__); break;
\
- Manifoldbody_hge(N,__VA_ARGS__);
\
- case TYPE_oid: ManifoldLoop(N,oid,__VA_ARGS__); break;
\
- case TYPE_flt: ManifoldLoop(N,flt,__VA_ARGS__); break;
\
- case TYPE_dbl: ManifoldLoop(N,dbl,__VA_ARGS__); break;
\
- case TYPE_uuid: ManifoldLoop(N,uuid,__VA_ARGS__); break;
\
- case TYPE_str:
\
- default: {
\
- for (;;) {
\
- msg = (*(MALfcn##N(str) mut->pci->fcn))(&y,
__VA_ARGS__); \
- if (msg)
\
- break;
\
- if (bunfastapp(mut->args[0].b, (void*) y) !=
GDK_SUCCEED) \
- goto bunins_failed;
\
- GDKfree(y);
\
- y = NULL;
\
+ GDKfree(v);
\
if (++oo == olimit)
\
break;
\
for (i = mut->fvar; i <= mut->lvar; i++) {
\
@@ -130,7 +89,7 @@ typedef struct {
mut->args[i].o++;
\
} else if(mut->args[i].size == 0) {
\
;
\
- } else if
(ATOMstorage(mut->args[i].type) < TYPE_str) { \
+ } else if
(ATOMstorage(mut->args[i].type) < TYPE_str) { \
args[i] += mut->args[i].size;
\
} else if
(ATOMvarsized(mut->args[i].type)) { \
mut->args[i].o++;
\
@@ -143,11 +102,37 @@ typedef struct {
}
\
}
\
}
\
- break;
\
- }
\
+ } else {
\
+ void *v = mut->args[0].first;
\
+ size_t w = mut->args[0].b->twidth;
\
+ for (;;) {
\
+ msg = (*(MALfcn##N mut->pci->fcn))(v,
__VA_ARGS__); \
+ if (msg)
\
+ goto bunins_failed;
\
+ if (++oo == olimit)
\
+ break;
\
+ for (i = mut->fvar; i <= mut->lvar; i++) {
\
+ if (ATOMstorage(mut->args[i].type) ==
TYPE_void) { \
+ args[i] = (void *)
&mut->args[i].o; \
+ mut->args[i].o++;
\
+ } else if(mut->args[i].size == 0) {
\
+ ;
\
+ } else if
(ATOMstorage(mut->args[i].type) < TYPE_str) { \
+ args[i] += mut->args[i].size;
\
+ } else if
(ATOMvarsized(mut->args[i].type)) { \
+ mut->args[i].o++;
\
+ mut->args[i].s = (str *)
BUNtvar(mut->args[i].bi, mut->args[i].o); \
+ args[i] = (void *)
&mut->args[i].s; \
+ } else {
\
+ mut->args[i].o++;
\
+ mut->args[i].s = (str *)
BUNtloc(mut->args[i].bi, mut->args[i].o); \
+ args[i] = (void*)
&mut->args[i].s; \
+ }
\
+ }
\
+ v = (void *) ((char *) v + w); /* v += w if v
were char * */ \
+ }
\
}
\
- mut->args[0].b->theap->dirty = true;
\
- } while (0)
+ } while (0)
// single argument is preparatory step for GDK_mapreduce
// Only the last error message is returned, the value of
@@ -157,7 +142,7 @@ MANIFOLDjob(MULTItask *mut)
{
int i;
char **args;
- str y = NULL, msg = MAL_SUCCEED;
+ str msg = MAL_SUCCEED;
oid oo = 0, olimit = mut->args[mut->fvar].cnt;
if (olimit == 0)
@@ -206,8 +191,6 @@ MANIFOLDjob(MULTItask *mut)
default:
msg = createException(MAL, "mal.manifold", "manifold call
limitation ");
}
- if (ATOMextern(mut->args[0].type) && y)
- GDKfree(y);
bunins_failed:
GDKfree(args);
return msg;
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]
