]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/regex/src/regex_raw_buffer.cpp
6 * Use, modification and distribution are subject to the
7 * Boost Software License, Version 1.0. (See accompanying file
8 * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
13 * LOCATION: see http://www.boost.org for most recent version.
14 * FILE regex_raw_buffer.cpp
15 * VERSION see <boost/version.hpp>
16 * DESCRIPTION: Member functions for class raw_storage.
20 #define BOOST_REGEX_SOURCE
21 #include <boost/config.hpp>
24 #include <boost/assert.hpp>
25 #include <boost/regex/v4/regex_raw_buffer.hpp>
27 #if defined(BOOST_NO_STDC_NAMESPACE)
35 namespace boost
{ namespace BOOST_REGEX_DETAIL_NS
{
37 void BOOST_REGEX_CALL
raw_storage::resize(size_type n
)
39 size_type newsize
= start
? last
- start
: 1024;
42 size_type datasize
= end
- start
;
43 // extend newsize to WORD/DWORD boundary:
44 newsize
= (newsize
+ padding_mask
) & ~(padding_mask
);
46 // allocate and copy data:
47 pointer ptr
= static_cast<pointer
>(::operator new(newsize
));
48 BOOST_REGEX_NOEH_ASSERT(ptr
)
50 std::memcpy(ptr
, start
, datasize
);
52 // get rid of old buffer:
53 ::operator delete(start
);
55 // and set up pointers:
61 void* BOOST_REGEX_CALL
raw_storage::insert(size_type pos
, size_type n
)
63 BOOST_ASSERT(pos
<= size_type(end
- start
));
64 if(size_type(last
- end
) < n
)
65 resize(n
+ (end
- start
));
66 void* result
= start
+ pos
;
67 std::memmove(start
+ pos
+ n
, start
+ pos
, (end
- start
) - pos
);