aboutsummaryrefslogtreecommitdiffstats
path: root/gb_string.h
diff options
context:
space:
mode:
authorGravatar Ginger Bill 2017-02-07 20:13:56 +0000
committerGravatar Ginger Bill 2017-02-07 20:13:56 +0000
commitfd88428545cac94db72e93a1ff36c27153628874 (patch)
tree508410e772974b8868bb97e98bd05ccea752e8a1 /gb_string.h
parentMerge branch 'master' of https://github.com/gingerBill/gb (diff)
Fix issue #21
Diffstat (limited to 'gb_string.h')
-rw-r--r--gb_string.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/gb_string.h b/gb_string.h
index 32ef68a..a0058a5 100644
--- a/gb_string.h
+++ b/gb_string.h
@@ -2,6 +2,7 @@
A Simple Dynamic Strings Library for C and C++
Version History:
+ 0.95b - Fix issue #21
0.95a - Change brace style because why not?
0.95 - C90 Support
0.94 - Remove "declare anywhere"
@@ -325,11 +326,10 @@ gbString gb_make_string_length(void const *init_str, gbUsize len) {
gbStringHeader *header;
gbUsize header_size = sizeof(gbStringHeader);
void *ptr = GB_ALLOC(header_size + len + 1);
- if (!init_str)
- memset(ptr, 0, header_size + len + 1);
-
if (ptr == GB_NULLPTR)
return GB_NULLPTR;
+ if (!init_str)
+ memset(ptr, 0, header_size + len + 1);
str = (char *)ptr + header_size;
header = GB_STRING_HEADER(str);