Commit c223268f authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Use TAB_APPEND instead of INSERT_ELEM where applicable

parent c1f04fba
......@@ -228,8 +228,7 @@ static int Demux( demux_t *p_demux )
psz_option = pf_dup( psz_parse );
if( psz_option )
INSERT_ELEM( ppsz_options, i_options, i_options,
psz_option );
TAB_APPEND( i_options, ppsz_options, psz_option );
}
/* Special case for jamendo which provide the albumart */
else if( !strncasecmp( psz_parse, "EXTALBUMARTURL:",
......
......@@ -294,7 +294,7 @@ static int Demux( demux_t *p_demux )
if( i_start )
{
if( asprintf( &temp, ":start-time=%d", i_start ) != -1 )
INSERT_ELEM( ppsz_options, i_options, i_options, temp );
TAB_APPEND( i_options, ppsz_options, temp );
}
}
else if( !strcmp( psz_param, "end" ) )
......@@ -304,7 +304,7 @@ static int Demux( demux_t *p_demux )
if( i_stop )
{
if( asprintf( &temp, ":stop-time=%d", i_stop ) != -1 )
INSERT_ELEM( ppsz_options, i_options, i_options, temp );
TAB_APPEND( i_options, ppsz_options, temp );
}
}
else if( !strcmp( psz_param, "title" ) )
......@@ -320,7 +320,7 @@ static int Demux( demux_t *p_demux )
}
else
{ /* TODO: insert option anyway? Currently ignores*/
/* INSERT_ELEM( ppsz_options, i_options, i_options, psz_option ); */
//TAB_APPEND( i_options, ppsz_options, psz_option );
}
}
}
......
......@@ -295,8 +295,7 @@ static void ReadDir(intf_thread_t *intf)
dir_entry->file = IsFile(sys->current_dir, entry);
dir_entry->path = xstrdup(entry);
INSERT_ELEM(sys->dir_entries, sys->n_dir_entries,
sys->n_dir_entries, dir_entry);
TAB_APPEND(sys->n_dir_entries, sys->dir_entries, dir_entry);
continue;
}
......@@ -375,8 +374,7 @@ static bool PlaylistAddChild(intf_sys_t *sys, playlist_item_t *p_child,
free(name);
p_pl_item->item = input_item_Hold(p_child->p_input);
INSERT_ELEM(sys->plist, sys->plist_entries,
sys->plist_entries, p_pl_item);
TAB_APPEND(sys->plist_entries, sys->plist, p_pl_item);
return true;
......
......@@ -432,8 +432,7 @@ void vlclua_read_options( vlc_object_t *p_this, lua_State *L,
{
char *psz_option = strdup( lua_tostring( L, -1 ) );
msg_Dbg( p_this, "Option: %s", psz_option );
INSERT_ELEM( *pppsz_options, *pi_options, *pi_options,
psz_option );
TAB_APPEND( *pi_options, *pppsz_options, psz_option );
}
else
{
......
......@@ -319,24 +319,23 @@ static void ParseUrls( services_discovery_t *p_sd, char *psz_urls )
break;
if( i == p_sys->i_urls )
{
INSERT_ELEM( ppsz_new_urls, i_new_urls, i_new_urls,
strdup( psz_urls ) );
TAB_APPEND( i_new_urls, ppsz_new_urls, strdup( psz_urls ) );
input_item_t *p_input;
p_input = input_item_New( psz_urls, psz_urls );
input_item_AddOption( p_input, "demux=podcast", VLC_INPUT_OPTION_TRUSTED );
INSERT_ELEM( pp_new_items, i_new_items, i_new_items, p_input );
TAB_APPEND( i_new_items, pp_new_items, p_input );
services_discovery_AddItem( p_sd, p_input );
INSERT_ELEM( p_sys->pp_input, p_sys->i_input, p_sys->i_input,
TAB_APPEND( p_sys->i_input, p_sys->pp_input,
input_CreateAndStart( p_sd, p_input, NULL ) );
}
else
{
INSERT_ELEM( ppsz_new_urls, i_new_urls, i_new_urls,
TAB_APPEND( i_new_urls, ppsz_new_urls,
strdup( p_sys->ppsz_urls[i]) );
INSERT_ELEM( pp_new_items, i_new_items, i_new_items, p_sys->pp_items[i] );
TAB_APPEND( i_new_items, pp_new_items, p_sys->pp_items[i] );
}
if( psz_tok )
psz_urls = psz_tok+1;
......@@ -394,18 +393,18 @@ static void ParseRequest( services_discovery_t *p_sd )
break;
if( i == p_sys->i_urls )
{
INSERT_ELEM( p_sys->ppsz_urls, p_sys->i_urls, p_sys->i_urls,
strdup( psz_request ) );
TAB_APPEND( p_sys->i_urls, p_sys->ppsz_urls,
strdup( psz_request ) );
input_item_t *p_input;
p_input = input_item_New( psz_request, psz_request );
input_item_AddOption( p_input, "demux=podcast", VLC_INPUT_OPTION_TRUSTED );
INSERT_ELEM( p_sys->pp_items, p_sys->i_items, p_sys->i_items, p_input );
TAB_APPEND( p_sys->i_items, p_sys->pp_items, p_input );
services_discovery_AddItem( p_sd, p_input );
INSERT_ELEM( p_sys->pp_input, p_sys->i_input, p_sys->i_input,
input_CreateAndStart( p_sd, p_input, NULL ) );
TAB_APPEND( p_sys->i_input, p_sys->pp_input,
input_CreateAndStart( p_sd, p_input, NULL ) );
SaveUrls( p_sd );
}
}
......
......@@ -1471,8 +1471,7 @@ static int InitSocket( services_discovery_t *p_sd, const char *psz_address,
return VLC_EGENERIC;
shutdown( i_fd, SHUT_WR );
INSERT_ELEM (p_sd->p_sys->pi_fd, p_sd->p_sys->i_fd,
p_sd->p_sys->i_fd, i_fd);
TAB_APPEND(p_sd->p_sys->i_fd, p_sd->p_sys->pi_fd, i_fd);
return VLC_SUCCESS;
}
......
......@@ -1511,7 +1511,7 @@ int rtp_add_sink( sout_stream_id_sys_t *id, int fd, bool rtcp_mux, uint16_t *seq
msg_Err( id->p_stream, "RTCP failed!" );
vlc_mutex_lock( &id->lock_sink );
INSERT_ELEM( id->sinkv, id->sinkc, id->sinkc, sink );
TAB_APPEND(id->sinkc, id->sinkv, sink);
if( seq != NULL )
*seq = id->i_seq_sent_next;
vlc_mutex_unlock( &id->lock_sink );
......
......@@ -463,7 +463,7 @@ int RtspTrackAttach( rtsp_stream_t *rtsp, const char *name,
vlc_rand_bytes (&track.seq_init, sizeof (track.seq_init));
vlc_rand_bytes (&track.ssrc, sizeof (track.ssrc));
INSERT_ELEM(session->trackv, session->trackc, session->trackc, track);
TAB_APPEND(session->trackc, session->trackv, track);
tr = session->trackv + session->trackc - 1;
}
......@@ -879,8 +879,7 @@ static int RtspHandler( rtsp_stream_t *rtsp, rtsp_stream_id_t *id,
else
ssrc = id->ssrc;
INSERT_ELEM( ses->trackv, ses->trackc, ses->trackc,
track );
TAB_APPEND(ses->trackc, ses->trackv, track);
}
else if (tr->setup_fd == -1)
{
......
......@@ -687,8 +687,7 @@ int access_fsdir_additem(struct access_fsdir *p_fsdir,
return VLC_ENOMEM;
}
INSERT_ELEM(p_fsdir->pp_slaves, p_fsdir->i_slaves,
p_fsdir->i_slaves, p_fsdir_slave);
TAB_APPEND(p_fsdir->i_slaves, p_fsdir->pp_slaves, p_fsdir_slave);
}
if (fsdir_is_ignored(p_fsdir, psz_filename))
......
......@@ -77,9 +77,8 @@ static inline void info_category_ReplaceInfo(info_category_t *cat,
if (old) {
info_Delete(cat->pp_infos[index]);
cat->pp_infos[index] = info;
} else {
INSERT_ELEM(cat->pp_infos, cat->i_infos, cat->i_infos, info);
}
} else
TAB_APPEND(cat->i_infos, cat->pp_infos, info);
}
static inline info_t *info_category_VaAddInfo(info_category_t *cat,
......@@ -91,7 +90,7 @@ static inline info_t *info_category_VaAddInfo(info_category_t *cat,
info = info_New(name, NULL);
if (!info)
return NULL;
INSERT_ELEM(cat->pp_infos, cat->i_infos, cat->i_infos, info);
TAB_APPEND(cat->i_infos, cat->pp_infos, info);
} else
free(info->psz_value);
if (vasprintf(&info->psz_value, format, args) == -1)
......
......@@ -1032,7 +1032,7 @@ static void GetVarSlaves( input_thread_t *p_input,
if( unlikely( p_slave == NULL ) )
break;
INSERT_ELEM( pp_slaves, i_slaves, i_slaves, p_slave );
TAB_APPEND(i_slaves, pp_slaves, p_slave);
}
free( psz_org );
......@@ -1063,7 +1063,7 @@ static void LoadSlaves( input_thread_t *p_input )
free( psz_uri );
if( p_slave )
{
INSERT_ELEM( pp_slaves, i_slaves, i_slaves, p_slave );
TAB_APPEND(i_slaves, pp_slaves, p_slave);
psz_subtitle = p_slave->psz_uri;
}
}
......@@ -1105,7 +1105,7 @@ static void LoadSlaves( input_thread_t *p_input )
{
input_item_slave_t *p_slave = p_item->pp_slaves[i];
if( !SlaveExists( pp_slaves, i_slaves, p_slave->psz_uri ) )
INSERT_ELEM( pp_slaves, i_slaves, i_slaves, p_slave );
TAB_APPEND(i_slaves, pp_slaves, p_slave);
else
input_item_slave_Delete( p_slave );
}
......@@ -1238,7 +1238,7 @@ static void InitPrograms( input_thread_t * p_input )
prgm = strtok_r( NULL, ",", &buf ) )
{
vlc_value_t val = { .i_int = atoi( prgm ) };
INSERT_ELEM( list.p_values, list.i_count, list.i_count, val );
TAB_APPEND(list.i_count, list.p_values, val);
}
if( list.i_count > 0 )
......
......@@ -569,8 +569,7 @@ int input_item_AddOption( input_item_t *p_input, const char *psz_option,
goto out;
}
INSERT_ELEM( p_input->ppsz_options, p_input->i_options,
p_input->i_options, psz_option_dup );
TAB_APPEND(p_input->i_options, p_input->ppsz_options, psz_option_dup);
flagv[p_input->optflagc++] = flags;
......@@ -685,7 +684,7 @@ int input_item_AddSlave(input_item_t *p_item, input_item_slave_t *p_slave)
vlc_mutex_lock( &p_item->lock );
INSERT_ELEM( p_item->pp_slaves, p_item->i_slaves, p_item->i_slaves, p_slave );
TAB_APPEND(p_item->i_slaves, p_item->pp_slaves, p_slave);
vlc_mutex_unlock( &p_item->lock );
return VLC_SUCCESS;
......@@ -753,8 +752,7 @@ static int InputItemVaAddInfo( input_item_t *p_i,
p_cat = info_category_New( psz_cat );
if( !p_cat )
return VLC_ENOMEM;
INSERT_ELEM( p_i->pp_categories, p_i->i_categories, p_i->i_categories,
p_cat );
TAB_APPEND(p_i->i_categories, p_i->pp_categories, p_cat);
}
info_t *p_info = info_category_VaAddInfo( p_cat, psz_name, psz_format, args );
if( !p_info || !p_info->psz_value )
......@@ -832,10 +830,7 @@ void input_item_ReplaceInfos( input_item_t *p_item, info_category_t *p_cat )
p_item->pp_categories[i_cat] = p_cat;
}
else
{
INSERT_ELEM( p_item->pp_categories, p_item->i_categories, p_item->i_categories,
p_cat );
}
TAB_APPEND(p_item->i_categories, p_item->pp_categories, p_cat);
vlc_mutex_unlock( &p_item->lock );
vlc_event_send( &p_item->event_manager,
......@@ -854,10 +849,7 @@ void input_item_MergeInfos( input_item_t *p_item, info_category_t *p_cat )
info_category_Delete( p_cat );
}
else
{
INSERT_ELEM( p_item->pp_categories, p_item->i_categories, p_item->i_categories,
p_cat );
}
TAB_APPEND(p_item->i_categories, p_item->pp_categories, p_cat);
vlc_mutex_unlock( &p_item->lock );
vlc_event_send( &p_item->event_manager,
......@@ -1304,10 +1296,7 @@ input_item_node_t *input_item_node_AppendItem( input_item_node_t *p_node, input_
void input_item_node_AppendNode( input_item_node_t *p_parent, input_item_node_t *p_child )
{
assert( p_parent && p_child && p_child->p_parent == NULL );
INSERT_ELEM( p_parent->pp_children,
p_parent->i_children,
p_parent->i_children,
p_child );
TAB_APPEND(p_parent->i_children, p_parent->pp_children, p_child);
p_child->p_parent = p_parent;
}
......
......@@ -202,8 +202,7 @@ void stats_Update( counter_t *p_counter, uint64_t val, uint64_t *new_val )
p_new->value = 0;
INSERT_ELEM( p_counter->pp_samples, p_counter->i_samples,
p_counter->i_samples, p_new );
TAB_APPEND(p_counter->i_samples, p_counter->pp_samples, p_new);
}
if( p_counter->i_samples == 1 )
{
......
......@@ -352,7 +352,7 @@ int subtitles_Detect( input_thread_t *p_this, char *psz_path, const char *psz_na
if( p_sub )
{
p_sub->b_forced = true;
INSERT_ELEM( pp_slaves, i_slaves, i_slaves, p_sub );
TAB_APPEND(i_slaves, pp_slaves, p_sub);
}
free( psz_uri );
}
......
......@@ -503,10 +503,11 @@ int var_Change( vlc_object_t *p_this, const char *psz_name,
{
int i = p_var->choices.i_count;
INSERT_ELEM( p_var->choices.p_values, p_var->choices.i_count,
i, *p_val );
INSERT_ELEM( p_var->choices_text.p_values,
p_var->choices_text.i_count, i, *p_val );
TAB_APPEND(p_var->choices.i_count,
p_var->choices.p_values, *p_val);
assert(i == p_var->choices_text.i_count);
TAB_APPEND(p_var->choices_text.i_count,
p_var->choices_text.p_values, *p_val);
p_var->ops->pf_dup( &p_var->choices.p_values[i] );
p_var->choices_text.p_values[i].psz_string =
( p_val2 && p_val2->psz_string ) ?
......@@ -850,10 +851,7 @@ static void AddCallback( vlc_object_t *p_this, const char *psz_name,
p_table = &p_var->value_callbacks;
else
p_table = &p_var->list_callbacks;
INSERT_ELEM( p_table->p_entries,
p_table->i_entries,
p_table->i_entries,
entry);
TAB_APPEND(p_table->i_entries, p_table->p_entries, entry);
vlc_mutex_unlock( &p_priv->var_lock );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment