Sha256: 0829da9bfd9a29b55778db324073baee5d332f3355c9946773d86b1997c0c09a

Contents?: true

Size: 1.73 KB

Versions: 56

Compression:

Stored size: 1.73 KB

Contents

/*
 *
 * Copyright (c) 2004
 * John Maddock
 *
 * Use, modification and distribution are subject to the 
 * Boost Software License, Version 1.0. (See accompanying file 
 * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
 *
 */

 /*
  *   LOCATION:    see http://www.boost.org for most recent version.
  *   FILE         regex_raw_buffer.cpp
  *   VERSION      see <boost/version.hpp>
  *   DESCRIPTION: Member functions for class raw_storage.
  */


#define BOOST_REGEX_SOURCE
#include <boost/config.hpp>
#include <memory>
#include <cstring>
#include <boost/assert.hpp>
#include <boost/regex/v4/regex_raw_buffer.hpp>

#if defined(BOOST_NO_STDC_NAMESPACE)
namespace std{
   using ::memcpy;
   using ::memmove;
}
#endif


namespace boost{ namespace re_detail{

void BOOST_REGEX_CALL raw_storage::resize(size_type n)
{
   register size_type newsize = start ? last - start : 1024;
   while(newsize < n)
      newsize *= 2;
   register size_type datasize = end - start;
   // extend newsize to WORD/DWORD boundary:
   newsize = (newsize + padding_mask) & ~(padding_mask);

   // allocate and copy data:
   register pointer ptr = static_cast<pointer>(::operator new(newsize));
   BOOST_REGEX_NOEH_ASSERT(ptr)
   if(start)
      std::memcpy(ptr, start, datasize);

   // get rid of old buffer:
   ::operator delete(start);

   // and set up pointers:
   start = ptr;
   end = ptr + datasize;
   last = ptr + newsize;
}

void* BOOST_REGEX_CALL raw_storage::insert(size_type pos, size_type n)
{
   BOOST_ASSERT(pos <= size_type(end - start));
   if(size_type(last - end) < n)
      resize(n + (end - start));
   register void* result = start + pos;
   std::memmove(start + pos + n, start + pos, (end - start) - pos);
   end += n;
   return result;
}

}} // namespaces

Version data entries

56 entries across 56 versions & 1 rubygems

Version Path
passenger-4.0.60 ext/boost/libs/regex/src/regex_raw_buffer.cpp
passenger-5.0.21 src/cxx_supportlib/vendor-modified/boost/libs/regex/src/regex_raw_buffer.cpp
passenger-5.0.20 src/cxx_supportlib/vendor-modified/boost/libs/regex/src/regex_raw_buffer.cpp
passenger-5.0.19 src/cxx_supportlib/vendor-modified/boost/libs/regex/src/regex_raw_buffer.cpp
passenger-5.0.18 ext/boost/libs/regex/src/regex_raw_buffer.cpp
passenger-5.0.17 ext/boost/libs/regex/src/regex_raw_buffer.cpp
passenger-5.0.16 ext/boost/libs/regex/src/regex_raw_buffer.cpp
passenger-5.0.15 ext/boost/libs/regex/src/regex_raw_buffer.cpp
passenger-5.0.14 ext/boost/libs/regex/src/regex_raw_buffer.cpp
passenger-5.0.13 ext/boost/libs/regex/src/regex_raw_buffer.cpp
passenger-5.0.11 ext/boost/libs/regex/src/regex_raw_buffer.cpp
passenger-5.0.10 ext/boost/libs/regex/src/regex_raw_buffer.cpp
passenger-5.0.9 ext/boost/libs/regex/src/regex_raw_buffer.cpp
passenger-5.0.8 ext/boost/libs/regex/src/regex_raw_buffer.cpp
passenger-5.0.7 ext/boost/libs/regex/src/regex_raw_buffer.cpp
passenger-5.0.6 ext/boost/libs/regex/src/regex_raw_buffer.cpp
passenger-5.0.5 ext/boost/libs/regex/src/regex_raw_buffer.cpp
passenger-5.0.4 ext/boost/libs/regex/src/regex_raw_buffer.cpp
passenger-5.0.3 ext/boost/libs/regex/src/regex_raw_buffer.cpp
passenger-5.0.2 ext/boost/libs/regex/src/regex_raw_buffer.cpp