// S : tags c vararg $TAGS // S : expect --result valid // S : cc -o test.bc $CC_OPT $file // S : verify $V_OPT test.bc #include #include #include #include #include int call_vasprintf( char **out, const char *fmt, ... ) { int rc; va_list ap; va_start( ap, fmt ); return vasprintf( out, fmt, ap ); va_end( ap ); return rc; } int main( void ) { char *buf = NULL; int r = call_vasprintf( &buf, "test" ); if ( r != 0 ) { // !oom assert( r == 4 ); assert( buf != NULL ); assert( strncmp( "test", buf, 4 ) == 0 ); free( buf ); } return 0; }