Changeset: fb4e3cb3183b for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=fb4e3cb3183b
Modified Files:
NT/monetdb_config.h.in
gdk/gdk_calc.c
Branch: default
Log Message:
Use strcpy and strcpy_s to concatenate strings efficiently.
diffs (31 lines):
diff --git a/NT/monetdb_config.h.in b/NT/monetdb_config.h.in
--- a/NT/monetdb_config.h.in
+++ b/NT/monetdb_config.h.in
@@ -517,6 +517,9 @@
/* Define to 1 if you have the `strcasestr' function. */
/* #undef HAVE_STRCASESTR */
+/* Define to 1 if you have the `strcpy_s' function. */
+#define HAVE_STRCPY_S 1
+
/* Define to 1 if you have the `strftime' function. */
#if !defined(_MSC_VER) || _MSC_VER >= 1500
#define HAVE_STRFTIME 1
diff --git a/gdk/gdk_calc.c b/gdk/gdk_calc.c
--- a/gdk/gdk_calc.c
+++ b/gdk/gdk_calc.c
@@ -3099,10 +3099,11 @@ addstr_loop(BAT *b1, const char *l, BAT
if (s == NULL)
goto bunins_failed;
}
-#ifdef HAVE_STPCPY
- (void) stpcpy(stpcpy(s, l), r);
+#ifdef HAVE_STRCPY_S
+ strcpy_s(s, slen, l);
+ strcpy_s(s + llen, slen - llen, r);
#else
- snprintf(s, slen, "%s%s", l, r);
+ (void) strcpy(strcpy(s, l) + llen, r);
#endif
tfastins_nocheck(bn, i, s, Tsize(bn));
}
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list