include: Assorted spelling fixes.
[wine] / dlls / msvcp100 / memory.c
1 /*
2  * Copyright 2010 Piotr Caban for CodeWeavers
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18
19 #include "config.h"
20
21 #include <stdarg.h>
22 #include <limits.h>
23
24 #include "msvcp.h"
25
26 #include "windef.h"
27 #include "winbase.h"
28
29
30 /* ?deallocate@?$allocator@D@std@@QAEXPADI@Z */
31 /* ?deallocate@?$allocator@D@std@@QEAAXPEAD_K@Z */
32 void MSVCP_allocator_char_deallocate(void *this, char *ptr, MSVCP_size_t size)
33 {
34     MSVCRT_operator_delete(ptr);
35 }
36
37 /* ?allocate@?$allocator@D@std@@QAEPADI@Z */
38 /* ?allocate@?$allocator@D@std@@QEAAPEAD_K@Z */
39 char* MSVCP_allocator_char_allocate(void *this, MSVCP_size_t count)
40 {
41     return MSVCRT_operator_new(count);
42 }
43
44 /* allocator<wchar_t> */
45 /* ?deallocate@?$allocator@_W@std@@QAEXPA_WI@Z */
46 /* ?deallocate@?$allocator@_W@std@@QEAAXPEA_W_K@Z */
47 void MSVCP_allocator_wchar_deallocate(void *this,
48         wchar_t *ptr, MSVCP_size_t size)
49 {
50     MSVCRT_operator_delete(ptr);
51 }
52
53 /* ?allocate@?$allocator@_W@std@@QAEPA_WI@Z */
54 /* ?allocate@?$allocator@_W@std@@QEAAPEA_W_K@Z */
55 wchar_t* MSVCP_allocator_wchar_allocate(void *this, MSVCP_size_t count)
56 {
57     if(UINT_MAX/count < sizeof(wchar_t)) {
58         throw_exception(EXCEPTION_BAD_ALLOC, NULL);
59         return NULL;
60     }
61
62     return MSVCRT_operator_new(count * sizeof(wchar_t));
63 }