Update of /cvsroot/monetdb/pathfinder/compiler/mil
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv20437/compiler/mil
Modified Files:
mil.c mil_opt.c milprint_summer.c
Log Message:
propagated changes of Thursday Feb 21 2008 - Friday Feb 22 2008
from the XQuery_0-22 branch to the development trunk
Index: mil.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/mil/mil.c,v
retrieving revision 1.52
retrieving revision 1.53
diff -u -d -r1.52 -r1.53
--- mil.c 15 Feb 2008 16:53:28 -0000 1.52
+++ mil.c 22 Feb 2008 12:46:27 -0000 1.53
@@ -357,7 +357,7 @@
name -= PF_MIL_RES_VAR_COUNT;
assert (name < 10000);
size_t len = sizeof ("a0000");
- char *res = PFmalloc (len);
+ char *res = PFmalloc (len+1);
snprintf (res, len, "a%04u", name);
return res;
}
Index: mil_opt.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/mil/mil_opt.c,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -d -r1.31 -r1.32
--- mil_opt.c 11 Jan 2008 10:47:10 -0000 1.31
+++ mil_opt.c 22 Feb 2008 12:46:27 -0000 1.32
@@ -899,7 +899,7 @@
int milprintf(opt_t *o, const char *format, ...)
{
int j, i = strlen(format) + 80;
- char *milbuf = INTERN_MALLOC(i);
+ char *milbuf = INTERN_MALLOC(i+1);
va_list ap;
if (milbuf == NULL) return -1;
@@ -908,14 +908,14 @@
va_start(ap, format);
j = vsnprintf(milbuf, i, format, ap);
va_end (ap);
- while (j < 0 || j > i) {
+ while (j < 0 || j >= i) {
int old_i = i;
if (j > 0) /* C99 */
i = j + 1;
else /* old C */
i *= 2;
- milbuf = INTERN_REALLOC(milbuf, old_i, i);
+ milbuf = INTERN_REALLOC(milbuf, old_i+1, i+1);
if (milbuf == NULL) return -1;
va_start(ap, format);
Index: milprint_summer.c
===================================================================
RCS file: /cvsroot/monetdb/pathfinder/compiler/mil/milprint_summer.c,v
retrieving revision 1.410
retrieving revision 1.411
diff -u -d -r1.410 -r1.411
--- milprint_summer.c 15 Feb 2008 12:37:39 -0000 1.410
+++ milprint_summer.c 22 Feb 2008 12:46:28 -0000 1.411
@@ -108,20 +108,20 @@
static void mps_error(const char *format, ...)
{
int j, i = strlen(format) + 80;
- char *msg = PFmalloc(i);
+ char *msg = PFmalloc(i+1);
va_list ap;
/* take in a block of MIL statements */
va_start(ap, format);
j = vsnprintf(msg, i, format, ap);
va_end (ap);
- while (j < 0 || j > i) {
+ while (j < 0 || j >= i) {
int old_i = i;
if (j > 0) /* C99 */
i = j + 1;
else /* old C */
i *= 2;
- msg = PFrealloc(msg, old_i, i);
+ msg = PFrealloc(msg, old_i+1, i+1);
va_start(ap, format);
j = vsnprintf(msg, i, format, ap);
va_end (ap);
@@ -5255,7 +5255,7 @@
cur_level);
char buf[128];
- snprintf(buf, sizeof(buf),
+ snprintf(buf, sizeof(buf)-1,
"fn:replace (string?, string, string%s) as string",
hasFlags?", string":"");
@@ -6078,15 +6078,15 @@
&& !(res->kind == c_var && res->sem.var == LLL(snd)->sem.var)) /* see
query11 hack below */
{
/* cannot be pushed below theta-join, as 'snd_iter.[lng]()' is needed
for 'addValues' (below) */
- snprintf(rx,32,"nil");
- snprintf(order_snd,128,
+ snprintf(rx,sizeof(rx)-1,"nil");
+ snprintf(order_snd,sizeof(order_snd)-1,
"var order_snd :=
snd_iter.leftfetchjoin(iter%03u.reverse());\n",
snd_var);
}
else
{
- snprintf(rx,32,"iter%03u.reverse()",snd_var);
- snprintf(order_snd,128,
+ snprintf(rx,sizeof(rx)-1,"iter%03u.reverse()",snd_var);
+ snprintf(order_snd,sizeof(order_snd)-1,
"var order_snd := snd_iter;
#.leftfetchjoin(iter%03u.reverse()); pushed below theta-join\n",
snd_var);
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Monetdb-pf-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-pf-checkins