MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / hb_list_insert

Function hb_list_insert

libhb/common.c:4164–4189  ·  view source on GitHub ↗

* hb_list_insert ********************************************************************** * Adds an item at the specified position in the list, making it bigger * if necessary. * Can safely be called with a NULL pointer to add, it will be ignored. *********************************************************************/

Source from the content-addressed store, hash-verified

4162 * Can safely be called with a NULL pointer to add, it will be ignored.
4163 *********************************************************************/
4164void hb_list_insert( hb_list_t * l, int pos, void * p )
4165{
4166 if( !p )
4167 {
4168 return;
4169 }
4170
4171 if( l->items_count == l->items_alloc )
4172 {
4173 /* We need a bigger boat */
4174 l->items_alloc += HB_LIST_DEFAULT_SIZE;
4175 l->items = realloc( l->items,
4176 l->items_alloc * sizeof( void * ) );
4177 }
4178
4179 if ( l->items_count != pos )
4180 {
4181 /* Shift all items after it sizeof( void * ) bytes earlier */
4182 memmove( &l->items[pos+1], &l->items[pos],
4183 ( l->items_count - pos ) * sizeof( void * ) );
4184 }
4185
4186
4187 l->items[pos] = p;
4188 (l->items_count)++;
4189}
4190
4191/**********************************************************************
4192 * hb_list_rem

Callers 7

hb_add_filter_dictFunction · 0.85
alignStreamFunction · 0.85
fixAudioGapFunction · 0.85
sanitize_subtitlesFunction · 0.85
hb_avfilter_combineFunction · 0.85
pes_add_audio_to_titleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected