Changeset: df974fd0bc07 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=df974fd0bc07
Modified Files:
clients/mapiclient/dump.c
Branch: Nov2019
Log Message:
Improve speed of dump by significantly reducing number of function calls.
(In the normal case.)
diffs (37 lines):
diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c
--- a/clients/mapiclient/dump.c
+++ b/clients/mapiclient/dump.c
@@ -127,7 +127,17 @@ squoted_print(stream *f, const char *s,
if (mnstr_printf(f, "%c", quote) < 0)
return -1;
while (*s) {
+ size_t n = strcspn(s, "\\'\"\177"
+ "\001\002\003\004\005\006\007"
+ "\010\011\012\013\014\015\016\017"
+ "\020\021\022\023\024\025\026\027"
+ "\030\031\032\033\034\035\036\037");
+ if (n > 0 && mnstr_write(f, s, 1, n) < 0)
+ return -1;
+ s += n;
switch (*s) {
+ case '\0':
+ continue;
case '\\':
if (mnstr_write(f, "\\\\", 1, 2) < 0)
return -1;
@@ -147,13 +157,8 @@ squoted_print(stream *f, const char *s,
return -1;
break;
default:
- if ((0 < *s && *s < 32) || *s == '\177') {
- if (mnstr_printf(f, "\\%03o", (uint8_t) *s) < 0)
- return -1;
- } else {
- if (mnstr_write(f, s, 1, 1) < 0)
- return -1;
- }
+ if (mnstr_printf(f, "\\%03o", (uint8_t) *s) < 0)
+ return -1;
break;
}
s++;
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list