Changeset: 557c67973cd8 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/557c67973cd8
Modified Files:
        gdk/gdk.h
        gdk/gdk_align.c
        gdk/gdk_subquery.c
        gdk/gdk_system.h
        sql/backends/monet5/UDF/capi/capi.c
Branch: default
Log Message:

Cleanup.
Removed duplicated includes; we don't need the struct COLrec anymore;
some other small stuff.


diffs (233 lines):

diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -310,14 +310,9 @@
 #define _GDK_H_
 
 /* standard includes upon which all configure tests depend */
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
 #ifdef HAVE_SYS_STAT_H
 # include <sys/stat.h>
 #endif
-#include <stddef.h>
-#include <string.h>
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
 #endif
@@ -711,38 +706,6 @@ gdk_export bool VALisnil(const ValRecord
 
 typedef struct PROPrec PROPrec;
 
-/* see also comment near BATassertProps() for more information about
- * the properties */
-typedef struct {
-       uint16_t width;         /* byte-width of the atom array */
-       int8_t type;            /* type id. */
-       uint8_t shift;          /* log2 of bun width */
-       bool key:1,             /* no duplicate values present */
-               nonil:1,        /* there are no nils in the column */
-               nil:1,          /* there is a nil in the column */
-               sorted:1,       /* column is sorted in ascending order */
-               revsorted:1,    /* column is sorted in descending order */
-               ascii:1;        /* string column is fully ASCII (7 bit) */
-       BUN nokey[2];           /* positions that prove key==FALSE */
-       BUN nosorted;           /* position that proves sorted==FALSE */
-       BUN norevsorted;        /* position that proves revsorted==FALSE */
-       BUN minpos, maxpos;     /* location of min/max value */
-       double unique_est;      /* estimated number of unique values */
-       oid seq;                /* start of dense sequence */
-
-       Heap *heap;             /* space for the column. */
-       BUN baseoff;            /* offset in heap->base (in whole items) */
-       Heap *vheap;            /* space for the varsized data. */
-       Hash *hash;             /* hash table */
-#ifdef HAVE_RTREE
-       RTree *rtree;           /* rtree geometric index */
-#endif
-       Heap *orderidx;         /* order oid index */
-       Strimps *strimps;       /* string imprint index  */
-
-       PROPrec *props;         /* list of dynamic properties stored in the bat 
descriptor */
-} COLrec;
-
 #define ORDERIDXOFF            3
 
 /* assert that atom width is power of 2, i.e., width == 1<<shift */
@@ -788,9 +751,8 @@ typedef struct BAT {
 
        /* dynamic bat properties */
        restrict_t batRestricted:2; /* access privileges */
-       bool
-        batTransient:1,        /* should the BAT persist on disk? */
-        batCopiedtodisk:1;     /* once written */
+       bool batTransient:1;    /* should the BAT persist on disk? */
+       bool batCopiedtodisk:1; /* once written */
        uint16_t selcnt;        /* how often used in equi select without hash */
        uint16_t unused;        /* value=0 for now (sneakily used by mat.c) */
 
@@ -800,41 +762,41 @@ typedef struct BAT {
        BUN batCapacity;        /* tuple capacity */
 
        /* dynamic column properties */
-       COLrec T;               /* column info */
+       uint16_t twidth;        /* byte-width of the atom array */
+       int8_t ttype;           /* type id. */
+       uint8_t tshift;         /* log2 of bun width */
+       /* see also comment near BATassertProps() for more information
+        * about the properties */
+       bool tkey:1;            /* no duplicate values present */
+       bool tnonil:1;          /* there are no nils in the column */
+       bool tnil:1;            /* there is a nil in the column */
+       bool tsorted:1;         /* column is sorted in ascending order */
+       bool trevsorted:1;      /* column is sorted in descending order */
+       bool tascii:1;          /* string column is fully ASCII (7 bit) */
+       BUN tnokey[2];          /* positions that prove key==FALSE */
+       BUN tnosorted;          /* position that proves sorted==FALSE */
+       BUN tnorevsorted;       /* position that proves revsorted==FALSE */
+       BUN tminpos, tmaxpos;   /* location of min/max value */
+       double tunique_est;     /* estimated number of unique values */
+       oid tseqbase;           /* start of dense sequence */
+
+       Heap *theap;            /* space for the column. */
+       BUN tbaseoff;           /* offset in heap->base (in whole items) */
+       Heap *tvheap;           /* space for the varsized data. */
+       Hash *thash;            /* hash table */
+#ifdef HAVE_RTREE
+       RTree *trtree;          /* rtree geometric index */
+#endif
+       Heap *torderidx;        /* order oid index */
+       Strimps *tstrimps;      /* string imprint index  */
+       PROPrec *tprops;        /* list of dynamic properties stored in the bat 
descriptor */
+
        MT_Lock theaplock;      /* lock protecting heap reference changes */
        MT_RWLock thashlock;    /* lock specifically for hash management */
        MT_Lock batIdxLock;     /* lock to manipulate other indexes/properties 
*/
        Heap *oldtail;          /* old tail heap, to be destroyed after commit 
*/
 } BAT;
 
-/* macros to hide complexity of the BAT structure */
-#define ttype          T.type
-#define tkey           T.key
-#define tseqbase       T.seq
-#define tsorted                T.sorted
-#define trevsorted     T.revsorted
-#define tascii         T.ascii
-#define torderidx      T.orderidx
-#define twidth         T.width
-#define tshift         T.shift
-#define tnonil         T.nonil
-#define tnil           T.nil
-#define tnokey         T.nokey
-#define tnosorted      T.nosorted
-#define tnorevsorted   T.norevsorted
-#define tminpos                T.minpos
-#define tmaxpos                T.maxpos
-#define tunique_est    T.unique_est
-#define theap          T.heap
-#define tbaseoff       T.baseoff
-#define tvheap         T.vheap
-#define thash          T.hash
-#define tprops         T.props
-#define tstrimps       T.strimps
-#ifdef HAVE_RTREE
-#define trtree         T.rtree
-#endif
-
 /* some access functions for the bitmask type */
 static inline void
 mskSet(BAT *b, BUN p)
diff --git a/gdk/gdk_align.c b/gdk/gdk_align.c
--- a/gdk/gdk_align.c
+++ b/gdk/gdk_align.c
@@ -168,7 +168,7 @@ VIEWcreate(oid seq, BAT *b, BUN l, BUN h
        bn->batCapacity = b->batCapacity;
        bn->batRestricted = BAT_READ;
 
-       /* the T column descriptor is fully copied except for the
+       /* the column descriptor is fully copied except for the
         * accelerator data. We need copies because in case of a mark,
         * we are going to override a column with a void. */
        bn->tkey = bi.key;
diff --git a/gdk/gdk_subquery.c b/gdk/gdk_subquery.c
--- a/gdk/gdk_subquery.c
+++ b/gdk/gdk_subquery.c
@@ -493,8 +493,7 @@ BATallnotequal_grp(BAT *l, BAT *r, BAT *
        }
 
        if (BATcount(l) == 0 || ngrp == 0) {
-               bit T = TRUE;
-               if ((res = BATconstant(ngrp == 0 ? 0 : min, TYPE_bit, &T, ngrp, 
TRANSIENT)) == NULL)
+               if ((res = BATconstant(ngrp == 0 ? 0 : min, TYPE_bit, 
&(bit){TRUE}, ngrp, TRANSIENT)) == NULL)
                        goto alloc_fail;
        } else {
                bit *restrict ret;
@@ -759,8 +758,7 @@ BATallnotequal_grp2(BAT *l, BAT *r, BAT 
        }
 
        if (BATcount(l) == 0 || ngrp == 0) {
-               bit T = TRUE;
-               if ((res = BATconstant(ngrp == 0 ? 0 : min, TYPE_bit, &T, ngrp, 
TRANSIENT)) == NULL)
+               if ((res = BATconstant(ngrp == 0 ? 0 : min, TYPE_bit, 
&(bit){TRUE}, ngrp, TRANSIENT)) == NULL)
                        goto alloc_fail;
        } else {
                bit *restrict ret;
@@ -955,8 +953,7 @@ BATsubnot_exist(BAT *b, BAT *g, BAT *e, 
        }
 
        if (BATcount(b) == 0 || ngrp == 0) {
-               bit T = TRUE;
-               if ((res = BATconstant(ngrp == 0 ? 0 : min, TYPE_bit, &T, ngrp, 
TRANSIENT)) == NULL)
+               if ((res = BATconstant(ngrp == 0 ? 0 : min, TYPE_bit, 
&(bit){TRUE}, ngrp, TRANSIENT)) == NULL)
                        goto alloc_fail;
        } else {
                bit *restrict exists;
diff --git a/gdk/gdk_system.h b/gdk/gdk_system.h
--- a/gdk/gdk_system.h
+++ b/gdk/gdk_system.h
@@ -235,7 +235,6 @@ gdk_export char *GDKgetbuf(void);
 /*
  * @- MT Lock API
  */
-#include "matomic.h"
 
 /* define this to keep lock statistics (can be expensive) */
 /* #define LOCK_STATS 1 */
diff --git a/sql/backends/monet5/UDF/capi/capi.c 
b/sql/backends/monet5/UDF/capi/capi.c
--- a/sql/backends/monet5/UDF/capi/capi.c
+++ b/sql/backends/monet5/UDF/capi/capi.c
@@ -671,12 +671,12 @@ static str CUDFeval(Client cntxt, MalBlk
                // we have to compile it
 
                // first generate the names     of the files
-               // we place the temporary files in the DELDIR directory
+               // we place the temporary files in the TEMPDIR directory
                // because this will be removed again upon server startup
                const int RANDOM_NAME_SIZE = 32;
                const char prefix[] = TEMPDIR_NAME DIR_SEP_STR;
                size_t prefix_size = strlen(prefix);
-               char deldirpath[MAXPATH];
+               char tempdirpath[MAXPATH];
 
                memcpy(buf, prefix, sizeof(char) * strlen(prefix));
                // generate a random 32-character name for the temporary files
@@ -705,14 +705,14 @@ static str CUDFeval(Client cntxt, MalBlk
                        goto wrapup;
                }
 
-               // if DELDIR directory does not exist, create it
-               if (GDKfilepath(deldirpath, sizeof(deldirpath), 0, NULL, 
TEMPDIR, NULL) != GDK_SUCCEED) {
+               // if TEMPDIR directory does not exist, create it
+               if (GDKfilepath(tempdirpath, sizeof(tempdirpath), 0, NULL, 
TEMPDIR, NULL) != GDK_SUCCEED) {
                        msg = createException(MAL, "cudf.eval", 
MAL_MALLOC_FAIL);
                        goto wrapup;
                }
-               if (MT_mkdir(deldirpath) < 0 && errno != EEXIST) {
+               if (MT_mkdir(tempdirpath) < 0 && errno != EEXIST) {
                        msg = createException(MAL, "cudf.eval",
-                                                                 "cannot 
create directory %s\n", deldirpath);
+                                                                 "cannot 
create directory %s\n", tempdirpath);
                        goto wrapup;
                }
 
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to