#define __STDC_FORMAT_MACROS 1
#include <inttypes.h>
-#include <assert.h>
-
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_input.h>
#include <vlc_demux.h>
#include <vlc_dialog.h>
#include <vlc_charset.h>
-#include <vlc_memory.h>
#include "common.h"
#include "filter.h"
dshow_stream.p_device_filter = p_device_filter;
dshow_stream.p_capture_filter = p_capture_filter;
- p_sys->pp_streams = (dshow_stream_t **)realloc_or_free(
- p_sys->pp_streams,
+ p_sys->pp_streams = (dshow_stream_t **)xrealloc( p_sys->pp_streams,
sizeof(dshow_stream_t *) * (p_sys->i_streams + 1) );
- assert( p_sys->pp_streams );
p_sys->pp_streams[p_sys->i_streams] = new dshow_stream_t;
*p_sys->pp_streams[p_sys->i_streams++] = dshow_stream;
if( !list_devices.size() ) return VLC_SUCCESS;
- p_item->ppsz_list = (char**)realloc_or_free( p_item->ppsz_list,
+ p_item->ppsz_list = (char**)xrealloc( p_item->ppsz_list,
(list_devices.size()+3) * sizeof(char *) );
- assert( p_item->ppsz_list );
- p_item->ppsz_list_text = (char**)realloc_or_free( p_item->ppsz_list_text,
+ p_item->ppsz_list_text = (char**)xrealloc( p_item->ppsz_list_text,
(list_devices.size()+3) * sizeof(char *) );
- assert( p_item->ppsz_list_text );
list<string>::iterator iter;
for( iter = list_devices.begin(), i = 2; iter != list_devices.end();
if ( pi_size == NULL )
{
- p_data = malloc( MAX_TPDU_SIZE );
- assert( p_data );
+ p_data = xmalloc( MAX_TPDU_SIZE );
}
for ( ; ; )
uint8_t *p_data, int i_size )
{
access_sys_t *p_sys = p_access->p_sys;
- uint8_t *p_spdu = malloc( i_size + 4 );
+ uint8_t *p_spdu = xmalloc( i_size + 4 );
uint8_t *p = p_spdu;
uint8_t i_tag;
uint8_t i_slot = p_sys->p_sessions[i_session_id - 1].i_slot;
- assert( p_spdu );
-
*p++ = ST_SESSION_NUMBER;
*p++ = 0x02;
*p++ = (i_session_id >> 8);
uint8_t *p_data, int i_size )
{
access_sys_t *p_sys = p_access->p_sys;
- uint8_t *p_apdu = malloc( i_size + 12 );
+ uint8_t *p_apdu = xmalloc( i_size + 12 );
uint8_t *p = p_apdu;
ca_msg_t ca_msg;
int i_ret;
- assert( p_apdu );
-
*p++ = (i_tag >> 16);
*p++ = (i_tag >> 8) & 0xff;
*p++ = i_tag & 0xff;
uint8_t *p_data;
if ( i_size )
- p_data = malloc( 7 + i_size );
+ p_data = xmalloc( 7 + i_size );
else
- p_data = malloc( 6 );
-
- assert( p_data );
+ p_data = xmalloc( 6 );
p_data[0] = i_list_mgt;
p_data[1] = i_program_number >> 8;
int i;
if ( i_size )
- p_data = realloc( p_capmt, i_capmt_size + 6 + i_size );
+ p_data = xrealloc( p_capmt, i_capmt_size + 6 + i_size );
else
- p_data = realloc( p_capmt, i_capmt_size + 5 );
-
- assert( p_data );
+ p_data = xrealloc( p_capmt, i_capmt_size + 5 );
i = i_capmt_size;
case EN50221_MMI_ANSW:
i_tag = AOT_ANSW;
i_size = 1 + strlen( p_object->u.answ.psz_answ );
- p_data = malloc( i_size );
- assert( p_data );
+ p_data = xmalloc( i_size );
p_data[0] = (p_object->u.answ.b_ok == true) ? 0x1 : 0x0;
strncpy( (char *)&p_data[1], p_object->u.answ.psz_answ, i_size - 1 );
break;
case EN50221_MMI_MENU_ANSW:
i_tag = AOT_MENU_ANSW;
i_size = 1;
- p_data = malloc( i_size );
- assert( p_data );
+ p_data = xmalloc( i_size );
p_data[0] = p_object->u.menu_answ.i_choice;
break;
p_mmi->last_object.u.enq.b_blind = (*d & 0x1) ? true : false;
d += 2; /* skip answer_text_length because it is not mandatory */
l -= 2;
- p_mmi->last_object.u.enq.psz_text = malloc( l + 1 );
- assert( p_mmi->last_object.u.enq.psz_text );
+ p_mmi->last_object.u.enq.psz_text = xmalloc( l + 1 );
strncpy( p_mmi->last_object.u.enq.psz_text, (char *)d, l );
p_mmi->last_object.u.enq.psz_text[l] = '\0';
p_sys->p_sessions[i_session_id - 1].pf_handle = MMIHandle;
p_sys->p_sessions[i_session_id - 1].pf_close = MMIClose;
- p_sys->p_sessions[i_session_id - 1].p_sys = malloc(sizeof(mmi_t));
+ p_sys->p_sessions[i_session_id - 1].p_sys = xmalloc(sizeof(mmi_t));
p_mmi = (mmi_t *)p_sys->p_sessions[i_session_id - 1].p_sys;
- assert( p_mmi );
p_mmi->last_object.i_object_type = EN50221_MMI_NONE;
}
iconv_handle = vlc_iconv_open( "UTF-8", psz_encoding );
i_in = i_length - (psz_stringstart - psz_instring );
i_out = i_in * 6;
- psz_outstring = psz_tmp = (char*)malloc( i_out + 1 );
- assert( psz_outstring );
+ psz_outstring = psz_tmp = (char*)xmalloc( i_out + 1 );
vlc_iconv( iconv_handle, &psz_stringstart, &i_in, &psz_tmp, &i_out );
vlc_iconv_close( iconv_handle );
*psz_tmp = '\0';
i_out_ports++;
}
/* alloc an array to store all the matched ports */
- p_sys->pp_jack_port_table = realloc( p_sys->pp_jack_port_table,
+ p_sys->pp_jack_port_table = xrealloc( p_sys->pp_jack_port_table,
(i_out_ports * sizeof( char * ) + i_total_out_ports * sizeof( char * ) ) );
- assert( p_sys->pp_jack_port_table );
for(int i=0; i<i_out_ports;i++)
{
# include "config.h"
#endif
-#include <assert.h>
-
#include <vlc_common.h>
-#include <vlc_memory.h>
#include "asf.h"
#include "buffer.h"
if( p_buf->i_data >= p_buf->i_size )
{
p_buf->i_size += 1024;
- p_buf->p_data = realloc_or_free( p_buf->p_data, p_buf->i_size );
- assert( p_buf->p_data );
+ p_buf->p_data = xrealloc( p_buf->p_data, p_buf->i_size );
}
p_buf->p_data[p_buf->i_data] = i_byte&0xff;
p_buf->i_data++;
if( p_buf->i_data + i_mem >= p_buf->i_size )
{
p_buf->i_size += i_mem + 1024;
- p_buf->p_data = realloc_or_free( p_buf->p_data, p_buf->i_size );
- assert( p_buf->p_data );
+ p_buf->p_data = xrealloc( p_buf->p_data, p_buf->i_size );
}
memcpy( p_buf->p_data + p_buf->i_data, p_mem, i_mem );
size_t i_out = i_in * 4;
char *psz_out, *psz_tmp;
- psz_out = psz_tmp = malloc( i_out + 1 );
- assert( psz_out );
+ psz_out = psz_tmp = xmalloc( i_out + 1 );
iconv_handle = vlc_iconv_open( "UTF-16LE", "UTF-8" );
vlc_iconv( iconv_handle, &p_str, &i_in, &psz_tmp, &i_out );
vlc_iconv_close( iconv_handle );
# include "config.h"
#endif
-#include <assert.h>
-
#include <vlc_common.h>
#include <vlc_access.h>
#include <vlc_strings.h>
#include <vlc_input.h>
-#include <vlc_memory.h>
#include <vlc_network.h>
#include <vlc_url.h>
if( ck.i_data > 0 )
{
p_sys->i_header += ck.i_data;
- p_sys->p_header = realloc_or_free( p_sys->p_header, p_sys->i_header );
- assert( p_sys->p_header );
+ p_sys->p_header = xrealloc( p_sys->p_header, p_sys->i_header );
memcpy( &p_sys->p_header[p_sys->i_header - ck.i_data],
ck.p_data, ck.i_data );
}
#include <vlc_common.h>
#include <vlc_access.h>
-#include <vlc_memory.h>
#include <errno.h>
#include <assert.h>
#define GETUTF16( psz, size ) \
{ \
int i; \
- psz = malloc( size + 1); \
- assert( psz ); \
+ psz = xmalloc( size + 1); \
for( i = 0; i < size; i++ ) \
{ \
psz[i] = p[i]; \
free( p_sys->p_cmd );
p_sys->i_cmd = i_data;
- p_sys->p_cmd = malloc( i_data );
- assert( p_sys->p_cmd );
+ p_sys->p_cmd = xmalloc( i_data );
memcpy( p_sys->p_cmd, p_data, i_data );
*pi_used = i_data; /* by default */
{
if( p_sys->p_header )
{
- p_sys->p_header = realloc_or_free( p_sys->p_header,
+ p_sys->p_header = xrealloc( p_sys->p_header,
p_sys->i_header + i_packet_length - 8 );
- assert( p_sys->p_header );
memcpy( &p_sys->p_header[p_sys->i_header],
p_data + 8, i_packet_length - 8 );
p_sys->i_header += i_packet_length - 8;
}
else
{
- uint8_t* p_packet = malloc( i_packet_length - 8 ); // don't bother with preheader
- assert( p_packet );
+ uint8_t* p_packet = xmalloc( i_packet_length - 8 ); // don't bother with preheader
memcpy( p_packet, p_data + 8, i_packet_length - 8 );
p_sys->p_header = p_packet;
p_sys->i_header = i_packet_length - 8;
}
else
{
- uint8_t* p_packet = malloc( i_packet_length - 8 ); // don't bother with preheader
- assert( p_packet );
+ uint8_t* p_packet = xmalloc( i_packet_length - 8 ); // don't bother with preheader
memcpy( p_packet, p_data + 8, i_packet_length - 8 );
FREENULL( p_sys->p_media );
p_sys->p_media = p_packet;
# include "config.h"
#endif
-#include <assert.h>
-
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_sout.h>
#include <vlc_block.h>
+
+
#include <vlc_input.h>
#include <vlc_playlist.h>
-#include <vlc_memory.h>
#if 0 //def HAVE_AVAHI_CLIENT
#include "bonjour.h"
p_sys->i_header_allocated = 1024;
p_sys->i_header_size = 0;
- p_sys->p_header = malloc( p_sys->i_header_allocated );
+ p_sys->p_header = xmalloc( p_sys->i_header_allocated );
p_sys->b_header_complete = false;
- if( !p_sys->p_header )
- p_sys->i_header_allocated = 0;
p_access->pf_write = Write;
p_access->pf_seek = Seek;
p_access->pf_control = Control;
- /* XXX Do we deal gracefully with p_sys->p_header == NULL? */
- assert( p_sys->p_header );
-
return VLC_SUCCESS;
}
{
p_sys->i_header_allocated =
p_buffer->i_buffer + p_sys->i_header_size + 1024;
- p_sys->p_header = realloc_or_free( p_sys->p_header,
+ p_sys->p_header = xrealloc( p_sys->p_header,
p_sys->i_header_allocated );
- assert( p_sys->p_header );
}
memcpy( &p_sys->p_header[p_sys->i_header_size],
p_buffer->p_buffer,
# include "config.h"
#endif
-#include <assert.h>
-
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_aout.h>
#include <vlc_filter.h>
-#include <vlc_memory.h>
-
/*****************************************************************************
* Local structures
*****************************************************************************/
p_filter->p_sys->i_frame_size, p_in_buf->i_buffer );
p_filter->p_sys->i_frame_size = p_in_buf->i_buffer;
- p_filter->p_sys->p_buf = realloc_or_free( p_filter->p_sys->p_buf,
+ p_filter->p_sys->p_buf = xrealloc( p_filter->p_sys->p_buf,
p_in_buf->i_buffer * 3 );
- assert( p_filter->p_sys->p_buf );
p_filter->p_sys->i_frames = 0;
}
#include <vlc_aout.h>
#include <vlc_cpu.h>
-#include <vlc_memory.h>
-
/* ALSA part
Note: we use the new API which is available since 0.9.0beta10a. */
#define ALSA_PCM_NEW_HW_PARAMS_API
break;
}
- p_item->ppsz_list = realloc_or_free( p_item->ppsz_list,
+ p_item->ppsz_list = xrealloc( p_item->ppsz_list,
(p_item->i_list + 2) * sizeof(char *) );
- assert( p_item->ppsz_list );
- p_item->ppsz_list_text = realloc_or_free( p_item->ppsz_list_text,
+ p_item->ppsz_list_text = xrealloc( p_item->ppsz_list_text,
(p_item->i_list + 2) * sizeof(char *) );
- assert( p_item->ppsz_list_text );
p_item->ppsz_list[ p_item->i_list ] = psz_device;
p_item->ppsz_list_text[ p_item->i_list ] = psz_descr;
p_item->i_list++;
# include "config.h"
#endif
-#include <assert.h>
-
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_aout.h>
#include <vlc_charset.h>
-#include <vlc_memory.h>
#include <windows.h>
#include <mmsystem.h>
int wave_devices = waveOutGetNumDevs();
- p_item->ppsz_list = realloc_or_free( p_item->ppsz_list,
+ p_item->ppsz_list = xrealloc( p_item->ppsz_list,
(wave_devices+2) * sizeof(char *) );
- assert( p_item->ppsz_list );
- p_item->ppsz_list_text = realloc_or_free( p_item->ppsz_list_text,
+ p_item->ppsz_list_text = xrealloc( p_item->ppsz_list_text,
(wave_devices+2) * sizeof(char *) );
- assert( p_item->ppsz_list_text );
WAVEOUTCAPS caps;
char sz_dev_name[MAXPNAMELEN+32];
#endif
#include <stdio.h>
-#include <assert.h>
-
-#include <vlc_memory.h>
#include "xurl.h"
size_t i_characters_until_last_slash;
i_characters_until_last_slash = pc_last_slash - psz_path;
- psz_path_head = malloc( i_characters_until_last_slash + 1 );
- assert( psz_path_head );
+ psz_path_head = xmalloc( i_characters_until_last_slash + 1 );
strncpy( psz_path_head, psz_path, i_characters_until_last_slash + 1 );
/* terminate the resulting string with '\0' */
size_t i_new_string_length = strlen( psz_string ) +
strlen( psz_to_append ) + 1;
- psz_string = realloc_or_free( psz_string, i_new_string_length );
- assert( psz_string );
+ psz_string = xrealloc( psz_string, i_new_string_length );
return strcat( psz_string, psz_to_append );
}
# include "config.h"
#endif
-#include <assert.h>
-
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_codec.h>
#include <vlc_sout.h>
-#include <vlc_memory.h>
#include <vlc_bits.h>
free( p_region->p_pixbuf );
}
- p_region->p_pixbuf = malloc( i_height * i_width );
- assert( p_region->p_pixbuf );
+ p_region->p_pixbuf = xmalloc( i_height * i_width );
p_region->i_depth = 0;
b_fill = true;
}
/* We create a new object */
p_region->i_object_defs++;
- p_region->p_object_defs = realloc_or_free( p_region->p_object_defs,
+ p_region->p_object_defs = xrealloc( p_region->p_object_defs,
sizeof(dvbsub_objectdef_t) * p_region->i_object_defs );
- assert( p_region->p_object_defs );
/* We parse object properties */
p_obj = &p_region->p_object_defs[p_region->i_object_defs - 1];
if( p_region->p_object_defs[i].i_id != i_id ) continue;
p_region->p_object_defs[i].psz_text =
- realloc_or_free( p_region->p_object_defs[i].psz_text,
+ xrealloc( p_region->p_object_defs[i].psz_text,
i_number_of_codes + 1 );
- assert( p_region->p_object_defs[i].psz_text );
/* FIXME 16bits -> char ??? See Preamble */
for( j = 0; j < i_number_of_codes; j++ )
#endif
#ifndef RANDOM_DITHERING
- pi_delta = malloc( ( p_region->p_picture->p[0].i_pitch + 1 )
+ pi_delta = xmalloc( ( p_region->p_picture->p[0].i_pitch + 1 )
* sizeof(int) * 4 );
- assert( pi_delta );
for( i = 0; i < (p_region->p_picture->p[0].i_pitch + 1) * 4 ; i++ )
{
pi_delta[ i ] = 0;
{
encoder_region_t region;
region.i_width = region.i_height = 0;
- p_sys->p_regions = realloc_or_free( p_sys->p_regions,
+ p_sys->p_regions = xrealloc( p_sys->p_regions,
sizeof(encoder_region_t) * (p_sys->i_regions + 1) );
- assert( p_sys->p_regions );
p_sys->p_regions[p_sys->i_regions++] = region;
}
# include "config.h"
#endif
-#include <assert.h>
-
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_codec.h>
#include <vlc_aout.h>
-#include <vlc_memory.h>
#ifdef HAVE_FLAC_STREAM_DECODER_H
# include <FLAC/stream_decoder.h>
if( p_dec->fmt_out.i_codec == VLC_CODEC_FLAC )
{
p_dec->fmt_out.i_extra = p_dec->fmt_in.i_extra;
- p_dec->fmt_out.p_extra = realloc_or_free( p_dec->fmt_out.p_extra,
+ p_dec->fmt_out.p_extra = xrealloc( p_dec->fmt_out.p_extra,
p_dec->fmt_out.i_extra );
- /*assert( p_dec->fmt_out.p_extra ); assert undefined here? */
memcpy( p_dec->fmt_out.p_extra,
p_dec->fmt_in.p_extra, p_dec->fmt_out.i_extra );
}
if( p_sys->i_buffer < p_aout_buf->i_buffer * 2 )
{
p_sys->p_buffer =
- realloc_or_free( p_sys->p_buffer, p_aout_buf->i_buffer * 2 );
- assert( p_sys->p_buffer );
+ xrealloc( p_sys->p_buffer, p_aout_buf->i_buffer * 2 );
p_sys->i_buffer = p_aout_buf->i_buffer * 2;
}
/* Backup the STREAMINFO metadata block */
p_enc->fmt_out.i_extra = STREAMINFO_SIZE + 4;
- p_enc->fmt_out.p_extra = malloc( STREAMINFO_SIZE + 4 );
- assert( p_enc->fmt_out.p_extra );
+ p_enc->fmt_out.p_extra = xmalloc( STREAMINFO_SIZE + 4 );
memcpy( p_enc->fmt_out.p_extra, "fLaC", 4 );
memcpy( ((uint8_t *)p_enc->fmt_out.p_extra) + 4, buffer,
STREAMINFO_SIZE );
# include "config.h"
#endif
-#include <assert.h>
-
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_input.h>
#include <vlc_codec.h>
#include <vlc_osd.h>
-#include <vlc_memory.h>
#include <kate/kate.h>
#ifdef HAVE_TIGER
/* Backup headers as extra data */
uint8_t *p_extra;
- p_dec->fmt_in.p_extra = realloc_or_free( p_dec->fmt_in.p_extra,
+ p_dec->fmt_in.p_extra = xrealloc( p_dec->fmt_in.p_extra,
p_dec->fmt_in.i_extra + kp.nbytes + 2 );
- assert( p_dec->fmt_in.p_extra );
p_extra = (void*)(((unsigned char*)p_dec->fmt_in.p_extra) + p_dec->fmt_in.i_extra);
*(p_extra++) = kp.nbytes >> 8;
*(p_extra++) = kp.nbytes & 0xFF;
else
{
p_dec->fmt_out.i_extra = p_dec->fmt_in.i_extra;
- p_dec->fmt_out.p_extra = realloc_or_free( p_dec->fmt_out.p_extra,
+ p_dec->fmt_out.p_extra = xrealloc( p_dec->fmt_out.p_extra,
p_dec->fmt_out.i_extra );
- assert( p_dec->fmt_out.p_extra );
memcpy( p_dec->fmt_out.p_extra,
p_dec->fmt_in.p_extra, p_dec->fmt_out.i_extra );
}
# include "config.h"
#endif
-#include <assert.h>
-
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_aout.h>
#include <vlc_codec.h>
-#include <vlc_memory.h>
#if !defined (__APPLE__) && !defined(WIN32)
# define LOADER 1
if( p_sys->i_buffer_size < p_sys->i_buffer + p_block->i_buffer )
{
p_sys->i_buffer_size = p_sys->i_buffer + p_block->i_buffer + 1024;
- p_sys->p_buffer = realloc_or_free( p_sys->p_buffer, p_sys->i_buffer_size );
- assert( p_sys->p_buffer );
+ p_sys->p_buffer = xrealloc( p_sys->p_buffer, p_sys->i_buffer_size );
}
memcpy( &p_sys->p_buffer[p_sys->i_buffer], p_block->p_buffer,
p_block->i_buffer );
# include "config.h"
#endif
-#include <assert.h>
-
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_codec.h>
int i_vide = p_dec->fmt_in.i_extra;
unsigned int *p_vide = p_dec->fmt_in.p_extra;
decoder_sys_t *p_sys = calloc( 1, sizeof( decoder_sys_t ) );
- assert( p_sys );
+
+ if( !p_sys )
+ return VLC_ENOMEM;
if( i_vide < 8 )
{
# include "config.h"
#endif
-#include <assert.h>
-
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_input.h>
#include <vlc_codec.h>
#include <vlc_aout.h>
-#include <vlc_memory.h>
#include <ogg/ogg.h>
#include <speex/speex.h>
{
uint8_t *p_extra;
- p_dec->fmt_in.p_extra = realloc_or_free( p_dec->fmt_in.p_extra,
+ p_dec->fmt_in.p_extra = xrealloc( p_dec->fmt_in.p_extra,
p_dec->fmt_in.i_extra + oggpacket.bytes + 2 );
- assert( p_dec->fmt_in.p_extra );
p_extra = ((uint8_t *)p_dec->fmt_in.p_extra) + p_dec->fmt_in.i_extra;
*(p_extra++) = oggpacket.bytes >> 8;
*(p_extra++) = oggpacket.bytes & 0xFF;
if( p_sys->b_packetizer )
{
p_dec->fmt_out.i_extra = p_dec->fmt_in.i_extra;
- p_dec->fmt_out.p_extra = realloc_or_free( p_dec->fmt_out.p_extra,
+ p_dec->fmt_out.p_extra = xrealloc( p_dec->fmt_out.p_extra,
p_dec->fmt_out.i_extra );
- assert( p_dec->fmt_out.p_extra );
memcpy( p_dec->fmt_out.p_extra,
p_dec->fmt_in.p_extra, p_dec->fmt_out.i_extra );
}
block_t *p_new_block = NULL;
i_pcm_output_size = p_sys->p_header->frame_size;
- p_frame_holder = (short*)malloc( sizeof(short)*i_pcm_output_size );
- assert( p_frame_holder );
+ p_frame_holder = (short*)xmalloc( sizeof(short)*i_pcm_output_size );
speex_bits_read_from( &p_sys->bits, (char*)p_oggpacket->packet,
p_oggpacket->bytes);
p_sys->i_frame_size = p_sys->i_frame_length *
sizeof(int16_t) * p_enc->fmt_in.audio.i_channels;
- p_sys->p_buffer = malloc( p_sys->i_frame_size );
- assert( p_sys->p_buffer );
+ p_sys->p_buffer = xmalloc( p_sys->i_frame_size );
/* Create and store headers */
pp_header[0] = speex_header_to_packet( &p_sys->header, &pi_header[0] );
pi_header[1] = sizeof("ENCODER=VLC media player");
p_enc->fmt_out.i_extra = 3 * 2 + pi_header[0] + pi_header[1];
- p_extra = p_enc->fmt_out.p_extra = malloc( p_enc->fmt_out.i_extra );
- assert( p_extra );
+ p_extra = p_enc->fmt_out.p_extra = xmalloc( p_enc->fmt_out.i_extra );
for( i = 0; i < 2; i++ )
{
*(p_extra++) = pi_header[i] >> 8;
# include "config.h"
#endif
-#include <assert.h>
-
#include "subsdec.h"
#include <vlc_plugin.h>
{
size_t inbytes_left = strlen( psz_subtitle );
size_t outbytes_left = 6 * inbytes_left;
- char *psz_new_subtitle = malloc( outbytes_left + 1 );
+ char *psz_new_subtitle = xmalloc( outbytes_left + 1 );
char *psz_convert_buffer_out = psz_new_subtitle;
const char *psz_convert_buffer_in = psz_subtitle;
- assert( psz_new_subtitle );
-
size_t ret = vlc_iconv( p_sys->iconv_handle,
&psz_convert_buffer_in, &inbytes_left,
&psz_convert_buffer_out, &outbytes_left );
# include "config.h"
#endif
-#include <assert.h>
-
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_codec.h>
#include <vlc_sout.h>
#include <vlc_input.h>
-#include <vlc_memory.h>
#include <ogg/ogg.h>
#include <theora/theora.h>
/* Backup headers as extra data */
uint8_t *p_extra;
- p_dec->fmt_in.p_extra = realloc_or_free( p_dec->fmt_in.p_extra,
+ p_dec->fmt_in.p_extra = xrealloc( p_dec->fmt_in.p_extra,
p_dec->fmt_in.i_extra + oggpacket.bytes + 2 );
- assert( p_dec->fmt_in.p_extra );
p_extra = ((uint8_t *)p_dec->fmt_in.p_extra) + p_dec->fmt_in.i_extra;
*(p_extra++) = oggpacket.bytes >> 8;
*(p_extra++) = oggpacket.bytes & 0xFF;
else
{
p_dec->fmt_out.i_extra = p_dec->fmt_in.i_extra;
- p_dec->fmt_out.p_extra = realloc_or_free( p_dec->fmt_out.p_extra,
+ p_dec->fmt_out.p_extra = xrealloc( p_dec->fmt_out.p_extra,
p_dec->fmt_out.i_extra );
- assert( p_dec->fmt_out.p_extra );
memcpy( p_dec->fmt_out.p_extra,
p_dec->fmt_in.p_extra, p_dec->fmt_out.i_extra );
}
else if( i == 1 ) theora_encode_comment( &p_sys->tc, &header );
else if( i == 2 ) theora_encode_tables( &p_sys->td, &header );
- p_enc->fmt_out.p_extra = realloc_or_free( p_enc->fmt_out.p_extra,
+ p_enc->fmt_out.p_extra = xrealloc( p_enc->fmt_out.p_extra,
p_enc->fmt_out.i_extra + header.bytes );
- assert( p_enc->fmt_out.p_extra );
p_extra = p_enc->fmt_out.p_extra;
p_extra += p_enc->fmt_out.i_extra + (i-3)*2;
p_enc->fmt_out.i_extra += header.bytes;
# include "config.h"
#endif
-#include <assert.h>
-
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_codec.h>
#include <vlc_aout.h>
#include <vlc_input.h>
#include <vlc_sout.h>
-#include <vlc_memory.h>
#include <ogg/ogg.h>
/* Backup headers as extra data */
uint8_t *p_extra;
- p_dec->fmt_in.p_extra = realloc_or_free( p_dec->fmt_in.p_extra,
+ p_dec->fmt_in.p_extra = xrealloc( p_dec->fmt_in.p_extra,
p_dec->fmt_in.i_extra + oggpacket.bytes + 2 );
- assert( p_dec->fmt_in.p_extra );
p_extra = (uint8_t *)p_dec->fmt_in.p_extra + p_dec->fmt_in.i_extra;
*(p_extra++) = oggpacket.bytes >> 8;
*(p_extra++) = oggpacket.bytes & 0xFF;
else
{
p_dec->fmt_out.i_extra = p_dec->fmt_in.i_extra;
- p_dec->fmt_out.p_extra = realloc_or_free( p_dec->fmt_out.p_extra,
+ p_dec->fmt_out.p_extra = xrealloc( p_dec->fmt_out.p_extra,
p_dec->fmt_out.i_extra );
- assert( p_dec->fmt_out.p_extra );
memcpy( p_dec->fmt_out.p_extra,
p_dec->fmt_in.p_extra, p_dec->fmt_out.i_extra );
}
&header[0], &header[1], &header[2]);
p_enc->fmt_out.i_extra = 3 * 2 + header[0].bytes +
header[1].bytes + header[2].bytes;
- p_extra = p_enc->fmt_out.p_extra = malloc( p_enc->fmt_out.i_extra );
- assert( p_extra );
+ p_extra = p_enc->fmt_out.p_extra = xmalloc( p_enc->fmt_out.i_extra );
for( i = 0; i < 3; i++ )
{
*(p_extra++) = header[i].bytes >> 8;
# include "config.h"
#endif
-#include <assert.h>
-
#include "http.h"
#include "macros.h"
#include <vlc_url.h>
-#include <vlc_memory.h>
static int MacroParse( macro_t *m, char *psz_src )
{
{ \
int __i__ = *pp_dst - *pp_data; \
*pi_data += (l); \
- *pp_data = realloc_or_free( *pp_data, *pi_data ); \
- assert( *pp_data ); \
+ *pp_data = xrealloc( *pp_data, *pi_data ); \
*pp_dst = (*pp_data) + __i__; \
}
#define PRINT( str ) \
if( !*item ) continue;
int i_item = atoi( item );
- p_items = realloc_or_free( p_items,
+ p_items = xrealloc( p_items,
(i_nb_items + 1) * sizeof(*p_items) );
- assert( p_items );
p_items[i_nb_items] = i_item;
i_nb_items++;
}
if( !*item ) continue;
int i_item = atoi( item );
- p_items = realloc_or_free( p_items,
+ p_items = xrealloc( p_items,
(i_nb_items + 1) * sizeof(*p_items) );
- assert( p_items );
p_items[i_nb_items] = i_item;
i_nb_items++;
}
};
vlm_message_t *vlm_answer;
char name[512];
- char *psz = malloc( strlen( p_request ) + 1000 );
+ char *psz = xmalloc( strlen( p_request ) + 1000 );
char *p = psz;
char *vlm_error;
int i;
- assert( psz );
-
if( p_intf->p_sys->p_vlm == NULL )
p_intf->p_sys->p_vlm = vlm_New( p_intf );
char *src, *dup, *end;
char *dst = *pp_dst;
- src = dup = malloc( _end - _src + 1 );
+ src = dup = xmalloc( _end - _src + 1 );
end = src +( _end - _src );
- assert( src );
-
memcpy( src, _src, _end - _src );
*end = '\0';
int i_index = dst - *pp_data;
*pi_data += i_copy;
- *pp_data = realloc_or_free( *pp_data, *pi_data );
- assert( *pp_data );
+ *pp_data = xrealloc( *pp_data, *pi_data );
dst = (*pp_data) + i_index;
memcpy( dst, src, i_copy );
#include "http.h"
#include <limits.h>
-#include <assert.h>
-
-#include <vlc_memory.h>
-
/* Utility function for scandir */
static int Filter( const char *foo )
{
v->value = strdup( value ? value : "" );
v->i_field = 0;
- v->field = malloc( sizeof( mvar_t * ) );
- assert( v->field );
+ v->field = xmalloc( sizeof( mvar_t * ) );
v->field[0] = NULL;
return v;
void mvar_AppendVar( mvar_t *v, mvar_t *f )
{
- v->field = realloc_or_free( v->field,
- sizeof( mvar_t * ) * ( v->i_field + 2 ) );
- assert( v->field );
+ v->field = xrealloc( v->field, sizeof( mvar_t * ) * ( v->i_field + 2 ) );
v->field[v->i_field] = f;
v->i_field++;
}
void mvar_PushVar( mvar_t *v, mvar_t *f )
{
- v->field = realloc_or_free( v->field,
- sizeof( mvar_t * ) * ( v->i_field + 2 ) );
- assert( v->field );
+ v->field = xrealloc( v->field, sizeof( mvar_t * ) * ( v->i_field + 2 ) );
if( v->i_field > 0 )
{
memmove( &v->field[1], &v->field[0], sizeof( mvar_t * ) * v->i_field );
# include "config.h"
#endif
-#include <assert.h>
-
#include <vlc_common.h>
#include "http.h"
#include <vlc_strings.h>
-#include <vlc_memory.h>
/****************************************************************************
* File and directory functions
/* just load the file */
*pi_data = 0;
- *pp_data = malloc( 1025 ); /* +1 for \0 */
- assert( *pp_data );
+ *pp_data = xmalloc( 1025 ); /* +1 for \0 */
while( ( i_read = fread( &(*pp_data)[*pi_data], 1, 1024, f ) ) == 1024 )
{
*pi_data += 1024;
- *pp_data = realloc_or_free( *pp_data, *pi_data + 1025 );
- assert( *pp_data );
+ *pp_data = xrealloc( *pp_data, *pi_data + 1025 );
}
if( i_read > 0 )
{
}
if( f == NULL )
{
- f = malloc( sizeof( httpd_file_sys_t ) );
+ f = xmalloc( sizeof( httpd_file_sys_t ) );
f->b_handler = false;
}
- assert( f );
f->p_intf = p_intf;
f->p_file = NULL;
char *p;
int i_len = strlen(psz_src);
- psz_dir = malloc( i_len + 2 );
- assert( psz_dir );
+ psz_dir = xmalloc( i_len + 2 );
strcpy( psz_dir, psz_src );
/* Add a trailing sep to ease the .. step */
# include "config.h"
#endif
-#include <assert.h>
-
#include <vlc_common.h>
#include <vlc_plugin.h>
-#include <vlc_memory.h>
#include <errno.h> /* ENOMEM */
#include <ctype.h>
else if( *psz_item )
{
i_options++;
- ppsz_options = realloc_or_free( ppsz_options,
- i_options * sizeof(char *) );
- assert( ppsz_options );
+ ppsz_options = xrealloc( ppsz_options, i_options * sizeof(char *) );
ppsz_options[i_options - 1] = &psz_item[1];
}
# include "config.h"
#endif
-#include <assert.h>
-
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_interface.h>
#include <vlc_input.h>
-#include <vlc_memory.h>
#include <stdbool.h>
#include <sys/stat.h>
}
i_message += strlen( message->psz_name ) + i_level * sizeof( " " ) + 1;
- psz_message = malloc( i_message );
- assert( psz_message );
+ psz_message = xmalloc( i_message );
*psz_message = 0;
for( i = 0; i < i_level; i++ ) strcat( psz_message, " " );
strcat( psz_message, message->psz_name );
{
i_message += sizeof( " : " ) + strlen( message->psz_value ) +
sizeof( STRING_CR );
- psz_message = realloc_or_free( psz_message, i_message );
- assert( psz_message );
+ psz_message = xrealloc( psz_message, i_message );
strcat( psz_message, " : " );
strcat( psz_message, message->psz_value );
strcat( psz_message, STRING_CR );
else
{
i_message += sizeof( STRING_CR );
- psz_message = realloc_or_free( psz_message, i_message );
- assert( psz_message );
+ psz_message = xrealloc( psz_message, i_message );
strcat( psz_message, STRING_CR );
}
MessageToString( message->child[i], i_level + 1 );
i_message += strlen( child_message );
- psz_message = realloc_or_free( psz_message, i_message );
- assert( psz_message );
+ psz_message = xrealloc( psz_message, i_message );
strcat( psz_message, child_message );
free( child_message );
}
#include <vlc_common.h>
#include <vlc_input.h>
#include <vlc_demux.h>
-#include <vlc_memory.h>
#include <limits.h>
#include <string.h>
-#include <assert.h>
#include "asademux.h"
#define MAXDELTA 4 /**< nr of times kept for delta backref */
#define MAXGROUP 24 /**< maximum number of regex match groups */
-#define xmalloc malloc
-#define xrealloc realloc_or_free
#define xfree free
-#define xstrdup strdup
+static inline char *xstrdup(const char *str)
+{
+ char *ret = strdup (str);
+ if (unlikely(ret == NULL))
+ abort();
+ return ret;
+}
/** state of a running import */
struct asa_import_state {
if (state->selstr)
xfree(state->selstr);
state->selstr = xstrdup(state->matches[insn->v.select]);
- assert(state->selstr);
state->sellen = strlen(state->selstr);
return 0;
}
newstr_size = v[0] * 2;
newstr = (char *)xmalloc(newstr_size);
- assert(newstr);
memcpy(newstr, state->selstr, v[0]);
newpos = v[0];
if (need > avail) {
newstr_size += need - avail + 256;
newstr = (char *)xrealloc(newstr, newstr_size);
- assert(newstr);
}
memcpy(newstr + newpos, src, need);
newpos += need;
firstold = newpos;
newstr_size = newpos + state->sellen - v[1];
newstr = (char *)xrealloc(newstr, newstr_size + 1);
- assert(newstr);
memcpy(newstr + newpos, state->selstr + v[1],
state->sellen - v[1] + 1);
state->selstr = newstr;
if (state->selstr)
xfree(state->selstr);
state->selstr = xstrdup(state->matches[0]);
- assert(state->selstr);
state->sellen = strlen(state->selstr);
}
{
state->out = (char *)xrealloc(state->out,
state->outlen + state->sellen + 1);
- assert(state->out);
memcpy(state->out + state->outlen, state->selstr, state->sellen);
state->outlen += state->sellen;
state->out[state->outlen] = '\0';
p_demux->pf_demux = Demux;
p_demux->pf_control = Control;
p_demux->p_sys = p_sys = (demux_sys_t *)malloc( sizeof( demux_sys_t ) );
- assert(p_sys);
+ if( unlikely( !p_sys ) )
+ return VLC_ENOMEM;
msg_Dbg( p_demux, "loading complete file (could be long)" );
p_sys->i_data = stream_Size( p_demux->s );
p_sys->p_data = (uint8_t *)malloc( p_sys->i_data );
- assert(p_sys->p_data);
+ if( unlikely( !p_sys->p_data ) )
+ {
+ free( p_sys );
+ return VLC_ENOMEM;
+ }
p_sys->i_data = stream_Read( p_demux->s, p_sys->p_data, p_sys->i_data );
if( p_sys->i_data <= 0 )
{
int *pi_int = (int*)va_arg( args, int* );
*pi_int = p_sys->i_tracks;
- *ppp_title = (input_title_t**)malloc( sizeof( input_title_t**) * p_sys->i_tracks );
- assert( *ppp_sitle );
+ *ppp_title = (input_title_t**)xmalloc( sizeof( input_title_t**) * p_sys->i_tracks );
for( int i = 0; i < p_sys->i_tracks; i++ )
{
memset(&z_str, 0, sizeof(z_str));
out_size = i_size * 2;
- out_buffer = (uint8_t*)malloc(out_size);
- assert(out_buffer);
+ out_buffer = (uint8_t*)xmalloc(out_size);
z_str.next_in = (unsigned char*)p_buffer;
z_str.avail_in = i_size;
case Z_BUF_ERROR:
offset = z_str.next_out - out_buffer;
out_size *= 2;
- out_buffer = (uint8_t *)realloc_or_free(out_buffer, out_size);
- assert(out_buffer);
+ out_buffer = (uint8_t *)xrealloc(out_buffer, out_size);
z_str.next_out = out_buffer + offset;
z_str.avail_out = out_size - offset;
break;
inflateEnd(&z_str);
- out_buffer = (uint8_t *)realloc_or_free(out_buffer, *pi_osize);
- assert(out_buffer);
+ out_buffer = (uint8_t *)xrealloc(out_buffer, *pi_osize);
(*pp_obuffer) = out_buffer;
}
#endif
#include <vlc_dialog.h>
#include <vlc_url.h>
#include <vlc_strings.h>
-#include <vlc_memory.h>
#include <iostream>
#include <limits.h>
}
i_sdp_max += 1000;
- p_sdp = (uint8_t*)realloc_or_free( p_sdp, i_sdp_max );
- assert( p_sdp );
+ p_sdp = (uint8_t*)xrealloc( p_sdp, i_sdp_max );
}
p_sys->p_sdp = (char*)p_sdp;
}
i_extra ) ) )
{
tk->fmt.i_extra = i_extra;
- tk->fmt.p_extra = malloc( i_extra );
- assert( tk->fmt.p_extra );
+ tk->fmt.p_extra = xmalloc( i_extra );
memcpy( tk->fmt.p_extra, p_extra, i_extra );
delete[] p_extra;
}
i_extra ) ) )
{
tk->fmt.i_extra = i_extra;
- tk->fmt.p_extra = malloc( i_extra );
- assert( tk->fmt.p_extra );
+ tk->fmt.p_extra = xmalloc( i_extra );
memcpy( tk->fmt.p_extra, p_extra, i_extra );
delete[] p_extra;
}
i_extra ) ) )
{
tk->fmt.i_extra = i_extra;
- tk->fmt.p_extra = malloc( i_extra );
- assert( tk->fmt.p_extra );
+ tk->fmt.p_extra = xmalloc( i_extra );
memcpy( tk->fmt.p_extra, p_extra, i_extra );
delete[] p_extra;
i_extra ) ) )
{
tk->fmt.i_extra = i_extra;
- tk->fmt.p_extra = malloc( i_extra );
- assert( tk->fmt.p_extra );
+ tk->fmt.p_extra = xmalloc( i_extra );
memcpy( tk->fmt.p_extra, p_extra, i_extra );
delete[] p_extra;
}
if( tk->p_es || tk->b_quicktime || tk->b_muxed || tk->b_asf )
{
/* Append */
- p_sys->track = (live_track_t**)realloc_or_free( p_sys->track,
+ p_sys->track = (live_track_t**)xrealloc( p_sys->track,
sizeof( live_track_t ) * ( p_sys->i_track + 1 ) );
- assert( p_sys->track );
p_sys->track[p_sys->i_track++] = tk;
}
else
atomLength <= INT_MAX )
{
tk->fmt.i_extra = atomLength-8;
- tk->fmt.p_extra = malloc( tk->fmt.i_extra );
- assert( tk->fmt.p_extra );
+ tk->fmt.p_extra = xmalloc( tk->fmt.i_extra );
memcpy(tk->fmt.p_extra, pos+8, atomLength-8);
break;
}
else
{
tk->fmt.i_extra = qtState.sdAtomSize - 16;
- tk->fmt.p_extra = malloc( tk->fmt.i_extra );
- assert( tk->fmt.p_extra );
+ tk->fmt.p_extra = xmalloc( tk->fmt.i_extra );
memcpy( tk->fmt.p_extra, &sdAtom[12], tk->fmt.i_extra );
}
}
#include "chapter_command.hpp"
-#include <assert.h>
-#include <vlc_memory.h>
-
chapter_item_c::~chapter_item_c()
{
std::vector<chapter_codec_cmds_c*>::iterator index = codecs.begin();
// A start time of '0' is ok. A missing ChapterTime element is ok, too, because '0' is its default value.
title.i_seekpoint++;
- title.seekpoint = (seekpoint_t**)realloc_or_free( title.seekpoint,
+ title.seekpoint = (seekpoint_t**)xrealloc( title.seekpoint,
title.i_seekpoint * sizeof( seekpoint_t* ) );
- assert( title.seekpoint );
title.seekpoint[title.i_seekpoint-1] = sk;
if ( b_user_display )
#include "demux.hpp"
-#include <assert.h>
-#include <vlc_memory.h>
-
extern "C" {
#include "../vobsub.h"
}
if( i_index >= i_index_max )
{
i_index_max += 1024;
- p_indexes = (mkv_index_t*)realloc_or_free( p_indexes,
+ p_indexes = (mkv_index_t*)xrealloc( p_indexes,
sizeof( mkv_index_t ) * i_index_max );
- assert( p_indexes );
}
#undef idx
}
if( i_index >= i_index_max )
{
i_index_max += 1024;
- p_indexes = (mkv_index_t*)realloc_or_free( p_indexes,
+ p_indexes = (mkv_index_t*)xrealloc( p_indexes,
sizeof( mkv_index_t ) * i_index_max );
- assert( p_indexes );
}
#undef idx
}
tracks[i_track]->fmt.i_extra = GetDWLE( &p_bih->biSize ) - sizeof( BITMAPINFOHEADER );
if( tracks[i_track]->fmt.i_extra > 0 )
{
- tracks[i_track]->fmt.p_extra = malloc( tracks[i_track]->fmt.i_extra );
- assert( tracks[i_track]->fmt.p_extra );
+ tracks[i_track]->fmt.p_extra = xmalloc( tracks[i_track]->fmt.i_extra );
memcpy( tracks[i_track]->fmt.p_extra, &p_bih[1], tracks[i_track]->fmt.i_extra );
}
}
+ 6;
if( i_size1 > 0 && i_size2 > 0 && i_size3 > 0 ) {
tracks[i_track]->fmt.p_extra =
- malloc( tracks[i_track]->fmt.i_extra );
- assert( tracks[i_track]->fmt.p_extra );
+ xmalloc( tracks[i_track]->fmt.i_extra );
uint8_t *p_out = (uint8_t*)tracks[i_track]->fmt.p_extra;
*p_out++ = (i_size1>>8) & 0xFF;
*p_out++ = i_size1 & 0xFF;
else
tracks[i_track]->fmt.i_codec = VLC_CODEC_MP4V;
tracks[i_track]->fmt.i_extra = tracks[i_track]->i_extra_data;
- tracks[i_track]->fmt.p_extra = malloc( tracks[i_track]->i_extra_data );
- assert( tracks[i_track]->fmt.p_extra );
+ tracks[i_track]->fmt.p_extra = xmalloc( tracks[i_track]->i_extra_data );
memcpy( tracks[i_track]->fmt.p_extra,tracks[i_track]->p_extra_data, tracks[i_track]->i_extra_data );
}
}
else if( !strcmp( tracks[i_track]->psz_codec, "V_QUICKTIME" ) )
{
- MP4_Box_t *p_box = (MP4_Box_t*)malloc( sizeof( MP4_Box_t ) );
- assert( p_box );
+ MP4_Box_t *p_box = (MP4_Box_t*)xmalloc( sizeof( MP4_Box_t ) );
stream_t *p_mp4_stream = stream_MemoryNew( VLC_OBJECT(&sys.demuxer),
tracks[i_track]->p_extra_data,
tracks[i_track]->i_extra_data,
tracks[i_track]->fmt.video.i_width = p_box->data.p_sample_vide->i_width;
tracks[i_track]->fmt.video.i_height = p_box->data.p_sample_vide->i_height;
tracks[i_track]->fmt.i_extra = p_box->data.p_sample_vide->i_qt_image_description;
- tracks[i_track]->fmt.p_extra = malloc( tracks[i_track]->fmt.i_extra );
- assert( tracks[i_track]->fmt.p_extra );
+ tracks[i_track]->fmt.p_extra = xmalloc( tracks[i_track]->fmt.i_extra );
memcpy( tracks[i_track]->fmt.p_extra, p_box->data.p_sample_vide->p_qt_image_description, tracks[i_track]->fmt.i_extra );
MP4_FreeBox_sample_vide( p_box );
}
tracks[i_track]->fmt.i_extra = GetWLE( &p_wf->cbSize );
if( tracks[i_track]->fmt.i_extra > 0 )
{
- tracks[i_track]->fmt.p_extra = malloc( tracks[i_track]->fmt.i_extra );
- assert( tracks[i_track]->fmt.p_extra );
+ tracks[i_track]->fmt.p_extra = xmalloc( tracks[i_track]->fmt.i_extra );
memcpy( tracks[i_track]->fmt.p_extra, &p_wf[1], tracks[i_track]->fmt.i_extra );
}
}
{
tracks[i_track]->fmt.i_codec = VLC_CODEC_FLAC;
tracks[i_track]->fmt.i_extra = tracks[i_track]->i_extra_data;
- tracks[i_track]->fmt.p_extra = malloc( tracks[i_track]->i_extra_data );
- assert( tracks[i_track]->fmt.p_extra );
+ tracks[i_track]->fmt.p_extra = xmalloc( tracks[i_track]->i_extra_data );
memcpy( tracks[i_track]->fmt.p_extra,tracks[i_track]->p_extra_data, tracks[i_track]->i_extra_data );
}
else if( !strcmp( tracks[i_track]->psz_codec, "A_VORBIS" ) )
i_size[2] = tracks[i_track]->i_extra_data - i_offset - i_size[0] - i_size[1];
tracks[i_track]->fmt.i_extra = 3 * 2 + i_size[0] + i_size[1] + i_size[2];
- tracks[i_track]->fmt.p_extra = malloc( tracks[i_track]->fmt.i_extra );
- assert( tracks[i_track]->fmt.p_extra );
+ tracks[i_track]->fmt.p_extra = xmalloc( tracks[i_track]->fmt.i_extra );
p_extra = (uint8_t *)tracks[i_track]->fmt.p_extra; i_extra = 0;
for( i = 0; i < 3; i++ )
{
msg_Dbg( &sys.demuxer, "profile=%d srate=%d", i_profile, i_srate );
tracks[i_track]->fmt.i_extra = sbr ? 5 : 2;
- tracks[i_track]->fmt.p_extra = malloc( tracks[i_track]->fmt.i_extra );
- assert( tracks[i_track]->fmt.p_extra );
+ tracks[i_track]->fmt.p_extra = xmalloc( tracks[i_track]->fmt.i_extra );
((uint8_t*)tracks[i_track]->fmt.p_extra)[0] = ((i_profile + 1) << 3) | ((i_srate&0xe) >> 1);
((uint8_t*)tracks[i_track]->fmt.p_extra)[1] = ((i_srate & 0x1) << 7) | (tracks[i_track]->fmt.audio.i_channels << 3);
if (sbr != 0)
{
tracks[i_track]->fmt.i_codec = VLC_CODEC_MP4A;
tracks[i_track]->fmt.i_extra = tracks[i_track]->i_extra_data;
- tracks[i_track]->fmt.p_extra = malloc( tracks[i_track]->i_extra_data );
- assert( tracks[i_track]->fmt.p_extra );
+ tracks[i_track]->fmt.p_extra = xmalloc( tracks[i_track]->i_extra_data );
memcpy( tracks[i_track]->fmt.p_extra, tracks[i_track]->p_extra_data, tracks[i_track]->i_extra_data );
}
else if( !strcmp( tracks[i_track]->psz_codec, "A_WAVPACK4" ) )
{
tracks[i_track]->fmt.i_codec = VLC_CODEC_WAVPACK;
tracks[i_track]->fmt.i_extra = tracks[i_track]->i_extra_data;
- tracks[i_track]->fmt.p_extra = malloc( tracks[i_track]->i_extra_data );
- assert( tracks[i_track]->fmt.p_extra );
+ tracks[i_track]->fmt.p_extra = xmalloc( tracks[i_track]->i_extra_data );
memcpy( tracks[i_track]->fmt.p_extra, tracks[i_track]->p_extra_data, tracks[i_track]->i_extra_data );
}
else if( !strcmp( tracks[i_track]->psz_codec, "A_TTA1" ) )
p_fmt->i_extra = p_tk->i_extra_data;
if( p_fmt->i_extra > 0 )
{
- p_fmt->p_extra = malloc( p_tk->i_extra_data );
- assert( p_fmt->p_extra );
+ p_fmt->p_extra = xmalloc( p_tk->i_extra_data );
memcpy( p_fmt->p_extra, p_tk->p_extra_data, p_tk->i_extra_data );
}
else
{
p_fmt->i_extra = 30;
- p_fmt->p_extra = malloc( p_fmt->i_extra );
- assert( p_fmt->p_extra );
+ p_fmt->p_extra = xmalloc( p_fmt->i_extra );
uint8_t *p_extra = (uint8_t*)p_fmt->p_extra;
memcpy( &p_extra[ 0], "TTA1", 4 );
SetWLE( &p_extra[ 4], 1 );
msg_Dbg( &sys.demuxer, "kate last header (%d) is %d bytes", num_headers-1, pi_size[num_headers-1]);
tracks[i_track]->fmt.i_extra = 1 + num_headers * 2 + size_so_far + pi_size[num_headers-1];
- tracks[i_track]->fmt.p_extra = malloc( tracks[i_track]->fmt.i_extra );
- assert( tracks[i_track]->fmt.p_extra );
+ tracks[i_track]->fmt.p_extra = xmalloc( tracks[i_track]->fmt.i_extra );
p_extra = (uint8_t *)tracks[i_track]->fmt.p_extra;
i_extra = 0;
if( tracks[i_track]->i_extra_data )
{
tracks[i_track]->fmt.i_extra = tracks[i_track]->i_extra_data;
- tracks[i_track]->fmt.p_extra = malloc( tracks[i_track]->i_extra_data );
- assert( tracks[i_track]->fmt.p_extra );
+ tracks[i_track]->fmt.p_extra = xmalloc( tracks[i_track]->i_extra_data );
memcpy( tracks[i_track]->fmt.p_extra, tracks[i_track]->p_extra_data, tracks[i_track]->i_extra_data );
}
}
if( tracks[i_track]->i_extra_data )
{
tracks[i_track]->fmt.i_extra = tracks[i_track]->i_extra_data;
- tracks[i_track]->fmt.p_extra = malloc( tracks[i_track]->i_extra_data );
- assert( tracks[i_track]->fmt.p_extra );
+ tracks[i_track]->fmt.p_extra = xmalloc( tracks[i_track]->i_extra_data );
memcpy( tracks[i_track]->fmt.p_extra, tracks[i_track]->p_extra_data, tracks[i_track]->i_extra_data );
}
}
# include "config.h"
#endif
-#include <assert.h>
-
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_demux.h>
-#include <vlc_memory.h>
/* TODO:
* - test
else
{
p_idx->i_idx_max += 1000;
- p_idx->idx = realloc_or_free( p_idx->idx,
+ p_idx->idx = xrealloc( p_idx->idx,
p_idx->i_idx_max*sizeof(demux_index_entry_t));
- assert( p_idx->idx );
}
}
# include "config.h"
#endif
-#include <assert.h>
-
#include <vlc_common.h>
#include <vlc_demux.h>
#include <vlc_charset.h>
#include "playlist.h"
#include <vlc_meta.h>
-#include <vlc_memory.h>
struct demux_sys_t
{
int64_t i_pos = 0;
p_sys->i_data_len = stream_Size( p_demux->s ) + 1; /* This is a cheat to prevent unnecessary realloc */
if( p_sys->i_data_len <= 0 || p_sys->i_data_len > 16384 ) p_sys->i_data_len = 1024;
- p_sys->psz_data = malloc( p_sys->i_data_len +1);
- assert( p_sys->psz_data );
+ p_sys->psz_data = xmalloc( p_sys->i_data_len +1);
/* load the complete file */
for( ;; )
i_pos += i_read;
p_sys->i_data_len <<= 1 ;
- p_sys->psz_data = realloc_or_free( p_sys->psz_data,
+ p_sys->psz_data = xrealloc( p_sys->psz_data,
p_sys->i_data_len * sizeof( char * ) + 1 );
- assert( p_sys->psz_data );
}
if( p_sys->i_data_len <= 0 ) return -1;
}
i_strlen = psz_parse-psz_backup;
if( i_strlen < 1 ) continue;
msg_Dbg( p_demux, "param name strlen: %d", i_strlen);
- psz_string = malloc( i_strlen + 1);
- assert( psz_string );
+ psz_string = xmalloc( i_strlen + 1);
memcpy( psz_string, psz_backup, i_strlen );
psz_string[i_strlen] = '\0';
msg_Dbg( p_demux, "param name: %s", psz_string);
i_strlen = psz_parse-psz_backup;
if( i_strlen < 1 ) continue;
msg_Dbg( p_demux, "param value strlen: %d", i_strlen);
- psz_string = malloc( i_strlen +1);
- assert( psz_string );
+ psz_string = xmalloc( i_strlen +1);
memcpy( psz_string, psz_backup, i_strlen );
psz_string[i_strlen] = '\0';
msg_Dbg( p_demux, "param value: %s", psz_string);
{
i_strlen = psz_parse-psz_backup;
if( i_strlen < 1 ) continue;
- psz_string = malloc( i_strlen +1);
- assert( psz_string );
+ psz_string = xmalloc( i_strlen +1);
memcpy( psz_string, psz_backup, i_strlen );
psz_string[i_strlen] = '\0';
input_item_t *p_input;
}
free( psz_href );
- psz_href = malloc( i_strlen +1);
- assert( psz_string );
+ psz_href = xmalloc( i_strlen +1);
memcpy( psz_href, psz_backup, i_strlen );
psz_href[i_strlen] = '\0';
psz_tmp = psz_href + (i_strlen-1);
# include "config.h"
#endif
-#include <assert.h>
-
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_input.h>
free( psz_text );
/* All the other stuff we add to the header field */
- if( !p_sys->psz_header )
- p_sys->psz_header = strdup( "" );
- if( !p_sys->psz_header )
+ char *psz_header;
+ if( asprintf( &psz_header, "%s%s\n",
+ p_sys->psz_header ? p_sys->psz_header : "", s ) == -1 )
return VLC_ENOMEM;
-
- p_sys->psz_header = realloc_or_free( p_sys->psz_header,
- strlen( p_sys->psz_header ) + strlen( s ) + 2 );
- assert( p_sys->psz_header );
- strcat( p_sys->psz_header, s );
- strcat( p_sys->psz_header, "\n" );
+ p_sys->psz_header = psz_header;
}
}
/* Directives are NOT parsed yet */
/* This has probably a better place in a decoder ? */
/* directive = malloc( strlen( psz_text ) + 1 );
- assert( directive );
if( sscanf( psz_text, "%s %[^\n\r]", directive, psz_text2 ) == 2 )*/
}
#include <vlc_common.h>
#include <vlc_plugin.h>
-#include <vlc_memory.h>
#include <ctype.h>
#include <assert.h>
char *psz_event_text = malloc(130);
char *psz_ext_text = malloc(1025);
- assert( psz_name );
- assert( psz_event_text );
- assert( psz_ext_text );
-
// 2 bytes version Uimsbf (4,5)
// 2 bytes reserved (6,7)
// 2 bytes duration in minutes Uimsbf (8,9(
{
p_sys->i_ts_read = 1500 / p_sys->i_packet_size;
}
- p_sys->buffer = malloc( p_sys->i_packet_size * p_sys->i_ts_read );
- assert( p_sys->buffer );
+ p_sys->buffer = xmalloc( p_sys->i_packet_size * p_sys->i_ts_read );
msg_Info( p_demux, "%s raw stream to file `%s' reading packets %d",
b_append ? "appending" : "dumping", p_sys->psz_file,
p_sys->i_ts_read );
if( !b_old_valid )
{
- pid->psi = malloc( sizeof( ts_psi_t ) );
+ pid->psi = xmalloc( sizeof( ts_psi_t ) );
if( pid->psi )
{
pid->psi->handle = NULL;
{
msg_Dbg( p_demux, " - text='%s'", psz_text );
- psz_extra = realloc_or_free( psz_extra,
+ psz_extra = xrealloc( psz_extra,
strlen(psz_extra) + strlen(psz_text) + 1 );
- assert( psz_extra );
strcat( psz_extra, psz_text );
free( psz_text );
}
{
msg_Dbg( p_demux, " - desc='%s' item='%s'", psz_dsc, psz_itm );
#if 0
- psz_extra = realloc_or_free( psz_extra,
+ psz_extra = xrealloc( psz_extra,
strlen(psz_extra) + strlen(psz_dsc) +
strlen(psz_itm) + 3 + 1 );
- assert( psz_extra );
strcat( psz_extra, "(" );
strcat( psz_extra, psz_dsc );
strcat( psz_extra, " " );
# include "config.h"
#endif
-#include <assert.h>
-
#include <vlc_common.h>
#include <vlc_plugin.h>
-#include <vlc_memory.h>
#include <errno.h>
#include <sys/types.h>
p_demux->pf_demux = Demux;
p_demux->pf_control = Control;
p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) );
- assert( p_sys );
+ if( unlikely( !p_sys ) )
+ return VLC_ENOMEM;
p_sys->i_length = 0;
p_sys->p_vobsub_stream = NULL;
p_sys->i_tracks = 0;
- p_sys->track = (vobsub_track_t *)malloc( sizeof( vobsub_track_t ) );
- assert( p_sys->track );
+ p_sys->track = malloc( sizeof( vobsub_track_t ) );
+ if( unlikely( !p_sys->track ) )
+ {
+ free( p_sys );
+ return VLC_ENOMEM;
+ }
p_sys->i_original_frame_width = -1;
p_sys->i_original_frame_height = -1;
p_sys->b_palette = false;
language, &i_track_id ) == 2 )
{
p_sys->i_tracks++;
- p_sys->track = realloc_or_free( p_sys->track,
+ p_sys->track = xrealloc( p_sys->track,
sizeof( vobsub_track_t ) * (p_sys->i_tracks + 1 ) );
- assert( p_sys->track );
language[2] = '\0';
/* Init the track */
memset( current_tk, 0, sizeof( vobsub_track_t ) );
current_tk->i_current_subtitle = 0;
current_tk->i_subtitles = 0;
- current_tk->p_subtitles = malloc( sizeof( subtitle_t ) );;
- assert( current_tk->p_subtitles );
+ current_tk->p_subtitles = xmalloc( sizeof( subtitle_t ) );;
current_tk->i_track_id = i_track_id;
current_tk->i_delay = (int64_t)0;
current_tk->i_subtitles++;
current_tk->p_subtitles =
- realloc_or_free( current_tk->p_subtitles,
+ xrealloc( current_tk->p_subtitles,
sizeof( subtitle_t ) * (current_tk->i_subtitles + 1 ) );
- assert( current_tk->p_subtitles );
current_sub = ¤t_tk->p_subtitles[current_tk->i_subtitles - 1];
current_sub->i_start = i_start * i_sign;
# include "config.h"
#endif
-#include <assert.h>
-
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_osd.h>
_("Building font cache"),
_("Please wait while your font cache is rebuilt.\n"
"This should take less than few minutes."), NULL );
- char *path;
- path = (char *)malloc( PATH_MAX + 1 );
+ char *path = xmalloc( PATH_MAX + 1 );
/* Fontconfig doesnt seem to know where windows fonts are with
* current contribs. So just tell default windows font directory
* is the place to search fonts
*/
- assert( path );
GetWindowsDirectory( path, PATH_MAX + 1 );
strcat( path, "\\fonts" );
if( p_dialog )
#include <ctype.h>
#include <stdarg.h>
-#include <assert.h>
-
#undef XTAG_DEBUG
typedef struct _XList
{
XList *l, *last;
- l = (XList *)malloc( sizeof(XList) );
- assert( l );
+ l = (XList *)xmalloc( sizeof(XList) );
l->prev = l->next = NULL;
l->data = data;
if( xi > 0 && xtag_cin (s[xi], good_end) )
{
- ret = malloc( xi+1 );
- assert( ret );
+ ret = xmalloc( xi+1 );
strncpy( ret, s, xi );
ret[xi] = '\0';
parser->start = &s[xi];
}
}
- ret = malloc( xi+1 );
- assert( ret );
+ ret = xmalloc( xi+1 );
strncpy( ret, s, xi );
ret[xi] = '\0';
parser->start = &s[xi];
goto err_free_name;
}
- attr = malloc( sizeof (*attr) );
- assert( attr );
+ attr = xmalloc( sizeof (*attr) );
attr->name = name;
attr->value = value;
return attr;
if( (pcdata = xtag_slurp_to( parser, X_OPENTAG, X_NONE )) != NULL )
{
- tag = malloc( sizeof(*tag) );
- assert( tag );
+ tag = xmalloc( sizeof(*tag) );
tag->name = NULL;
tag->pcdata = pcdata;
tag->parent = parser->current_tag;
fprintf (stderr, "<%s ...\n", name);
#endif
- tag = malloc( sizeof(*tag) );
- assert( tag );
+ tag = xmalloc( sizeof(*tag) );
tag->name = name;
tag->pcdata = NULL;
tag->parent = parser->current_tag;
return tag;
}
- wrapper = malloc( sizeof(XTag) );
- assert( wrapper );
+ wrapper = xmalloc( sizeof(XTag) );
wrapper->name = NULL;
wrapper->pcdata = NULL;
wrapper->parent = NULL;
# include "config.h"
#endif
-#include <assert.h>
-
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_sout.h>
#include <vlc_block.h>
#include <vlc_codecs.h>
-#include <vlc_memory.h>
/*****************************************************************************
* Module descriptor
if( p_sys->idx1.i_entry_count >= p_sys->idx1.i_entry_max )
{
p_sys->idx1.i_entry_max += 10000;
- p_sys->idx1.entry = realloc_or_free( p_sys->idx1.entry,
+ p_sys->idx1.entry = xrealloc( p_sys->idx1.entry,
p_sys->idx1.i_entry_max * sizeof( avi_idx1_entry_t ) );
- assert( p_sys->idx1.entry );
}
p_data = block_Realloc( p_data, 8, p_data->i_buffer );
# include "config.h"
#endif
-#include <assert.h>
-
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_sout.h>
#include <vlc_block.h>
-#include <vlc_memory.h>
#include <time.h>
if( p_stream->i_entry_count >= p_stream->i_entry_max - 1 )
{
p_stream->i_entry_max += 1000;
- p_stream->entry = realloc_or_free( p_stream->entry,
+ p_stream->entry = xrealloc( p_stream->entry,
p_stream->i_entry_max * sizeof( mp4_entry_t ) );
- assert( p_stream->entry );
}
/* update */
if( !p_buffer )
{
p_bo->i_buffer_size = __MAX( i_size, 1024 );
- p_bo->p_buffer = malloc( p_bo->i_buffer_size );
- assert( p_bo->p_buffer );
+ p_bo->p_buffer = xmalloc( p_bo->i_buffer_size );
}
else
{
else if( p_bo->b_grow )
{
p_bo->i_buffer_size += 1024;
- p_bo->p_buffer = realloc_or_free( p_bo->p_buffer, p_bo->i_buffer_size );
- assert( p_bo->p_buffer );
+ p_bo->p_buffer = xrealloc( p_bo->p_buffer, p_bo->i_buffer_size );
p_bo->p_buffer[p_bo->i_buffer] = i;
}
# include "config.h"
#endif
-#include <assert.h>
-
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_sout.h>
#include <vlc_block.h>
#include <vlc_codecs.h>
-#include <vlc_memory.h>
#include <ogg/ogg.h>
/* move input in delete queue */
if( !p_stream->b_new )
{
- p_sys->pp_del_streams = realloc_or_free( p_sys->pp_del_streams,
+ p_sys->pp_del_streams = xrealloc( p_sys->pp_del_streams,
(p_sys->i_del_streams + 1) * sizeof(ogg_stream_t *) );
- assert( p_sys->pp_del_streams );
p_sys->pp_del_streams[p_sys->i_del_streams++] = p_stream;
}
else
# include "config.h"
#endif
-#include <assert.h>
-
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_sout.h>
#include <vlc_codec.h>
#include <vlc_block.h>
-#include <vlc_memory.h>
#include <vlc_bits.h>
#include <vlc_block_helper.h>
{
/* We have a vol */
p_dec->fmt_out.i_extra = p_dec->fmt_in.i_extra;
- p_dec->fmt_out.p_extra = malloc( p_dec->fmt_in.i_extra );
- assert( p_dec->fmt_out.p_extra );
+ p_dec->fmt_out.p_extra = xmalloc( p_dec->fmt_in.i_extra );
memcpy( p_dec->fmt_out.p_extra, p_dec->fmt_in.p_extra,
p_dec->fmt_in.i_extra );
if( (size_t)p_dec->fmt_out.i_extra != p_frag->i_buffer )
{
p_dec->fmt_out.p_extra =
- realloc_or_free( p_dec->fmt_out.p_extra, p_frag->i_buffer );
- assert( p_dec->fmt_out.p_extra );
+ xrealloc( p_dec->fmt_out.p_extra, p_frag->i_buffer );
p_dec->fmt_out.i_extra = p_frag->i_buffer;
}
memcpy( p_dec->fmt_out.p_extra, p_frag->p_buffer, p_frag->i_buffer );
# include "config.h"
#endif
-#include <assert.h>
-
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_codec.h>
#include <vlc_block.h>
-#include <vlc_memory.h>
#include <vlc_bits.h>
#include <vlc_block_helper.h>
/* Create the output format */
es_format_Copy( &p_dec->fmt_out, &p_dec->fmt_in );
p_dec->p_sys = p_sys = malloc( sizeof( decoder_sys_t ) );
- assert( p_sys );
+ if( unlikely( !p_sys ) )
+ return VLC_ENOMEM;
packetizer_Init( &p_sys->packetizer,
p_vc1_startcode, sizeof(p_vc1_startcode),
if( p_es->i_extra != i_extra )
{
p_es->i_extra = i_extra;
- p_es->p_extra = realloc_or_free( p_es->p_extra, p_es->i_extra );
- assert( p_es->p_extra );
+ p_es->p_extra = xrealloc( p_es->p_extra, p_es->i_extra );
}
memcpy( p_es->p_extra,
p_sys->sh.p_sh->p_buffer, p_sys->sh.p_sh->i_buffer );
if( p_sdp->psz_uri == NULL ) goto error;
p_demux->p_sys = (demux_sys_t *)malloc( sizeof(demux_sys_t) );
- assert( p_demux->p_sys );
+ if( unlikely( !p_demux->p_sys ) )
+ goto error;
p_demux->p_sys->p_sdp = p_sdp;
p_demux->pf_control = Control;
p_demux->pf_demux = Demux;
# include "config.h"
#endif
-#include <assert.h>
-
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_sout.h>
#include <vlc_block.h>
-#include <vlc_memory.h>
/*****************************************************************************
* Module descriptor
p_stream->p_cfg );
p_sys = malloc( sizeof( out_sout_stream_sys_t ) );
- assert( p_sys );
+ if( unlikely( !p_sys ) )
+ return VLC_ENOMEM;
p_sys->b_inited = false;
var_Create( p_this->p_libvlc, "bridge-lock", VLC_VAR_MUTEX );
p_bridge = var_GetAddress( p_stream->p_libvlc, p_sys->psz_name );
if ( p_bridge == NULL )
{
- p_bridge = malloc( sizeof( bridge_t ) );
- assert( p_bridge );
+ p_bridge = xmalloc( sizeof( bridge_t ) );
var_Create( p_stream->p_libvlc, p_sys->psz_name, VLC_VAR_ADDRESS );
var_SetAddress( p_stream->p_libvlc, p_sys->psz_name, p_bridge );
if ( i == p_bridge->i_es_num )
{
- p_bridge->pp_es = realloc_or_free( p_bridge->pp_es,
+ p_bridge->pp_es = xrealloc( p_bridge->pp_es,
(p_bridge->i_es_num + 1) * sizeof(bridged_es_t *) );
- assert( p_bridge->pp_es );
p_bridge->i_es_num++;
- p_bridge->pp_es[i] = malloc( sizeof(bridged_es_t) );
- assert( p_bridge->pp_es[i] );
+ p_bridge->pp_es[i] = xmalloc( sizeof(bridged_es_t) );
}
p_sys->p_es = p_es = p_bridge->pp_es[i];
vlc_value_t val;
p_sys = malloc( sizeof( in_sout_stream_sys_t ) );
- assert( p_sys );
+ if( unlikely( !p_sys ) )
+ return VLC_ENOMEM;
p_sys->p_out = sout_StreamNew( p_stream->p_sout, p_stream->psz_next );
if( !p_sys->p_out )
#include <vlc_image.h>
#include <vlc_filter.h>
-#include <vlc_memory.h>
-
#include "../video_filter/mosaic.h"
-#include <assert.h>
-
/*****************************************************************************
* Local structures
*****************************************************************************/
vlc_object_t *p_libvlc = VLC_OBJECT( p_stream->p_libvlc );
vlc_value_t val;
- p_bridge = malloc( sizeof( bridge_t ) );
- assert( p_bridge );
+ p_bridge = xmalloc( sizeof( bridge_t ) );
var_Create( p_libvlc, "mosaic-struct", VLC_VAR_ADDRESS );
val.p_address = p_bridge;
if ( i == p_bridge->i_es_num )
{
- p_bridge->pp_es = realloc_or_free( p_bridge->pp_es,
+ p_bridge->pp_es = xrealloc( p_bridge->pp_es,
(p_bridge->i_es_num + 1) * sizeof(bridged_es_t *) );
- assert( p_bridge->pp_es );
p_bridge->i_es_num++;
- p_bridge->pp_es[i] = malloc( sizeof(bridged_es_t) );
- assert( p_bridge->pp_es[i] );
+ p_bridge->pp_es[i] = xmalloc( sizeof(bridged_es_t) );
}
p_sys->p_es = p_es = p_bridge->pp_es[i];
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
-#include <assert.h>
#include <string.h>
#include <vlc_common.h>
#include <vlc_image.h>
#include <vlc_osd.h>
-#include <vlc_memory.h>
-
#ifdef LoadImage
# undef LoadImage
#endif
res = strtok_r(i_values, delim, &tok);
while (res != NULL) {
p_BarGraph->nbChannels++;
- p_BarGraph->i_values = realloc_or_free(p_BarGraph->i_values,
+ p_BarGraph->i_values = xrealloc(p_BarGraph->i_values,
p_BarGraph->nbChannels*sizeof(int));
- assert(p_BarGraph->i_values);
p_BarGraph->i_values[p_BarGraph->nbChannels-1] = __MAX( __MIN( atof(res)*p_BarGraph->scale, p_BarGraph->scale ), 0 );
res = strtok_r(NULL, delim, &tok);
}
# include "config.h"
#endif
-#include <assert.h>
-
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_filter.h>
-#include <vlc_memory.h>
#define BLUESCREEN_HELP N_( \
"This effect, also known as \"greenscreen\" or \"chroma key\" blends " \
return NULL;
}
- p_sys->p_at = realloc_or_free( p_sys->p_at,
- i_lines * i_pitch * sizeof( uint8_t ) );
- assert( p_sys->p_at );
+ p_sys->p_at = xrealloc( p_sys->p_at,
+ i_lines * i_pitch * sizeof( uint8_t ) );
p_at = p_sys->p_at;
vlc_mutex_lock( &p_sys->lock );
# include "config.h"
#endif
-#include <assert.h>
-
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_memory.h>
{
double f_sigma = p_sys->f_sigma;
int i_dim = (int)(3.*f_sigma);
- type_t *pt_distribution = malloc( (2*i_dim+1) * sizeof( type_t ) );
+ type_t *pt_distribution = xmalloc( (2*i_dim+1) * sizeof( type_t ) );
int x;
- assert( pt_distribution );
-
for( x = -i_dim; x <= i_dim; x++ )
{
const float f_distribution = sqrt( exp(-(x*x)/(f_sigma*f_sigma) ) / (2.*M_PI*f_sigma*f_sigma) );
const int i_pitch = p_pic->p[Y_PLANE].i_pitch;
int i_col, i_line;
- p_sys->pt_scale = malloc( i_visible_lines * i_pitch * sizeof( type_t ) );
+ p_sys->pt_scale = xmalloc( i_visible_lines * i_pitch * sizeof( type_t ) );
pt_scale = p_sys->pt_scale;
- assert( pt_scale );
for( i_line = 0 ; i_line < i_visible_lines ; i_line++ )
{
#include <math.h>
#include <limits.h> /* INT_MAX */
-#include <assert.h>
#include <vlc_filter.h>
#include <vlc_image.h>
-#include <vlc_memory.h>
-
#include "mosaic.h"
#define BLANK_DELAY INT64_C(1000000)
{
i_index++;
- p_sys->pi_x_offsets = realloc_or_free( p_sys->pi_x_offsets,
+ p_sys->pi_x_offsets = xrealloc( p_sys->pi_x_offsets,
i_index * sizeof(int) );
- assert( p_sys->pi_x_offsets );
p_sys->pi_x_offsets[i_index - 1] = atoi( psz_offsets );
psz_end = strchr( psz_offsets, ',' );
psz_offsets = psz_end + 1;
- p_sys->pi_y_offsets = realloc_or_free( p_sys->pi_y_offsets,
+ p_sys->pi_y_offsets = xrealloc( p_sys->pi_y_offsets,
i_index * sizeof(int) );
- assert( p_sys->pi_y_offsets );
p_sys->pi_y_offsets[i_index - 1] = atoi( psz_offsets );
psz_end = strchr( psz_offsets, ',' );
psz_offsets = psz_end + 1;
{
psz_end = strchr( psz_order, ',' );
i_index++;
- p_sys->ppsz_order = realloc_or_free( p_sys->ppsz_order,
+ p_sys->ppsz_order = xrealloc( p_sys->ppsz_order,
i_index * sizeof(char *) );
- assert( p_sys->ppsz_order );
p_sys->ppsz_order[i_index - 1] = strndup( psz_order,
psz_end - psz_order );
psz_order = psz_end+1;
{
psz_end = strchr( psz_order, ',' );
i_index++;
- p_sys->ppsz_order = realloc_or_free( p_sys->ppsz_order,
+ p_sys->ppsz_order = xrealloc( p_sys->ppsz_order,
i_index * sizeof(char *) );
- assert( p_sys->ppsz_order );
p_sys->ppsz_order[i_index - 1] = strndup( psz_order,
psz_end - psz_order );
psz_order = psz_end+1;
# include "config.h"
#endif
-#include <assert.h>
-
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_image.h>
-#include <vlc_memory.h>
-
#include <time.h>
/*****************************************************************************
{
b_is_item = true;
p_feed->i_items++;
- p_feed->p_items = realloc_or_free( p_feed->p_items,
+ p_feed->p_items = xrealloc( p_feed->p_items,
p_feed->i_items * sizeof( rss_item_t ) );
- assert( p_feed->p_items );
p_feed->p_items[p_feed->i_items-1].psz_title = NULL;
p_feed->p_items[p_feed->i_items-1].psz_description = NULL;
p_feed->p_items[p_feed->i_items-1].psz_link = NULL;
# include "config.h"
#endif
-#include <assert.h>
-
#include <vlc_common.h>
#include <vlc_plugin.h>
#include <vlc_vout.h>
#include <vlc_playlist.h> /* needed for wallpaper */
-#include <vlc_memory.h>
#include <ddraw.h>
#include <commctrl.h> /* ListView_(Get|Set)* */
module_config_t *p_item = (module_config_t *)p_context;
- p_item->ppsz_list = realloc_or_free( p_item->ppsz_list,
+ p_item->ppsz_list = xrealloc( p_item->ppsz_list,
(p_item->i_list+2) * sizeof(char *) );
- assert( p_item->ppsz_list );
- p_item->ppsz_list_text = realloc_or_free( p_item->ppsz_list_text,
+ p_item->ppsz_list_text = xrealloc( p_item->ppsz_list_text,
(p_item->i_list+2) * sizeof(char *) );
- assert( p_item->ppsz_list_text );
p_item->ppsz_list[p_item->i_list] = strdup( psz_drivername );
p_item->ppsz_list_text[p_item->i_list] = NULL;