Add strong reference to range objects #132

This commit is contained in:
Jason Turner
2014-08-30 13:36:36 -06:00
parent 3fe80d70c6
commit a71903f185
6 changed files with 61 additions and 9 deletions

View File

@@ -17,15 +17,15 @@
#else
char *mystrdup (const char *s) {
size_t len = strlen(s) + 1; // Space for length plus nul
char *d = static_cast<char*>(malloc (len));
size_t len = strlen(s); // Space for length plus nul
char *d = static_cast<char*>(malloc (len+1));
if (d == nullptr) return nullptr; // No memory
#ifdef CHAISCRIPT_MSVC
strcpy_s(d, len, s); // Copy the characters
#else
strncpy(d,s,len); // Copy the characters
d[len] = '\0';
#endif
d[len] = '\0';
return d; // Return the new string
}