ReactOS 0.4.16-dev-122-g325d74c
_tempbuf.h File Reference
#include <climits>
#include <stl/_cstdlib.h>
#include <stl/_uninitialized.h>
#include <stl/_tempbuf.c>
Include dependency graph for _tempbuf.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  _Temporary_buffer< _ForwardIterator, _Tp >
 
struct  temporary_buffer< _ForwardIterator, _Tp >
 

Functions

template<class _Tp >
_STLP_BEGIN_NAMESPACE pair< _Tp *, ptrdiff_t > _STLP_CALL __get_temporary_buffer (ptrdiff_t __len, _Tp *)
 
template<class _Tp >
pair< _Tp *, ptrdiff_t > _STLP_CALL get_temporary_buffer (ptrdiff_t __len)
 
template<class _Tp >
pair< _Tp *, ptrdiff_t > _STLP_CALL get_temporary_buffer (ptrdiff_t __len, _Tp *)
 
template<class _Tp >
void _STLP_CALL return_temporary_buffer (_Tp *__p)
 

Function Documentation

◆ __get_temporary_buffer()

template<class _Tp >
_STLP_BEGIN_NAMESPACE pair< _Tp *, ptrdiff_t > _STLP_CALL __get_temporary_buffer ( ptrdiff_t  __len,
_Tp *   
)

Definition at line 37 of file _tempbuf.c.

38{
39 if (__len > ptrdiff_t(INT_MAX / sizeof(_Tp)))
40 __len = INT_MAX / sizeof(_Tp);
41
42 while (__len > 0) {
43 _Tp* __tmp = (_Tp*) malloc((size_t)__len * sizeof(_Tp));
44 if (__tmp != 0)
45 return pair<_Tp*, ptrdiff_t>(__tmp, __len);
46 __len /= 2;
47 }
48
49 return pair<_Tp*, ptrdiff_t>((_Tp*)0, 0);
50}
#define malloc
Definition: debug_ros.c:4
__kernel_ptrdiff_t ptrdiff_t
Definition: linux.h:247
#define INT_MAX
Definition: limits.h:40
Definition: _pair.h:47

Referenced by get_temporary_buffer().

◆ get_temporary_buffer() [1/2]

template<class _Tp >
pair< _Tp *, ptrdiff_t > _STLP_CALL get_temporary_buffer ( ptrdiff_t  __len)
inline

Definition at line 54 of file _tempbuf.h.

54 {
55 return __get_temporary_buffer(__len, (_Tp*) 0);
56}
_STLP_BEGIN_NAMESPACE pair< _Tp *, ptrdiff_t > _STLP_CALL __get_temporary_buffer(ptrdiff_t __len, _Tp *)
Definition: _tempbuf.c:37

◆ get_temporary_buffer() [2/2]

template<class _Tp >
pair< _Tp *, ptrdiff_t > _STLP_CALL get_temporary_buffer ( ptrdiff_t  __len,
_Tp *   
)
inline

Definition at line 66 of file _tempbuf.h.

66 {
67 return __get_temporary_buffer(__len, (_Tp*) 0);
68}

◆ return_temporary_buffer()

template<class _Tp >
void _STLP_CALL return_temporary_buffer ( _Tp *  __p)
inline

Definition at line 73 of file _tempbuf.h.

73 {
74// SunPro brain damage
75 free((char*)__p);
76}
#define free
Definition: debug_ros.c:5