ext/Connection.c in rubyfb-0.5.4 vs ext/Connection.c in rubyfb-0.5.5

- old
+ new

@@ -104,11 +104,12 @@ short length = 0; char *file = NULL, *dpb = NULL; VALUE user = Qnil, password = Qnil, - options = Qnil; + options = Qnil, + tmp_str = Qnil; if(argc < 1) { rb_raise(rb_eArgError, "Wrong number of arguments (%d for %d).", argc, 1); } @@ -116,11 +117,14 @@ if(TYPE(argv[0]) != T_DATA || RDATA(argv[0])->dfree != (RUBY_DATA_FUNC)databaseFree) { rb_fireruby_raise(NULL, "Invalid database specified for connection."); } - file = STR2CSTR(rb_iv_get(argv[0], "@file")); + + tmp_str = rb_iv_get(argv[0], "@file"); + file = StringValuePtr(tmp_str); + Data_Get_Struct(self, ConnectionHandle, connection); /* Extract parameters. */ if(argc > 1) { @@ -298,10 +302,10 @@ VALUE database = rb_iv_get(self, "@database"), user = rb_iv_get(self, "@user"), file = rb_iv_get(database, "@file"); char text[256]; - sprintf(text, "%s@%s (OPEN)", STR2CSTR(user), STR2CSTR(file)); + sprintf(text, "%s@%s (OPEN)", StringValuePtr(user), StringValuePtr(file)); result = rb_str_new2(text); } return(result); }