ReactOS 0.4.16-dev-959-g2ec3a19
strdup.cpp File Reference
#include <corecrt_internal.h>
#include <malloc.h>
#include <string.h>
Include dependency graph for strdup.cpp:

Go to the source code of this file.

Functions

char *__cdecl _strdup (char const *string)
 

Function Documentation

◆ _strdup()

char *__cdecl _strdup ( char const string)

Definition at line 35 of file strdup.cpp.

40{
41 if (string == nullptr)
42 return nullptr;
43
44 size_t const size = strlen(string) + 1;
45
46#ifdef _DEBUG
47 char* const memory = static_cast<char*>(_malloc_dbg(
48 size,
52#else
53 char* const memory = static_cast<char*>(malloc(size));
54#endif
55
56 if (memory == nullptr)
57 return nullptr;
58
59 _ERRCHECK(strcpy_s(memory, size, string));
60 return memory;
61}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define _ERRCHECK(e)
#define _malloc_dbg(s, t, f, l)
Definition: crtdbg.h:204
int const char const *const int const line_number
Definition: debug_heap.cpp:499
#define malloc
Definition: debug_ros.c:4
_Out_opt_ size_t *const Character const *const int const block_use
Definition: getenv.cpp:258
GLsizeiptr size
Definition: glext.h:5919
#define strcpy_s(d, l, s)
Definition: utility.h:200
static char memory[1024 *256]
Definition: process.c:116
static LPCWSTR file_name
Definition: protocol.c:147