mirror of
https://github.com/FirebirdSQL/firebird.git
synced 2025-01-23 06:03:02 +01:00
I don't see the point in creating temporary strings in these cases.
This commit is contained in:
parent
d1fa698a13
commit
5d2a0118c0
@ -104,7 +104,7 @@ string IntlUtil::generateSpecificAttributes(Jrd::CharSet* cs, SpecificAttributes
|
||||
size = cs->getConvFromUnicode().convert(
|
||||
sizeof(equalChar), (const UCHAR*) &equalChar, sizeof(c), c);
|
||||
|
||||
s += string((const char*) &c, size);
|
||||
s.append((const char*) &c, size);
|
||||
|
||||
s += escapeAttribute(cs, attribute->second);
|
||||
|
||||
@ -116,7 +116,7 @@ string IntlUtil::generateSpecificAttributes(Jrd::CharSet* cs, SpecificAttributes
|
||||
size = cs->getConvFromUnicode().convert(
|
||||
sizeof(semiColonChar), (const UCHAR*) &semiColonChar, sizeof(c), c);
|
||||
|
||||
s += string((const char*) &c, size);
|
||||
s.append((const char*) &c, size);
|
||||
}
|
||||
}
|
||||
|
||||
@ -169,7 +169,7 @@ bool IntlUtil::parseSpecificAttributes(Jrd::CharSet* cs, ULONG len, const UCHAR*
|
||||
if (p - start == 0)
|
||||
return false;
|
||||
|
||||
string name = string((const char*)start, p - start);
|
||||
string name((const char*)start, p - start);
|
||||
name = unescapeAttribute(cs, name);
|
||||
|
||||
while (p < end && size == cs->getSpaceLength() &&
|
||||
|
@ -637,7 +637,7 @@ static int typeBuffer(ISC_STATUS* status, char* buf, int offset,
|
||||
parseLong(p, uData.adm, loop);
|
||||
break;
|
||||
default: // give up - treat it as gsec error
|
||||
text = Firebird::string(p - 1, loop + 1);
|
||||
text.assign(p - 1, loop + 1);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -372,7 +372,7 @@ void defineComputed(DsqlCompilerScratch* dsqlScratch, dsql_nod* relation, dsql_f
|
||||
// Generate the source text.
|
||||
const dsql_str* sourceStr = (dsql_str*) node->nod_arg[Dsql::e_cmp_text];
|
||||
fb_assert(sourceStr->str_length <= MAX_USHORT);
|
||||
source = string(sourceStr->str_data, sourceStr->str_length);
|
||||
source.assign(sourceStr->str_data, sourceStr->str_length);
|
||||
|
||||
value.assign(dsqlScratch->getBlrData());
|
||||
}
|
||||
@ -1839,7 +1839,7 @@ void CreateAlterFunctionNode::storeArgument(thread_db* tdbb, DsqlCompilerScratch
|
||||
|
||||
dsql_str* defaultString =
|
||||
(dsql_str*) parameter.legacyDefault->nod_arg[e_dft_default_source];
|
||||
string defaultSource = string(defaultString->str_data, defaultString->str_length);
|
||||
const string defaultSource(defaultString->str_data, defaultString->str_length);
|
||||
attachment->storeMetaDataBlob(tdbb, transaction, &ARG.RDB$DEFAULT_SOURCE, defaultSource);
|
||||
|
||||
dsqlScratch->getBlrData().clear();
|
||||
@ -2667,7 +2667,7 @@ void CreateAlterProcedureNode::storeParameter(thread_db* tdbb, DsqlCompilerScrat
|
||||
{
|
||||
dsql_str* defaultString =
|
||||
(dsql_str*) parameter.legacyDefault->nod_arg[e_dft_default_source];
|
||||
string defaultSource = string(defaultString->str_data, defaultString->str_length);
|
||||
const string defaultSource(defaultString->str_data, defaultString->str_length);
|
||||
attachment->storeMetaDataBlob(tdbb, transaction, &PRM.RDB$DEFAULT_SOURCE, defaultSource);
|
||||
|
||||
dsqlScratch->getBlrData().clear();
|
||||
@ -3812,7 +3812,7 @@ void CreateDomainNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch
|
||||
{
|
||||
dsql_str* defaultString =
|
||||
(dsql_str*) nameType.legacyDefault->nod_arg[e_dft_default_source];
|
||||
string defaultSource = string(defaultString->str_data, defaultString->str_length);
|
||||
const string defaultSource(defaultString->str_data, defaultString->str_length);
|
||||
|
||||
FLD.RDB$DEFAULT_SOURCE.NULL = FALSE;
|
||||
attachment->storeMetaDataBlob(tdbb, transaction, &FLD.RDB$DEFAULT_SOURCE, defaultSource);
|
||||
@ -3834,7 +3834,7 @@ void CreateDomainNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch
|
||||
if (check)
|
||||
{
|
||||
dsql_str* checkString = (dsql_str*) check->nod_arg[e_cnstr_source];
|
||||
string checkSource = string(checkString->str_data, checkString->str_length);
|
||||
const string checkSource(checkString->str_data, checkString->str_length);
|
||||
|
||||
FLD.RDB$VALIDATION_SOURCE.NULL = FALSE;
|
||||
attachment->storeMetaDataBlob(tdbb, transaction, &FLD.RDB$VALIDATION_SOURCE, checkSource);
|
||||
@ -4365,7 +4365,7 @@ void AlterDomainNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch,
|
||||
dsqlScratch->domainValue.dsc_scale = localField.fld_scale;
|
||||
|
||||
dsql_str* checkString = (dsql_str*) setConstraint->nod_arg[e_cnstr_source];
|
||||
string checkSource = string(checkString->str_data, checkString->str_length);
|
||||
const string checkSource(checkString->str_data, checkString->str_length);
|
||||
|
||||
FLD.RDB$VALIDATION_SOURCE.NULL = FALSE;
|
||||
attachment->storeMetaDataBlob(tdbb, transaction, &FLD.RDB$VALIDATION_SOURCE, checkSource);
|
||||
@ -4402,7 +4402,7 @@ void AlterDomainNode::execute(thread_db* tdbb, DsqlCompilerScratch* dsqlScratch,
|
||||
|
||||
dsql_str* defaultString =
|
||||
(dsql_str*) setDefault->nod_arg[e_dft_default_source];
|
||||
string defaultSource = string(defaultString->str_data, defaultString->str_length);
|
||||
const string defaultSource(defaultString->str_data, defaultString->str_length);
|
||||
|
||||
FLD.RDB$DEFAULT_SOURCE.NULL = FALSE;
|
||||
attachment->storeMetaDataBlob(tdbb, transaction, &FLD.RDB$DEFAULT_SOURCE, defaultSource);
|
||||
@ -5597,7 +5597,7 @@ bool RelationNode::defineDefault(thread_db* /*tdbb*/, DsqlCompilerScratch* dsqlS
|
||||
// Generate the source text.
|
||||
const dsql_str* sourceStr = (dsql_str*) node->nod_arg[Dsql::e_dft_default_source];
|
||||
fb_assert(sourceStr->str_length <= MAX_USHORT);
|
||||
source = string(sourceStr->str_data, sourceStr->str_length);
|
||||
source.assign(sourceStr->str_data, sourceStr->str_length);
|
||||
|
||||
value.assign(dsqlScratch->getBlrData());
|
||||
|
||||
|
@ -160,5 +160,5 @@ void Parser::transformString(const char* start, unsigned length, string& dest)
|
||||
fb_assert(start + length - pos >= 0);
|
||||
buffer.add(pos, start + length - pos);
|
||||
|
||||
dest = string(buffer.begin(), MIN(string::max_length(), buffer.getCount()));
|
||||
dest.assign(buffer.begin(), MIN(string::max_length(), buffer.getCount()));
|
||||
}
|
||||
|
@ -3280,7 +3280,7 @@ void ExecStatementNode::getString(thread_db* tdbb, jrd_req* request, const Value
|
||||
&p, buffer);
|
||||
}
|
||||
|
||||
str = string((char*) p, len);
|
||||
str.assign((char*) p, len);
|
||||
str.trim();
|
||||
}
|
||||
|
||||
|
@ -701,7 +701,7 @@ bool IntlManager::setupCollationAttributes(
|
||||
}
|
||||
|
||||
if (len != INTL_BAD_STR_LENGTH)
|
||||
newSpecificAttributes = string((const char*) buffer.begin(), len);
|
||||
newSpecificAttributes.assign((const char*) buffer.begin(), len);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
@ -1135,7 +1135,7 @@ void Statement::preprocess(const string& sql, string& ret)
|
||||
return;
|
||||
}
|
||||
|
||||
ret += string(start, p - start);
|
||||
ret.append(start, p - start);
|
||||
|
||||
while (p < end)
|
||||
{
|
||||
@ -1183,7 +1183,7 @@ void Statement::preprocess(const string& sql, string& ret)
|
||||
ident.upper();
|
||||
if (ident == "AS")
|
||||
{
|
||||
ret += string(start, end - start);
|
||||
ret.append(start, end - start);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1193,7 +1193,7 @@ void Statement::preprocess(const string& sql, string& ret)
|
||||
case ttComment:
|
||||
case ttString:
|
||||
case ttOther:
|
||||
ret += string(start, p - start);
|
||||
ret.append(start, p - start);
|
||||
break;
|
||||
|
||||
case ttBrokenComment:
|
||||
|
@ -4949,7 +4949,7 @@ static void save_trigger_data(thread_db* tdbb, trig_vec** ptr, jrd_rel* relation
|
||||
ULONG length = bodyBlob->BLB_get_data(tdbb, (UCHAR*) temp.getBuffer(bodyBlob->blb_length),
|
||||
bodyBlob->blb_length);
|
||||
|
||||
t.extBody = string(temp.begin(), length);
|
||||
t.extBody.assign(temp.begin(), length);
|
||||
}
|
||||
|
||||
t.type = type;
|
||||
|
@ -880,7 +880,7 @@ Firebird::string rem_port::getRemoteId() const
|
||||
|
||||
if (port_protocol_str)
|
||||
{
|
||||
id += Firebird::string(port_protocol_str->str_data, port_protocol_str->str_length);
|
||||
id.append(port_protocol_str->str_data, port_protocol_str->str_length);
|
||||
}
|
||||
if (port_protocol_str && port_address_str)
|
||||
{
|
||||
@ -888,7 +888,7 @@ Firebird::string rem_port::getRemoteId() const
|
||||
}
|
||||
if (port_address_str)
|
||||
{
|
||||
id += Firebird::string(port_address_str->str_data, port_address_str->str_length);
|
||||
id.append(port_address_str->str_data, port_address_str->str_length);
|
||||
}
|
||||
|
||||
return id;
|
||||
|
Loading…
Reference in New Issue
Block a user