ReactOS 0.4.15-dev-7846-g8ba6c66
ehvec.cpp
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS c++ runtime library
3 * LICENSE: GPLv2+ - See COPYING in the top level directory
4 * PURPOSE: Exception-handling vector ctor/dtor iterator implementation
5 * PROGRAMMER: Thomas Faber (thomas.faber@reactos.org)
6 */
7
8#include <stddef.h>
9
10void __stdcall MSVCRTEX_eh_vector_constructor_iterator(void *pMem, size_t sizeOfItem, int nItems, void (__thiscall *ctor)(void *), void (__thiscall *dtor)(void *))
11{
12 char *pEnd = static_cast<char *>(pMem) + nItems * sizeOfItem;
13 for (char *pItem = static_cast<char *>(pMem);
14 pItem < pEnd;
15 pItem += sizeOfItem)
16 {
17 try
18 {
19 ctor(pItem);
20 }
21 catch (...)
22 {
23 for (pItem -= sizeOfItem; pItem >= pMem; pItem -= sizeOfItem)
24 dtor(pItem);
25 throw;
26 }
27 }
28}
29
30void __stdcall MSVCRTEX_eh_vector_destructor_iterator(void *pMem, size_t sizeOfItem, int nItems, void (__thiscall *dtor)(void *))
31{
32 char *pEnd = static_cast<char *>(pMem) + nItems * sizeOfItem;
33 for (char *pItem = pEnd - sizeOfItem;
34 pItem >= pMem;
35 pItem -= sizeOfItem)
36 {
37 try
38 {
39 dtor(pItem);
40 }
41 catch (...)
42 {
43 for (pItem -= sizeOfItem; pItem >= pMem; pItem -= sizeOfItem)
44 dtor(pItem);
45 throw;
46 }
47 }
48}
int nItems
Definition: appswitch.c:56
void __stdcall MSVCRTEX_eh_vector_constructor_iterator(void *pMem, size_t sizeOfItem, int nItems, void(__thiscall *ctor)(void *), void(__thiscall *dtor)(void *))
Definition: ehvec.cpp:10
void __stdcall MSVCRTEX_eh_vector_destructor_iterator(void *pMem, size_t sizeOfItem, int nItems, void(__thiscall *dtor)(void *))
Definition: ehvec.cpp:30
#define __thiscall
Definition: cpp.c:43
LPFNCONSTRUCTOR ctor
Definition: msctf.c:83
#define __stdcall
Definition: typedefs.h:25