Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Maintenance - Mise à jour mensuelle Lundi 6 Février entre 7h00 et 9h00
Open sidebar
Gauthier Quesnel
irritator
Commits
53530f33
Commit
53530f33
authored
Sep 14, 2020
by
Gauthier Quesnel
Browse files
core: remove useless append function
parent
94185991
Changes
2
Hide whitespace changes
Inline
Side-by-side
lib/include/irritator/core.hpp
View file @
53530f33
...
...
@@ -402,21 +402,6 @@ public:
return
{
buffer_
,
size_
};
}
constexpr
void
append
(
const
std
::
string_view
str
)
noexcept
{
const
size_t
remaining
=
length
-
size_
;
if
(
remaining
)
{
size_t
copy
=
std
::
min
(
remaining
-
1
,
str
.
size
());
std
::
strncpy
(
buffer_
+
size_
,
str
.
data
(),
copy
);
copy
+=
size_
;
size_
=
static_cast
<
unsigned
char
>
(
copy
);
assert
(
size_
<
length
);
buffer_
[
size_
]
=
'\0'
;
}
}
constexpr
void
clear
()
noexcept
{
std
::
fill_n
(
buffer_
,
length
,
'\0'
);
...
...
lib/test/public-api.cpp
View file @
53530f33
...
...
@@ -179,15 +179,15 @@ main()
expect
(
f1
==
""
);
expect
(
f1
.
size
()
==
0
_ul
);
f1
.
append
(
"ok"
)
;
f1
=
"ok"
;
expect
(
f1
==
"ok"
);
expect
(
f1
.
size
()
==
2
_ul
);
f1
.
append
(
"ok"
)
;
f1
=
"okok"
;
expect
(
f1
==
"okok"
);
expect
(
f1
.
size
()
==
4
_ul
);
f1
.
append
(
"
1234"
)
;
f1
=
"okok
1234
56
"
;
expect
(
f1
==
"okok123"
);
expect
(
f1
.
size
()
==
7
_ul
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment