MCPcopy Create free account
hub / github.com/boostorg/build / list_pop_front

Function list_pop_front

v2/engine/lists.c:237–263  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

235 */
236
237LIST * list_pop_front( LIST * l )
238{
239 unsigned size = list_length( l );
240 assert( size );
241 --size;
242 object_free( list_front( l ) );
243
244 if ( size == 0 )
245 {
246 list_dealloc( l );
247 return L0;
248 }
249
250 if ( ( ( size - 1 ) & size ) == 0 )
251 {
252 LIST * const nl = list_alloc( size );
253 nl->impl.size = size;
254 memcpy( list_begin( nl ), list_begin( l ) + 1, size * sizeof( OBJECT * )
255 );
256 list_dealloc( l );
257 return nl;
258 }
259
260 l->impl.size = size;
261 memmove( list_begin( l ), list_begin( l ) + 1, size * sizeof( OBJECT * ) );
262 return l;
263}
264
265LIST * list_reverse( LIST * l )
266{

Callers 1

function_call_ruleFunction · 0.85

Calls 5

list_lengthFunction · 0.85
object_freeFunction · 0.85
list_deallocFunction · 0.85
list_allocFunction · 0.85
list_beginFunction · 0.85

Tested by

no test coverage detected