Author: kkaempf Date: Wed May 28 17:32:06 2008 New Revision: 10266 URL: http://svn.opensuse.org/viewcvs/zypp?rev=10266&view=rev Log: Ruby: convert add_solv() argument to string Modified: trunk/sat-solver/bindings/pool.i trunk/sat-solver/bindings/repo.i Modified: trunk/sat-solver/bindings/pool.i URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/bindings/pool.i?rev=10266&r1=10265&r2=10266&view=diff ============================================================================== --- trunk/sat-solver/bindings/pool.i (original) +++ trunk/sat-solver/bindings/pool.i Wed May 28 17:32:06 2008 @@ -99,8 +99,17 @@ return repo; } +#if defined(SWIGRUBY) + Repo *add_solv( VALUE name ) + { + const char *fname; + /* try string conversion if not already a string */ + name = rb_check_convert_type( name, T_STRING, "String", "to_s" ); + fname = StringValuePtr( name ); +#else Repo *add_solv( const char *fname ) { +#endif Repo *repo = repo_create( $self, NULL ); FILE *fp = fopen( fname, "r"); if (fp) { Modified: trunk/sat-solver/bindings/repo.i URL: http://svn.opensuse.org/viewcvs/zypp/trunk/sat-solver/bindings/repo.i?rev=10266&r1=10265&r2=10266&view=diff ============================================================================== --- trunk/sat-solver/bindings/repo.i (original) +++ trunk/sat-solver/bindings/repo.i Wed May 28 17:32:06 2008 @@ -41,8 +41,17 @@ void add_file( FILE *fp ) { repo_add_solv( $self, fp ); } +#if defined(SWIGRUBY) + void add_solv( VALUE name ) + { + const char *fname; + /* try string conversion if not already a string */ + name = rb_check_convert_type( name, T_STRING, "String", "to_s" ); + fname = StringValuePtr( name ); +#else void add_solv( const char *fname ) { +#endif FILE *fp = fopen( fname, "r"); if (fp) { repo_add_solv( $self, fp ); -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org