mirror of
https://github.com/corda/corda.git
synced 2025-01-06 05:04:20 +00:00
Replacing strcpy with memcpy - should be slightly faster because we're forced to know strlen, so no need in byte-by-byte copying
This commit is contained in:
parent
647e22bf81
commit
74209edb7d
@ -3159,8 +3159,9 @@ Machine::Machine(System* system, Heap* heap, Finder* bootFinder,
|
|||||||
this->properties = (char**)heap->allocate(sizeof(char*) * propertyCount);
|
this->properties = (char**)heap->allocate(sizeof(char*) * propertyCount);
|
||||||
for (unsigned int i = 0; i < propertyCount; i++)
|
for (unsigned int i = 0; i < propertyCount; i++)
|
||||||
{
|
{
|
||||||
this->properties[i] = (char*)heap->allocate(sizeof(char) * (strlen(properties[i]) + 1));
|
size_t length = strlen(properties[i]) + 1; // +1 for null-terminating char
|
||||||
strcpy(this->properties[i], properties[i]);
|
this->properties[i] = (char*)heap->allocate(sizeof(char) * length);
|
||||||
|
memcpy(this->properties[i], properties[i], length);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* bootstrapProperty = findProperty(this, BOOTSTRAP_PROPERTY);
|
const char* bootstrapProperty = findProperty(this, BOOTSTRAP_PROPERTY);
|
||||||
|
Loading…
Reference in New Issue
Block a user