ReactOS  0.4.14-dev-49-gfb4591c
_tempbuf.c File Reference
#include <stl/_tempbuf.h>
Include dependency graph for _tempbuf.c:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define _STLP_TEMPBUF_C
 

Functions

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

Macro Definition Documentation

◆ _STLP_TEMPBUF_C

#define _STLP_TEMPBUF_C

Definition at line 27 of file _tempbuf.c.

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 INT_MAX
Definition: limits.h:40
Definition: _pair.h:47
__kernel_ptrdiff_t ptrdiff_t
Definition: linux.h:247
#define malloc
Definition: debug_ros.c:4

Referenced by get_temporary_buffer().