Changeset: d753abed59e1 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/d753abed59e1
Modified Files:
gdk/gdk_heap.c
gdk/gdk_logger.c
monetdb5/mal/mal_dataflow.c
sql/backends/monet5/UDF/capi/capi.c
Branch: default
Log Message:
Minor changes.
diffs (136 lines):
diff --git a/gdk/gdk_heap.c b/gdk/gdk_heap.c
--- a/gdk/gdk_heap.c
+++ b/gdk/gdk_heap.c
@@ -429,7 +429,7 @@ HEAPshrink(Heap *h, size_t size)
/* don't grow */
return GDK_SUCCEED;
}
- if(!(path = GDKfilepath(h->farmid, BATDIR, h->filename, NULL)))
+ if ((path = GDKfilepath(h->farmid, BATDIR, h->filename, NULL))
== NULL)
return GDK_FAIL;
p = GDKmremap(path,
h->storage == STORE_PRIV ?
diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -1050,7 +1050,7 @@ log_open_output(logger *lg)
GDKfree(new_range);
return GDK_FAIL;
}
- if (!(filename = GDKfilepath(BBPselectfarm(PERSISTENT, 0,
offheap), lg->dir, LOGFILE, id))) {
+ if ((filename = GDKfilepath(BBPselectfarm(PERSISTENT, 0,
offheap), lg->dir, LOGFILE, id)) == NULL) {
TRC_CRITICAL(GDK, "allocation failure\n");
GDKfree(new_range);
return GDK_FAIL;
@@ -2368,7 +2368,7 @@ log_flush(logger *lg, ulng ts)
TRC_CRITICAL(GDK, "log_id filename is too
large\n");
return GDK_FAIL;
}
- if (!(filename = GDKfilepath(BBPselectfarm(PERSISTENT,
0, offheap), lg->dir, LOGFILE, id)))
+ if ((filename = GDKfilepath(BBPselectfarm(PERSISTENT,
0, offheap), lg->dir, LOGFILE, id)) == NULL)
return GDK_FAIL;
if (strlen(filename) >= FILENAME_MAX) {
GDKerror("Logger filename path is too large\n");
@@ -2508,7 +2508,7 @@ string_writer(logger *lg, BAT *b, lng of
for ( ; p < end; ) {
size_t sz = 0;
if (resize) {
- if (!(buf = GDKrealloc(lg->buf, resize))) {
+ if ((buf = GDKrealloc(lg->buf, resize)) == NULL) {
res = GDK_FAIL;
break;
}
diff --git a/monetdb5/mal/mal_dataflow.c b/monetdb5/mal/mal_dataflow.c
--- a/monetdb5/mal/mal_dataflow.c
+++ b/monetdb5/mal/mal_dataflow.c
@@ -149,7 +149,7 @@ q_create(int sz, const char *name)
if (q == NULL)
return NULL;
*q = (Queue) {
- .size = ((sz << 1) >> 1), /* we want a multiple of 2 */
+ .size = (sz + 1) & ~1, /* we want a multiple of 2 */
};
q->data = (FlowEvent*) GDKmalloc(sizeof(FlowEvent) * q->size);
if (q->data == NULL) {
@@ -175,24 +175,17 @@ q_destroy(Queue *q)
/* keep a simple LIFO queue. It won't be a large one, so shuffles of requeue
is possible */
/* we might actually sort it for better scheduling behavior */
static void
-q_enqueue_(Queue *q, FlowEvent d)
+q_enqueue(Queue *q, FlowEvent d)
{
assert(q);
assert(d);
+ MT_lock_set(&q->l);
if (q->last == q->size) {
q->size <<= 1;
q->data = (FlowEvent*) GDKrealloc(q->data, sizeof(FlowEvent) *
q->size);
assert(q->data);
}
q->data[q->last++] = d;
-}
-static void
-q_enqueue(Queue *q, FlowEvent d)
-{
- assert(q);
- assert(d);
- MT_lock_set(&q->l);
- q_enqueue_(q, d);
MT_lock_unset(&q->l);
MT_sema_up(&q->s);
}
@@ -204,30 +197,21 @@ q_enqueue(Queue *q, FlowEvent d)
*/
static void
-q_requeue_(Queue *q, FlowEvent d)
+q_requeue(Queue *q, FlowEvent d)
{
- int i;
-
assert(q);
assert(d);
+ MT_lock_set(&q->l);
if (q->last == q->size) {
/* enlarge buffer */
q->size <<= 1;
q->data = (FlowEvent*) GDKrealloc(q->data, sizeof(FlowEvent) *
q->size);
assert(q->data);
}
- for (i = q->last; i > 0; i--)
+ for (int i = q->last; i > 0; i--)
q->data[i] = q->data[i - 1];
q->data[0] = d;
q->last++;
-}
-static void
-q_requeue(Queue *q, FlowEvent d)
-{
- assert(q);
- assert(d);
- MT_lock_set(&q->l);
- q_requeue_(q, d);
MT_lock_unset(&q->l);
MT_sema_up(&q->s);
}
@@ -929,7 +913,7 @@ runMALdataflow(Client cntxt, MalBlkPtr m
flow->start = startpc + 1;
flow->stop = stoppc;
- flow->done = q_create(stoppc- startpc+1, "flow->done");
+ flow->done = q_create((unsigned) (stoppc - startpc) + 1, "flow->done");
if (flow->done == NULL) {
GDKfree(flow);
throw(MAL, "dataflow", "runMALdataflow(): Failed to create
flow->done queue");
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
@@ -698,7 +698,7 @@ static str CUDFeval(Client cntxt, MalBlk
// if DELDIR directory does not exist, create it
deldirpath = GDKfilepath(0, NULL, TEMPDIR, NULL);
- if (!deldirpath) {
+ if (deldirpath == NULL) {
msg = createException(MAL, "cudf.eval",
MAL_MALLOC_FAIL);
goto wrapup;
}
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]