Changeset: 0479fd6a6348 for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=0479fd6a6348 Modified Files: monetdb5/mal/mal_instruction.c monetdb5/mal/mal_module.c monetdb5/mal/mal_parser.c monetdb5/modules/atoms/json.c monetdb5/modules/kernel/array.c Branch: transaction-replication Log Message:
Merge with default branch diffs (120 lines): diff --git a/monetdb5/mal/mal_instruction.c b/monetdb5/mal/mal_instruction.c --- a/monetdb5/mal/mal_instruction.c +++ b/monetdb5/mal/mal_instruction.c @@ -1577,13 +1577,7 @@ pushArgument(MalBlkPtr mb, InstrPtr p, i InstrPtr pn; int pc = 0, pclimit; int space = p->maxarg * sizeof(p->argv[0]) + sizeof(InstrRecord); - pn = GDKmalloc(space + MAXARG * sizeof(p->maxarg)); - if (pn == NULL) { - freeInstruction(p); - return NULL; - } - memcpy((char *) pn, (char *) p, space); - pn->maxarg += MAXARG; + /* instructions are either created in isolation or are stored * on the program instruction stack already. In the latter * case, we may have to adjust their reference. It does not @@ -1599,15 +1593,25 @@ pushArgument(MalBlkPtr mb, InstrPtr p, i pclimit = mb->stop - 8; pclimit = pclimit < 0 ? 0 : pclimit; for (pc = mb->stop - 1; pc >= pclimit; pc--) - if (mb->stmt[pc] == p) { - mb->stmt[pc] = pn; + if (mb->stmt[pc] == p) break; - } + + pn = GDKmalloc(space + MAXARG * sizeof(p->maxarg)); + if (pn == NULL) { + freeInstruction(p); + return NULL; + } + memcpy((char *) pn, (char *) p, space); + GDKfree(p); + pn->maxarg += MAXARG; /* we have to keep track on the maximal arguments/block * because it is needed by the interpreter */ if (mb->maxarg < pn->maxarg) mb->maxarg = pn->maxarg; - GDKfree(p); + if( pc >= pclimit) + mb->stmt[pc] = pn; + //else + // Keep it referenced from the block, assert(0); p = pn; } p->argv[p->argc++] = varid; diff --git a/monetdb5/mal/mal_module.c b/monetdb5/mal/mal_module.c --- a/monetdb5/mal/mal_module.c +++ b/monetdb5/mal/mal_module.c @@ -633,8 +633,11 @@ showHelp(Module m, str txt, stream *fs){ mnstr_printf(fs,"%s\n",msg[i]); if( i == 0){ msg = getHelp(m,txt,0); - for(i=0; msg[i]; i++) + for(i=0; msg[i]; i++){ mnstr_printf(fs,"%s\n",msg[i]); + GDKfree(msg[i]); + } + GDKfree(msg); } } /* diff --git a/monetdb5/mal/mal_parser.c b/monetdb5/mal/mal_parser.c --- a/monetdb5/mal/mal_parser.c +++ b/monetdb5/mal/mal_parser.c @@ -1883,7 +1883,7 @@ parseMAL(Client cntxt, Symbol curPrg) * Comment lines produced by Mx, i.e. #line directives are not saved. * The deadcode optimizer removes all comment information. */ - curInstr = newInstruction(NULL, REMsymbol); + curInstr = newInstruction(curBlk, REMsymbol); cst.vtype = TYPE_str; cst.len = (int) strlen(start); cst.val.sval = GDKstrdup(start); diff --git a/monetdb5/modules/atoms/json.c b/monetdb5/modules/atoms/json.c --- a/monetdb5/modules/atoms/json.c +++ b/monetdb5/modules/atoms/json.c @@ -1809,10 +1809,24 @@ JSONjsonaggr(BAT **bnp, BAT *b, BAT *g, break; } if (!v||strNil(v)) { - if (skip_nils) - continue; - strncpy(buf, str_nil, buflen); - isnil = 1; + if (skip_nils) { + /* + * if q is 1 and the value is + * null, then we need to fill + * in a value. Otherwise + * BATproject will fail. + */ + if ((p == 0 ) && (q == 1)) { + strncpy(buf, "[ null ]", maxlen - buflen); + buflen += strlen("[ null ]"); + isnil = 1; + } else { + continue; + } + } else { + strncpy(buf, str_nil, buflen); + isnil = 1; + } } else { len = strlen(v); if (len >= maxlen - buflen) { diff --git a/monetdb5/modules/kernel/array.c b/monetdb5/modules/kernel/array.c --- a/monetdb5/modules/kernel/array.c +++ b/monetdb5/modules/kernel/array.c @@ -103,7 +103,7 @@ grid_int(BAT **out, int *groups, int *gr return GDK_FAIL; } new_bat(*out, (i * (n - o) * r), int); - if (out == NULL) { + if (*out == NULL) { GDKerror("grid: cannot create the bat (%d BUNs)\n", (i * (n - o) * r)); return GDK_FAIL; } _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list