Skip to content

Commit d6c4649

Browse files
committed
Remove unneeded priv_index_header_from_block
1 parent 0665fd3 commit d6c4649

File tree

3 files changed

+18
-35
lines changed

3 files changed

+18
-35
lines changed

include/boost/interprocess/detail/segment_manager_helper.hpp

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -129,21 +129,11 @@ struct block_header
129129
unsigned short name_length() const
130130
{ return m_num_char; }
131131

132-
size_type name_offset() const
133-
{
134-
return this->value_offset() + get_rounded_size(size_type(m_value_bytes), size_type(sizeof_char()));
135-
}
136-
137132
void *value() const
138133
{
139134
return const_cast<char*>((reinterpret_cast<const char*>(this) + this->value_offset()));
140135
}
141136

142-
size_type value_offset() const
143-
{
144-
return get_rounded_size(size_type(sizeof(block_header)), size_type(m_value_alignment));
145-
}
146-
147137
template<class T>
148138
static block_header *block_header_from_value(T *value)
149139
{
@@ -185,6 +175,17 @@ struct block_header
185175
//Some sanity checks
186176
return hdr;
187177
}
178+
179+
private:
180+
size_type value_offset() const
181+
{
182+
return get_rounded_size(size_type(sizeof(block_header)), size_type(m_value_alignment));
183+
}
184+
185+
size_type name_offset() const
186+
{
187+
return this->value_offset() + get_rounded_size(size_type(m_value_bytes), size_type(sizeof_char()));
188+
}
188189
};
189190

190191
template<class CharT>
@@ -247,15 +248,6 @@ struct intrusive_value_type_impl
247248

248249
intrusive_value_type_impl(){}
249250

250-
block_header_t *get_block_header()
251-
{ return block_header_t::from_first_header(this); }
252-
253-
const block_header_t *get_block_header() const
254-
{ return block_header_t::from_first_header(this); }
255-
256-
static intrusive_value_type_impl *get_intrusive_value_type(block_header_t *hdr)
257-
{ return block_header_t::template to_first_header<intrusive_value_type_impl>(hdr); }
258-
259251
CharType *name() const
260252
{ return get_block_header()->template name<CharType>(); }
261253

@@ -264,6 +256,10 @@ struct intrusive_value_type_impl
264256

265257
void *value() const
266258
{ return get_block_header()->value(); }
259+
260+
private:
261+
const block_header_t *get_block_header() const
262+
{ return block_header_t::from_first_header(this); }
267263
};
268264

269265
template<class CharType>

include/boost/interprocess/indexes/iunordered_set_index.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ struct iunordered_set_index_aux
113113
std::size_t operator()(const compare_key_type&i) const
114114
{
115115
const char_type *beg = i.mp_str,
116-
*end = beg + i.m_len;
116+
*end = beg + i.m_len;
117117
return hash_char_range(beg, end);
118118
}
119119
};

include/boost/interprocess/segment_manager.hpp

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,7 @@ class segment_manager
868868
typedef IndexType<ipcdetail::index_config<CharT, MemoryAlgorithm> > index_t;
869869
typedef typename index_t::index_data_t index_data_t;
870870

871-
index_data_t *si = priv_index_header_from_block<index_t>(block_header, is_intrusive_t());
871+
index_data_t* si = block_header_t::template to_first_header<index_data_t>(block_header);
872872
return this->priv_generic_named_destroy_impl<T, CharT>(*si, index);
873873
}
874874

@@ -927,7 +927,7 @@ class segment_manager
927927

928928
void *memory;
929929
BOOST_IF_CONSTEXPR(is_node_index_t::value || is_intrusive_t::value){
930-
index_data_t*ihdr = priv_index_header_from_block<index_t>(ctrl_data, is_intrusive_t());
930+
index_data_t*ihdr = block_header_t::template to_first_header<index_data_t>(ctrl_data);
931931
ihdr->~index_data_t();
932932
memory = ihdr;
933933
}
@@ -957,19 +957,6 @@ class segment_manager
957957
return static_cast<block_header_t*>(ipcdetail::to_raw_pointer(it->second.m_ptr));
958958
}
959959

960-
template<class IndexT>
961-
static typename IndexT::index_data_t * priv_index_header_from_block(block_header_t *bh, ipcdetail::true_) //is_intrusive
962-
{
963-
return IndexT::index_data_t::get_intrusive_value_type(bh);
964-
}
965-
966-
template<class IndexT>
967-
static typename IndexT::index_data_t * priv_index_header_from_block(block_header_t* bh, ipcdetail::false_) //!is_intrusive
968-
{
969-
return block_header_t::template to_first_header
970-
<typename IndexT::index_data_t>(bh);
971-
}
972-
973960
//!Generic named new function for
974961
//!named functions
975962
template<class Proxy, class CharT>

0 commit comments

Comments
 (0)