Changeset: b31e0dc3359f for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b31e0dc3359f
Modified Files:
common/utils/mstring.h
monetdb5/mal/mal_instruction.c
Branch: linear-hashing
Log Message:
Fix return value of strcpy_len; avoid calling it in very expensive situations.
diffs (31 lines):
diff --git a/common/utils/mstring.h b/common/utils/mstring.h
--- a/common/utils/mstring.h
+++ b/common/utils/mstring.h
@@ -19,8 +19,8 @@ strcpy_len(char *restrict dst, const cha
if ((dst[i] = src[i]) == 0)
return i;
}
- dst[n - 1] = 0;
- return n-1;
+ dst[--n] = 0;
+ return n + strlen(src + n);
}
return strlen(src);
}
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
@@ -778,7 +778,12 @@ newVariable(MalBlkPtr mb, const char *na
if( name == 0 || len == 0){
(void) snprintf(getVarName(mb,n), IDLENGTH,"%c%c%d", REFMARKER,
TMPMARKER,mb->vid++);
} else {
- (void) strcpy_len( getVarName(mb,n), name, len + 1);
+ /* avoid calling strcpy_len since we're not interested in the
+ * source length, and that may be very large */
+ char *nme = getVarName(mb,n);
+ for (size_t i = 0; i < len; i++)
+ nme[i] = name[i];
+ nme[len] = 0;
}
setRowCnt(mb,n,0);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list