/usr/include/boost/regex/v4
NameSizeModeActions
basic_regex.hpp240890644editdlrm
basic_regex_creator.hpp542060644editdlrm
basic_regex_parser.hpp1128510644editdlrm
char_regex_traits.hpp17260644editdlrm
cpp_regex_traits.hpp394250644editdlrm
cregex.hpp109870644editdlrm
c_regex_traits.hpp54970644editdlrm
error_type.hpp12580644editdlrm
fileiter.hpp143770644editdlrm
indexed_bit_flag.hpp13160644editdlrm
instances.hpp90800644editdlrm
iterator_category.hpp19600644editdlrm
iterator_traits.hpp38020644editdlrm
match_flags.hpp69340644editdlrm
match_results.hpp227730644editdlrm
mem_block_cache.hpp31320644editdlrm
perl_matcher.hpp188470644editdlrm
perl_matcher_common.hpp304760644editdlrm
perl_matcher_non_recursive.hpp632380644editdlrm
perl_matcher_recursive.hpp345400644editdlrm
primary_transform.hpp33470644editdlrm
protected_call.hpp16880644editdlrm
regbase.hpp59720644editdlrm
regex.hpp45900644editdlrm
regex_format.hpp342310644editdlrm
regex_fwd.hpp16460644editdlrm
regex_grep.hpp48790644editdlrm
regex_iterator.hpp64740644editdlrm
regex_match.hpp144750644editdlrm
regex_merge.hpp27650644editdlrm
regex_raw_buffer.hpp36860644editdlrm
regex_replace.hpp29250644editdlrm
regex_search.hpp70970644editdlrm
regex_split.hpp49560644editdlrm
regex_token_iterator.hpp126130644editdlrm
regex_traits.hpp49650644editdlrm
regex_traits_defaults.hpp115550644editdlrm
regex_workaround.hpp61710644editdlrm
states.hpp119150644editdlrm
sub_match.hpp231550644editdlrm
syntax_type.hpp43740644editdlrm
u32regex_iterator.hpp64750644editdlrm
u32regex_token_iterator.hpp150680644editdlrm
w32_regex_traits.hpp244550644editdlrm
Edit: /usr/include/boost/regex/v4/mem_block_cache.hpp (3132B)
/* * Copyright (c) 2002 * 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 mem_block_cache.hpp * VERSION see * DESCRIPTION: memory block cache used by the non-recursive matcher. */ #ifndef BOOST_REGEX_V4_MEM_BLOCK_CACHE_HPP #define BOOST_REGEX_V4_MEM_BLOCK_CACHE_HPP #include #ifdef BOOST_HAS_THREADS #include #endif #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_PREFIX #endif #ifndef BOOST_NO_CXX11_HDR_ATOMIC #include #if ATOMIC_POINTER_LOCK_FREE == 2 #define BOOST_REGEX_MEM_BLOCK_CACHE_LOCK_FREE #define BOOST_REGEX_ATOMIC_POINTER std::atomic #endif #endif namespace boost{ namespace BOOST_REGEX_DETAIL_NS{ #ifdef BOOST_REGEX_MEM_BLOCK_CACHE_LOCK_FREE /* lock free implementation */ struct mem_block_cache { std::atomic cache[BOOST_REGEX_MAX_CACHE_BLOCKS]; ~mem_block_cache() { for (size_t i = 0;i < BOOST_REGEX_MAX_CACHE_BLOCKS; ++i) { if (cache[i].load()) ::operator delete(cache[i].load()); } } void* get() { for (size_t i = 0;i < BOOST_REGEX_MAX_CACHE_BLOCKS; ++i) { void* p = cache[i].load(); if (p != NULL) { if (cache[i].compare_exchange_strong(p, NULL)) return p; } } return ::operator new(BOOST_REGEX_BLOCKSIZE); } void put(void* ptr) { for (size_t i = 0;i < BOOST_REGEX_MAX_CACHE_BLOCKS; ++i) { void* p = cache[i].load(); if (p == NULL) { if (cache[i].compare_exchange_strong(p, ptr)) return; } } ::operator delete(ptr); } }; #else /* lock-based implementation */ struct mem_block_node { mem_block_node* next; }; struct mem_block_cache { // this member has to be statically initialsed: mem_block_node* next; unsigned cached_blocks; #ifdef BOOST_HAS_THREADS boost::static_mutex mut; #endif ~mem_block_cache() { while(next) { mem_block_node* old = next; next = next->next; ::operator delete(old); } } void* get() { #ifdef BOOST_HAS_THREADS boost::static_mutex::scoped_lock g(mut); #endif if(next) { mem_block_node* result = next; next = next->next; --cached_blocks; return result; } return ::operator new(BOOST_REGEX_BLOCKSIZE); } void put(void* p) { #ifdef BOOST_HAS_THREADS boost::static_mutex::scoped_lock g(mut); #endif if(cached_blocks >= BOOST_REGEX_MAX_CACHE_BLOCKS) { ::operator delete(p); } else { mem_block_node* old = static_cast(p); old->next = next; next = old; ++cached_blocks; } } }; #endif extern mem_block_cache block_cache; } } // namespace boost #ifdef BOOST_HAS_ABI_HEADERS # include BOOST_ABI_SUFFIX #endif #endif