Changeset: 39ea350ebece for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=39ea350ebece
Modified Files:
sql/backends/monet5/sql_basket.c
sql/backends/monet5/sql_cquery.c
Branch: trails
Log Message:
Properly initialize the structures.
diffs (56 lines):
diff --git a/sql/backends/monet5/sql_basket.c b/sql/backends/monet5/sql_basket.c
--- a/sql/backends/monet5/sql_basket.c
+++ b/sql/backends/monet5/sql_basket.c
@@ -59,6 +59,13 @@ static int BSKTnewEntry(void)
int i = bsktTop;
BasketRec *bnew;
+ if( baskets == 0){
+ bnew = (BasketRec *) GDKzalloc((INTIAL_BSKT) *
sizeof(BasketRec));
+ if( bnew == 0)
+ return 0;
+ bsktLimit = INTIAL_BSKT;
+ baskets = bnew;
+ } else
if (bsktTop + 1 == bsktLimit) {
bnew = (BasketRec *) GDKrealloc(baskets,
(bsktLimit+INTIAL_BSKT) * sizeof(BasketRec));
if( bnew == 0)
diff --git a/sql/backends/monet5/sql_cquery.c b/sql/backends/monet5/sql_cquery.c
--- a/sql/backends/monet5/sql_cquery.c
+++ b/sql/backends/monet5/sql_cquery.c
@@ -65,8 +65,8 @@ static BAT *CQ_id_time = 0;
static BAT *CQ_id_error = 0;
static BAT *CQ_id_stmt = 0;
-CQnode *pnet;
-int pnetLimit, pnettop;
+CQnode *pnet = 0;
+int pnetLimit = 0, pnettop = 0;
#define SET_HEARTBEATS(X) (X != NO_HEARTBEAT) ? X * 1000 : NO_HEARTBEAT /*
minimal 1 ms */
@@ -526,6 +526,15 @@ CQregister(Client cntxt, MalBlkPtr mb, M
#endif
MT_lock_set(&ttrLock);
+ if( pnet == 0){
+ pnew = (CQnode *) GDKzalloc((INITIAL_MAXCQ) * sizeof(CQnode));
+ if( pnew == NULL) {
+ msg =
createException(SQL,"cquery.register",SQLSTATE(HY001) MAL_MALLOC_FAIL);
+ goto unlock;
+ }
+ pnetLimit = INITIAL_MAXCQ;
+ pnet = pnew;
+ } else
if (pnettop == pnetLimit) {
pnew = (CQnode *) GDKrealloc(pnet, (pnetLimit+INITIAL_MAXCQ) *
sizeof(CQnode));
if( pnew == NULL) {
@@ -1379,6 +1388,8 @@ CQstartScheduler(void)
throw(MAL, "cquery.startScheduler",SQLSTATE(HY001) "Could not
initialize CQscheduler\n");
}
+ cntxt->curmodule = cntxt->usermodule = userModule();
+
if( SQLinitClient(cntxt) != MAL_SUCCEED) {
bstream_destroy(cntxt->fdin);
mnstr_destroy(cntxt->fdout);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list