Fix issue #21
This commit is contained in:
parent
db5c341df4
commit
fd88428545
|
@ -2,6 +2,7 @@
|
||||||
A Simple Dynamic Strings Library for C and C++
|
A Simple Dynamic Strings Library for C and C++
|
||||||
|
|
||||||
Version History:
|
Version History:
|
||||||
|
0.95b - Fix issue #21
|
||||||
0.95a - Change brace style because why not?
|
0.95a - Change brace style because why not?
|
||||||
0.95 - C90 Support
|
0.95 - C90 Support
|
||||||
0.94 - Remove "declare anywhere"
|
0.94 - Remove "declare anywhere"
|
||||||
|
@ -325,11 +326,10 @@ gbString gb_make_string_length(void const *init_str, gbUsize len) {
|
||||||
gbStringHeader *header;
|
gbStringHeader *header;
|
||||||
gbUsize header_size = sizeof(gbStringHeader);
|
gbUsize header_size = sizeof(gbStringHeader);
|
||||||
void *ptr = GB_ALLOC(header_size + len + 1);
|
void *ptr = GB_ALLOC(header_size + len + 1);
|
||||||
if (!init_str)
|
|
||||||
memset(ptr, 0, header_size + len + 1);
|
|
||||||
|
|
||||||
if (ptr == GB_NULLPTR)
|
if (ptr == GB_NULLPTR)
|
||||||
return GB_NULLPTR;
|
return GB_NULLPTR;
|
||||||
|
if (!init_str)
|
||||||
|
memset(ptr, 0, header_size + len + 1);
|
||||||
|
|
||||||
str = (char *)ptr + header_size;
|
str = (char *)ptr + header_size;
|
||||||
header = GB_STRING_HEADER(str);
|
header = GB_STRING_HEADER(str);
|
||||||
|
|
Loading…
Reference in New Issue