Changeset: 90fb56ff1f0d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=90fb56ff1f0d
Modified Files:
sql/server/sql_semantic.c
Branch: default
Log Message:
Don't make very temporary copies in allocated memory.
diffs (32 lines):
diff --git a/sql/server/sql_semantic.c b/sql/server/sql_semantic.c
--- a/sql/server/sql_semantic.c
+++ b/sql/server/sql_semantic.c
@@ -396,23 +396,17 @@ char *symbol2string(mvc *sql, symbol *se
/* when compiling an expression, a column of a table
might be present in the symbol, so we need this case */
return _STRDUP(l->h->data.sval);
} else if (expression && dlist_length(l) == 2 && l->h->type ==
type_string && l->h->next->type == type_string) {
- char *first = _STRDUP(l->h->data.sval);
- char *second = _STRDUP(l->h->next->data.sval);
+ char *first = l->h->data.sval;
+ char *second = l->h->next->data.sval;
char *res;
if(!first || !second) {
- _DELETE(first);
- _DELETE(second);
return NULL;
}
- res = strconcat(first,".");
- _DELETE(first);
- if(!res) {
- _DELETE(second);
- return NULL;
+ res = NEW_ARRAY(char, strlen(first) + strlen(second) +
2);
+ if (res) {
+ stpcpy(stpcpy(stpcpy(res, first), "."), second);
}
- res = strconcat(res,second);
- _DELETE(second);
return res;
} else {
char *e = dlist2string(sql, l, expression, err);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list