mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2024-12-12 10:04:14 +02:00
Avoid calling strlen() twice in bufNewZ().
This commit is contained in:
parent
5404628148
commit
3be9f2dee7
@ -107,6 +107,11 @@
|
||||
</release-item>
|
||||
|
||||
<release-item>
|
||||
<release-item-contributor-list>
|
||||
<release-item-contributor id="david.steele"/>
|
||||
<release-item-contributor id="stephen.frost"/>
|
||||
</release-item-contributor-list>
|
||||
|
||||
<p>Add <code>bufNewZ()</code> and <code>bufHex()</code>to <code>Buffer</code> object.</p>
|
||||
</release-item>
|
||||
|
||||
|
@ -101,9 +101,9 @@ bufNewZ(const char *string)
|
||||
FUNCTION_TEST_ASSERT(string != NULL);
|
||||
FUNCTION_TEST_END();
|
||||
|
||||
// Create object and copy string
|
||||
// Create a new buffer and then copy the string into it.
|
||||
Buffer *this = bufNew(strlen(string));
|
||||
memcpy(this->buffer, string, strlen(string));
|
||||
memcpy(this->buffer, string, this->size);
|
||||
this->used = this->size;
|
||||
|
||||
FUNCTION_TEST_RESULT(BUFFER, this);
|
||||
|
Loading…
Reference in New Issue
Block a user