mirror of
https://github.com/genodelabs/genode.git
synced 2025-05-02 16:52:52 +00:00
base: optional length argument for String::String
This commit is contained in:
parent
31fc7c35e2
commit
638a9cfd40
@ -467,7 +467,9 @@ namespace Genode {
|
|||||||
|
|
||||||
String() : _length(0) { }
|
String() : _length(0) { }
|
||||||
|
|
||||||
String(char const *str) : _length(min(strlen(str) + 1, CAPACITY))
|
String(char const *str, size_t len = ~0UL - 1)
|
||||||
|
:
|
||||||
|
_length(min(len + 1, min(strlen(str) + 1, CAPACITY)))
|
||||||
{
|
{
|
||||||
strncpy(_buf, str, _length);
|
strncpy(_buf, str, _length);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user