/*****************************************************************************
* Module descriptor.
*****************************************************************************/
-vlc_module_begin();
- set_description( N_("Miscellaneous stress tests") );
+vlc_module_begin ()
+ set_description( N_("Miscellaneous stress tests") )
var_Create( p_module->p_libvlc, "foo-test",
VLC_VAR_VOID | VLC_VAR_ISCOMMAND );
var_AddCallback( p_module->p_libvlc, "foo-test", Foo, NULL );
var_Create( p_module->p_libvlc, "signal",
VLC_VAR_STRING | VLC_VAR_ISCOMMAND );
var_AddCallback( p_module->p_libvlc, "signal", Signal, NULL );
-vlc_module_end();
+vlc_module_end ()
/*****************************************************************************
* Foo: put anything here
var_Change( p_this, "honk", VLC_VAR_SETDEFAULT, &val, NULL );
var_Get( p_this, "honk", &val ); printf( "value: %s\n", val.psz_string );
+ free( val.psz_string );
val.psz_string = "foo";
var_Set( p_this, "honk", val );
var_Get( p_this, "honk", &val ); printf( "value: %s\n", val.psz_string );
+ free( val.psz_string );
val.psz_string = "blork";
var_Set( p_this, "honk", val );
var_Get( p_this, "honk", &val ); printf( "value: %s\n", val.psz_string );
+ free( val.psz_string );
val.psz_string = "baz";
var_Change( p_this, "honk", VLC_VAR_DELCHOICE, &val, NULL );
while( vlc_object_alive (p_this) )
{
int i = (int) (100.0 * rand() / (RAND_MAX));
+ /* FIXME: not thread-safe */
sprintf( psz_var, "blork-%i", i );
val.i_int = i + 200;
+ int canc = vlc_savecancel ();
var_Set( p_parent, psz_var, val );
+ vlc_restorecancel (canc);
/* This is quite heavy, but we only have 10 threads. Keep cool. */
msleep( 1000 );
/* Allocate required data */
ppsz_name = malloc( MAXVAR * i_level * sizeof(char*) );
- psz_blob = malloc( 20 * MAXVAR * i_level * sizeof(char) );
+ psz_blob = malloc( 20 * MAXVAR * i_level );
for( i = 0; i < MAXVAR * i_level; i++ )
{
ppsz_name[i] = psz_blob + 20 * i;