ReactOS 0.4.16-dev-300-g2aadf2e
mbsdup.c
Go to the documentation of this file.
1/*
2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS system libraries
4 * FILE: lib/sdk/crt/mbstring/mbsdup.c
5 * PURPOSE: Duplicates a multi byte string
6 * PROGRAMER: Ariadne
7 * UPDATE HISTORY:
8 Modified from DJGPP strdup
9 * 12/04/99: Created
10 */
11
12#include <precomp.h>
13#include <mbstring.h>
14#include <stdlib.h>
15
16/*
17 * @implemented
18 */
19unsigned char * _mbsdup(const unsigned char *_s)
20{
21 unsigned char *rv;
22 if (_s == 0)
23 return 0;
24 rv = (unsigned char *)malloc(_mbslen(_s) + 1);
25 if (rv == 0)
26 return 0;
27 _mbscpy(rv, _s);
28 return rv;
29}
#define malloc
Definition: debug_ros.c:4
_CRTIMP unsigned char *__cdecl _mbscpy(_Out_writes_z_(_String_length_(_Source)+1) unsigned char *_Dest, _In_z_ const unsigned char *_Source)
_Check_return_ _CRTIMP size_t __cdecl _mbslen(_In_z_ const unsigned char *_Str)
unsigned char * _mbsdup(const unsigned char *_s)
Definition: mbsdup.c:19