Skip to content
Snippets Groups Projects
Commit aeca7dd7 authored by Jonathan Schöbel's avatar Jonathan Schöbel
Browse files

Text: added constructor with initialization

The constructor SH_Text_new_from_string accepts a string, with that the
text is initialized. This can replace the so far needed two calls
SH_Text_new and SH_Text_append_string.

When writing the test, it was neccessary to simulate an overflow.
Thereby a bug was detected regarding another overflow test. The bug was,
that when SIZE_MAX % CHUNK_SIZE == 0 (which is normally true, if 2^n is
taken as the value for CHUNK_SIZE) there can't be an overflow, so the
test for an overflow fails. Actually there wasn't a neccesity to check
for an overflow, as this could easily be bypassed by just allocating the
requested size instead of the next chunk size, if this would be greater
then SIZE_MAX.
parent c8717673
Branches
Tags
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment