mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-19 16:54:08 +10:00
Patched a bug in deepCopyRefString()
This commit is contained in:
@@ -57,17 +57,14 @@ int lengthRefString(RefString* refString) {
|
||||
}
|
||||
|
||||
RefString* copyRefString(RefString* refString) {
|
||||
//Cheaty McCheater Face
|
||||
refString->refcount++;
|
||||
return refString;
|
||||
}
|
||||
|
||||
RefString* deepCopyRefString(RefString* refString) {
|
||||
//deep copy, which can be modified immediately
|
||||
RefString* newRefString = (RefString*)allocate(NULL, 0, sizeof(int) * 2 + refString->length + 1);
|
||||
|
||||
memcpy(newRefString, refString, refString->length + 1);
|
||||
|
||||
return newRefString;
|
||||
//create a new string, with a new refcount
|
||||
return createRefStringLength(refString->data, refString->length);
|
||||
}
|
||||
|
||||
char* toCString(RefString* refString) {
|
||||
|
||||
Reference in New Issue
Block a user