MCPcopy Create free account
hub / github.com/ChaiScript/ChaiScript / mystrdup

Function mystrdup

src/libfuzzer_client.cpp:30–41  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28#else
29
30char *mystrdup (const char *s) {
31 size_t len = strlen(s); // Space for length plus nul
32 char *d = static_cast<char*>(malloc (len+1));
33 if (d == nullptr) { return nullptr; } // No memory
34#ifdef CHAISCRIPT_MSVC
35 strcpy_s(d, len+1, s); // Copy the characters
36#else
37 strncpy(d,s,len); // Copy the characters
38#endif
39 d[len] = '\0';
40 return d; // Return the new string
41}
42
43char* readline(const char* p)
44{

Callers 1

readlineFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected